Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_parse_tag

Plugin, ACE table, Discussion thread
Dependence:
rex_parse_initialize

Introduction
Paste tags on objects.

Usage

Prepare
Add 
rex_parse_initialize to set api id and javascript key.
Paste tag
Sample capx
Call "
Action:Paste tag" to paste a tag on an item. A tag is composed of some fields -
  • OwnerID: Object ID of tag owner
  • TargetID: Object ID of tagged target.
  • User tag / Category: tag name defined by user of by system.
  • Description: (Optional) Description of this tag. Input "" to ignore this field.
If "Owner class name" or "Target class name" is set to non-empty string in properties table, this tag will link to the specific row in owner class or target class.
"Condition:On paste complete" will be triggered while pasting complete, otherwise "Condition:On paste error" will be triggered.
Get properties of pasted tag by these expressions-
  • Expression:LastPastedOwnerID
  • Expression:LastPastedTargetID
  • Expression:LastPastedTagID
  • Expression:LastPastedUserTag
  • Expression:LastPastedCategory
  • Expression:LastPastedDescription

Retrieve tags
It could retrieve tags by a filter, like rex_parse_message plugin.
Tag filter
Follow these steps to create a filter-
1. Call "Action:New" to create a new filter.
2. Add conditions into this new filter. There are 4 kinds of conditions filter-
  • OwnerID: "Action:All owners", "Action:Add owner"
  • TargerID: "Action:All targets", "Action:Add target"
  • User tag: "Action:All user tags", "Action:Add user tag"
  • Category: "Action:All categoies", "Action:Add category"
Fetching tags
After build a new tag filter by these steps, call one of request actions to start fetching -
Pages
  • Action:Request to page
  • Action:Request current page
  • Action:Request next page
  • Action:Request previous page
Received tags would be divided into pages, which started from page 0 (0-based). Lines of each page is set at "Lines" in properties table.
Start from any index
Or call "Action:Request in a range" to fetch tags started from any index.
Do not mix this action with pages type requests described at previous section.
Retrieve tags
"
Condition:On received" will be triggered when received requested tags. Then use "Condition:For each tag" or "Condition:For each tag in a range" to retrieve these tags by these expressions.

  • Expression:CurOwnerID
  • Expression:CurTargetID
  • Expression:CurUserTag
  • Expression:CurCategory
  • Expression:CurDescription
  • Expression:CurOwnerObject ( key )
  • Expression:CurTargetObject ( key )
  • Expression:CurTagID
  • Expression:CurTagIndex, global tag index, which is 0-based
  • Expression:CurStartIndex, start index of current page
  • Expression:LoopIndex, loop index of current loop
Or get all retrieved tags in JSON string by "
Expression:TagsToJSON".
If "Owner class" or "Target class" is assigned while pasted, owner object or target object would be fetched in the same time. Read these values by "Expression:CurOwnerObject" or "Expression:CurTargetObject".
There are 3 kinds of return value in "Expression:CurOwnerObject" or "Expression:CurTargetObject"-
  • "Expression:CurOwnerObject" / "Expression:CurTargetObject" without any parameter, will return key-value pairs of current owner object or target object in JSON string.
  • "Expression:CurOwnerObject( key )" / "Expression:CurTargetObject( key )", will return the value of a specific key, or return 0 if the key does not exist.
  • "Expression:CurOwnerObject( key, default_value )" / "Expression:CurTargetObject( key, default_value )", will return the value of a specific key, or return default value if the key does not exist.

Remove tags
It could remove tags
picked by filter.
First creating a new filter described at previous section, then call "
Action:Remove queried tags" to remove them.
"
Condition:On remove queried tags complete" will be triggered when all tags removed success, otherwise "Condition:On remove queried tags error" will be triggered.
_

Tags count
Get filtered tag count by "
Action:Get tags count" after build a new tag filter. The result is put at "Expression:LastTagsCount" under "Condition:On get tags count complete", otherwise "Condition:On get tags count error" if requesting failed.

Tags list
Sample capx
It also supports counting each kind of tag
picked by filter. This feature could be used to make a tags cloud.
First creating a new filter described at previous section, then call "Action:Request tag list" to get tags.
"
Condition:On get tags list" will be triggered when all tags removed success, otherwise "Condition:On get tags list error" will be triggered.
Now user could retrieve each kind of tag by "
Condition:For each kind of tag", which supports 4 sorting methods - sorting by tag name in ascending/descending order, or sorting by tag count in ascending/descending order. Get tag name and tag count of this kind of tag by "Expression:TLCurTagName" or "Expression:TLCurTagsCount". Or get name-count pair in JSON string by "Expression:TLToJSON".
Get total tag names count by Expression:TLTagNameCount",total tags count by "Expression:TLTotalTagsCount".

Reset user tags
Sample capx
It supports reset user tags of a target by these steps-
  1. Call "Action:Add user tag" for each new user tag.
  2. Then call "Action:Reset user tags" to reset tags of a target.
  3. "Condition:On reset tags complete" will be triggered while reset user tags success, otherwise "Condition:On reset tags error" will be triggered.
"Action:Reset user tags" will
  1. first find all user tags pasted on the specific target, it would cost 1 or more request if tags count is equal to or larger than 1000,
  2. then remove these tags object, it would cost 1 request,
  3. finally save new tag objects in 1 request.
So that this action would cost at last 3 requests.
Reset targets
Sample capx
It supports reset targets of an user tag by these steps-
  1. Call "Action:Add targetID" for each new targetID.
  2. Then call "Action:Reset targets" to reset targets of an user tag.
  3. "Condition:On reset targets complete" will be triggered while reset user tags success, otherwise "Condition:On reset targets error" will be triggered.
"Action:Reset targets" will
  1. first find all targets which have specific user tag, it would cost 1 or more request if targets count is equal to or larger than 1000,
  2. then remove these tags object, it would cost 1 request,
  3. finally save new tag objects in 1 request.
So that this action would cost at last 3 requests.

Instance of request
Designer could create a new instance for each request. Or place multiple rex_parse_tag object for each different kind of request.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About