- Joined
- Aug 18, 2009
- Messages
- 4,097
I am trying to parse the gui trigger file format of TFT (version 7) and have not fully succeeded.
According to http://www.wc3c.net/tools/specs/index.html
it's as following:
As you may see, ECA (event/condition/action) structures may be nested. This is the case with loops or other blocks. However, my issue is that the int: ??? seems to be missing or displaced sometimes.
The definition stated here, which is of version 4, says:
So there, the/an unknown int would be after the amount of ECAs and exists only under special conditions* (that I cannot confirm either).
*(has no parent ECA OR it's the last defined child of the whole hierarchy except its own children) AND has at least 1 child itself
The example code I am currently looking at:
There should not be a number between type and funcName of an ECA. Of course I am assuming that 02 00 00 00 is the type here because otherwise it could be only the ??? int and the 00 00 00 00 would represent the DoNothing-ECA as an event, which is tosh.
According to http://www.wc3c.net/tools/specs/index.html
it's as following:
Code:
[COLOR="Wheat"]char[4]: file ID (WTG!)
int: wtg file format version = 7
int: number "a" of triggers categories
"a" times a category definition structure*
int: number "b" ???
int: number "c" of variables
"c" times a variable definition structure**
int: number "d" of triggers
"d" times a trigger definition structure***[/COLOR]
[COLOR="Teal"][B][U]*Category Definition Structure:[/U][/B]
int: category index
String: category name
int: Category type: 0=normal, 1=comment[/COLOR]
[COLOR="DarkOrchid"][B][U]**Variable Definition Structure:[/U][/B]
String: variable name
String: variable type
int: number "e" ???
int: array status: 0=not an array, 1=array
int: array size
int: initialisation status: 0=not initialized, 1=initialized
String: initial value (string)[/COLOR]
[COLOR="YellowGreen"][B][U]***Triggers Definiton Structure:[/U][/B]
String: trigger name
String: trigger description
int: trigger type: 0=normal, 1=comment
int: enable state: 0=disabled, 1=enabled
int: custom text trigger state: 0=not a custom text trigger, 1=custom text trigger (use data in the WCT)
int: initial state: 0=initially on, 1=not initially on
int: run on map initialization: 0=no, 1=yes
int: index of the category the trigger belongs to
int: number "i" of event-condition-action (ECA) function
"i" times an ECA function definition structure*(4) (if it's a custom text trigger it should be 0 so we don't have this section)[/COLOR]
[COLOR="Magenta"][B][U]*(4)ECA function definition structure[/U][/B]
int: function type: 0=event, 1=condition, 2=action
String: function name
int: enable state: 0=function disabled, 1=function enabled
"x" times a parameter structure*(5). x depends of the function and is hardcoded.
int: ???
int: number "i" of event-condition-action (ECA) function
"i" times an ECA function definition structure*(4)(if this trigger doesn't have multiple actions it should be set to 0 so we don't have this section)[/COLOR]
[COLOR="DarkOrange"][B][U]*(5)Parameters Structure:[/U][/B]
int: type which can be 0=preset, 1=variable, 2=function, 3=string
String: parameter value
int: begin function (if it is function it should be set to 1 otherwise to 0)
���� if begin function is set to 1:
���� int: type: 3
���� String: the same as parameter value
���� int: begin function: 1
���� "x" times a parameters structure*(5). x depends on the function and is hardcoded.
int: end function (always set to 0)[/COLOR]
As you may see, ECA (event/condition/action) structures may be nested. This is the case with loops or other blocks. However, my issue is that the int: ??? seems to be missing or displaced sometimes.
The definition stated here, which is of version 4, says:
Code:
[COLOR="Magenta"]int: Function type: 0 = Event, 1 = Condition, 2 = Action
String: Function name
int: Enable state: 0 = Function disabled, 1 = Function enabled
"x"times a Parameter Structure. "x"depends of the function and is stored in UI\TriggerData.txt*
int: Number "i" of ECA Function Definition Structures
If this function has no parent or if it is the last of a function structure and all it's parents it's the last) read the following:
If the number "i" of ECA Function Definition Structures is not
0 then read the following:
int: 2 (???)
"i" times an ECA Function Definition Structure (If this trigger doesn't have multiple actions it should be set to 0 so we don't have this section)[/COLOR]
So there, the/an unknown int would be after the amount of ECAs and exists only under special conditions* (that I cannot confirm either).
*(has no parent ECA OR it's the last defined child of the whole hierarchy except its own children) AND has at least 1 child itself
The example code I am currently looking at:
-
For each (Integer A) from 1 to 10, do (Actions)
-
Loop - Actions
- Do nothing
-
Loop - Actions
Code:
02 00 00 00 46 6F 72 4C 6F 6F 70 41 4D 75 6C 74
69 70 6C 65 00 01 00 00 00 03 00 00 00 31 00 00
00 00 00 00 00 00 00 03 00 00 00 31 30 00 00 00
00 00 00 00 00 00 01 00 00 00 02 00 00 00 00 00
00 00 44 6F 4E 6F 74 68 69 6E 67 00 01 00 00 00
00 00 00 00
Code:
02 00 00 00 -> type = action
46 6F 72 4C 6F 6F 70 41 4D 75 6C 74 69 70 6C 65 00 -> funcName = ForLoopAMultiple
01 00 00 00 -> enabled = true
ForLoopAMultiple's 2 params:
param1:
03 00 00 00 -> type = string
31 00 -> value = 1
00 00 00 00 -> begin function = no
00 00 00 00 -> end token
param2:
03 00 00 00 -> type = string
31 30 00 -> value = 10
00 00 00 00 -> begin function = no
00 00 00 00 -> end token
->return to ForLoopAMultiple-ECA
01 00 00 00 -> amount of children = 1
child:
02 00 00 00 -> type = action
[COLOR="Red"]00 00 00 00 -> what is this?[/COLOR]
44 6F 4E 6F 74 68 69 6E 67 00 -> funcName = DoNothing
01 00 00 00 -> enabled = true
00 00 00 00 -> amount of children = 0
There should not be a number between type and funcName of an ECA. Of course I am assuming that 02 00 00 00 is the type here because otherwise it could be only the ??? int and the 00 00 00 00 would represent the DoNothing-ECA as an event, which is tosh.