rex_matcher
Introduction
This plugin could get tiles with matched patterns on an orthogonal or isometric, or hexagonal board object.
This plugin could get tiles with matched patterns on an orthogonal or isometric, or hexagonal board object.
Usage
Concept
Symbol
Each tile would have a symbol indicated by a character, for example
Each tile would have a symbol indicated by a character, for example
"1"
or no valid symbol.These symbols would be stored in a symbol table.
Reserve symbol
"," is reserved symbol which is used to split symbols. See next section for more detail.
"," is reserved symbol which is used to split symbols. See next section for more detail.
Pattern
1-d pattern
A pattern is defined by a sequence of symbols, it could be one-dimension, for example
1-d pattern
A pattern is defined by a sequence of symbols, it could be one-dimension, for example
"111"
It means that this pattern is composed of three "1" symbols.
Or add "," to split symbols, like
Or add "," to split symbols, like
"1,1,1"
2-d pattern
The pattern also could be two-dimensions display by a csv format i.e. each symbol is spitted by comma ",", for example
The pattern also could be two-dimensions display by a csv format i.e. each symbol is spitted by comma ",", for example
"1,1,1
,1,"
This pattern is composed of four "1" symbols within "T" shaped. The cell with "" is indicated ignored (i.e. do not compare this cell while matching procedure).
Before matching procedure
This plugin would get symbol of each tile on a board object, then picking matched tiles into a instance group. So that user need to put a rex_board and rex_ginstgroup objects into project first.
This plugin would get symbol of each tile on a board object, then picking matched tiles into a instance group. So that user need to put a rex_board and rex_ginstgroup objects into project first.
Matching procedure
1. the matching procedure would be started when running these conditions
3. Picking the result of matched tiles into target instance group. Now user could manipulate these tiles by conditions or actions of rex_ginstgroup. Note that the picking result is tiles, not chess.
1. the matching procedure would be started when running these conditions
- Condition:For each 1d pattern, Condition:For each N symbols
- Condition:Any 1d pattern, Condition:Any N symbols
- Condition:For each 2D pattern, Condition:For each 2D template pattern
- Condition:Any 2D pattern, Condition:Any 2D template pattern
3. Picking the result of matched tiles into target instance group. Now user could manipulate these tiles by conditions or actions of rex_ginstgroup. Note that the picking result is tiles, not chess.
1-d pattern
Use "Condition:For each 1d pattern" to pick tiles matched by a 1-d pattern, or use "Condition:For each N symbols" to pick tiles matched by N continuous symbols.
"Condition:Any 1d pattern", or "Condition:Any N symbols" would only check if there has any matching.
Use "Condition:For each 1d pattern" to pick tiles matched by a 1-d pattern, or use "Condition:For each N symbols" to pick tiles matched by N continuous symbols.
"Condition:Any 1d pattern", or "Condition:Any N symbols" would only check if there has any matching.
"Condition:No pattern" will return true if no matched in previous matching procedure.
Axis of square board
There are three axis to get 1d pattern, "Horizontal", "Vertical", "Isometric". Enable them individual in properties table, or call "Action:Compare at horizontal axis", "Action:Compare at vertical axis", "Action:Compare at isometric axis" to configure them at run-time.
There are three axis to get 1d pattern, "Horizontal", "Vertical", "Isometric". Enable them individual in properties table, or call "Action:Compare at horizontal axis", "Action:Compare at vertical axis", "Action:Compare at isometric axis" to configure them at run-time.
Get symbol
The symbol would be got under "Condition:On get symbol".
User could use "Expression:TileUID", "Expression:TileX", or "Expression:TileY" to get the target tile instance, or chess instance above this target tile by conditions of rex_board.
Then use "Action:Set symbol" to return the symbol value in string type. No "Action:Set symbol" called, or return "Expression:NOSYMBOL" in this action means that this is an invalid symbol.
Symbol could read back by "Expression:LXY2Symbol", or "Expression:UID2Symbol". They also use "Condition:On get symbol" to get symbol. i.e. symbol on this logic position will be updated.
The symbol would be got under "Condition:On get symbol".
User could use "Expression:TileUID", "Expression:TileX", or "Expression:TileY" to get the target tile instance, or chess instance above this target tile by conditions of rex_board.
Then use "Action:Set symbol" to return the symbol value in string type. No "Action:Set symbol" called, or return "Expression:NOSYMBOL" in this action means that this is an invalid symbol.
Symbol could read back by "Expression:LXY2Symbol", or "Expression:UID2Symbol". They also use "Condition:On get symbol" to get symbol. i.e. symbol on this logic position will be updated.
Refresh symbol table
The symbol table would be created once during a tick while set property "Update symbols" to "Auto" , so that conditions of matching pattern will reference the same symbol table. Call "Action:Update all" under category "Symbol array: force update" could refresh symbol table if needs. It will trigger "Condition:On get symbol" for each tile.
"Action:Update cell by LXY", "Action:Update cell by chess", or "Action:Update cell by chess uid" is used to update a symbol at dedicate cell indexed by logical XY, or a chess object, or a uid of chess. These will trigger "Condition:On get symbol" once.
If property "Update symbols" is set to "Manual", symbol table only created by "Action:Update all". It is recommended that set "Update symbols" to "Auto".
The symbol table would be created once during a tick while set property "Update symbols" to "Auto" , so that conditions of matching pattern will reference the same symbol table. Call "Action:Update all" under category "Symbol array: force update" could refresh symbol table if needs. It will trigger "Condition:On get symbol" for each tile.
"Action:Update cell by LXY", "Action:Update cell by chess", or "Action:Update cell by chess uid" is used to update a symbol at dedicate cell indexed by logical XY, or a chess object, or a uid of chess. These will trigger "Condition:On get symbol" once.
If property "Update symbols" is set to "Manual", symbol table only created by "Action:Update all". It is recommended that set "Update symbols" to "Auto".
Wildcard symbol
Sample capx
Set wildcard symbol in "Wildcard" property. Symbol which is equal to this wildcard will be determined to match.
Sample capx
Set wildcard symbol in "Wildcard" property. Symbol which is equal to this wildcard will be determined to match.
Matched axis
User could put "Condition:Matched axis (Square)" or "Condition:Matched axis (Hex)" to detect the matched axis of current matched tiles, under "condition: On N symbols", or "condition: On 1d pattern".
User could put "Condition:Matched axis (Square)" or "Condition:Matched axis (Hex)" to detect the matched axis of current matched tiles, under "condition: On N symbols", or "condition: On 1d pattern".
2-d pattern
Use "Condition:For each 2D pattern" to pick tiles matched by a 2-d pattern, or use "Condition:For each 2D template pattern" to pick tiles matched by a template. A 2d template pattern is a 2d pattern with the same wild-cards symbol.
"Condition:Any 2D pattern", or "Condition:Any 2D template pattern" would only check if there has any matching.
Others are the same as 1-d pattern.
Use "Condition:For each 2D pattern" to pick tiles matched by a 2-d pattern, or use "Condition:For each 2D template pattern" to pick tiles matched by a template. A 2d template pattern is a 2d pattern with the same wild-cards symbol.
"Condition:Any 2D pattern", or "Condition:Any 2D template pattern" would only check if there has any matching.
Others are the same as 1-d pattern.
Auto update symbol table
Set "Update symbols" to "Manual" would not update symbol table automatically, user needs call "Action:Update all" to update symbol table before get matched tiles.
Default is "Auto" us
Set "Update symbols" to "Manual" would not update symbol table automatically, user needs call "Action:Update all" to update symbol table before get matched tiles.
Default is "Auto" us