HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

WTG File Format Questions

10-11-2002, 12:54 AM#1
CBWhiz
Hi, looking at Zepir's file format descriptions and my own WTGs (from 1.03) I see some things that may be different.

I do not have much time to find out exactly whats what, so i'd appreciate it if someone posted an updated spec.

Here is whats in the toutorials:

CHAR = 1 byte
LONG = 4 byte little endian
STRING = many byte null terminated

Code:
War3map.wtg: The triggers definition file

Header:
CHAR[4]: file ID (WTG!)
LONG: wtg file format version = 4 
LONG: number "a" of triggers categories 
"a" times a category definition structure*
LONG: number "b" ???
LONG: number "c" of variables
"c" times a variable definition structure**
LONG: number "d" of triggers
"d" times a trigger definition structure***

*Category Definition Structure:
LONG: category index
STRING: category name

**Variable Definition Structure:
STRING: variable name
STRING: variable type
LONG: number "e" ???
LONG: array status: 0=not an array, 1=array
LONG: initialisation status: 0=not initialized, 1=initialized
STRING: initial value (STRING)

***Triggers Definiton Structure:
STRING: trigger name
STRING: trigger description
LONG: enable state: 0=disabled, 1=enabled
LONG: custom text trigger state: 0=not a custom text trigger, 1=custom text trigger (use data in the WCT)
LONG: initial state: 0=initially on, 1=not initially on
LONG: ???
LONG: index of the category the trigger beLONG:s to
LONG: number "i" of event-condition-action (ECA) function
"i" times an ECA function definition structure*(4) (if it's a custom text trigger i should be 0 so we don't have 

this section)

*(4)ECA function definition structure
LONG: function type: 0=event, 1=condition, 2=action
STRING: function name
LONG: enable state: 0=function disabled, 1=function enabled
"x" times a parameter structure*(5). x depends of the function and is hardcoded.

*(5)Parameters Structure:
LONG: 0=preset, 1=variable, 2=function
STRING: parameter value
LONG: ???
LONG: ???
10-11-2002, 12:16 PM#2
zepir
What did you notice was different?
Could you "bold" or change the colors of the parts that don't match your file and eventually the hex dump of the file (parts of it).
10-11-2002, 07:51 PM#3
CBWhiz
Well I dont really want to give these triggers away :D so i'll make a test map now, like I should have done to begin with. In paticular, i *think* the number of catagories / trig / var goes up top, before them all, but i'll re-check in a second.

[
EDIT
NM, must have been an oddity. Test map shows no diff.

"long b" does NOT change between same exact saves, thats all i figured out so far.
]

BTW, have you figured out what any unknows are yet?
10-11-2002, 08:10 PM#4
CBWhiz
Just need some clarification:

Code:
LONG: number "i" of event-condition-action (ECA) function
"i" times an ECA function definition structure*(4) (if it's a custom text trigger i should be 0 so we don't have 

this section)

*(4)ECA function definition structure
LONG: function type: 0=event, 1=condition, 2=action
STRING: function name
LONG: enable state: 0=function disabled, 1=function enabled
"x" times a parameter structure*(5). x depends of the function and is hardcoded.

*(5)Parameters Structure:
LONG: 0=preset, 1=variable, 2=function
STRING: parameter value
LONG: ???
LONG: ???

Does this mean, starting from the top, it goes like this:
LONG (num eca) LONG (eca type) STR (name) LONG (enabled)

LONG (ps, var, func) STRING (param val) LONG LONG

And does the paramater struct always get repeated 5x, or does it depend on the command?

As you may guess I'm making a WTG editor.
10-12-2002, 01:35 PM#5
zepir
A WTG editor (generator from the jass? :) ) would be greate!
Don't forget you'll also have to handle the WCT, W3S, W3R and W3C because all these files are linked together and are used by the WE to generate the Jass.

I'll try to clarify the thing I know about the WTG but it's gonna take some time. I hope I wont forget that too because I got many things to do... What I plan to do is to use a sample WTG using all the kinds of fields and show how to "decrypt" it.
10-14-2002, 12:12 AM#6
CBWhiz
Hehe - a wtg generator from JASS was my origonal intent - but If I said it i thought it'd make me out as a map stealer :D

I know about the other files i'd have to edit, but a pure WTG edit only comes first.

It sounds like I may actually need a data file containing how many paramaters there are for each possible function - which I want to try to work around - is thre anythign that suggests this is indicated in the wtg?

My work on the editor has paused - i'm enjoying my weekend for once since i have mon off school :D

I will resume work sometime next week.

BTW: about jass > wtg ; it looks easy since we conviently marks all the actions / events with TriggerNAME_0001() - but first i need an editor that CAN edit the WTG :D

Since im using my same file interpreter left over from my Starcraft CHK viewer, all I need to do is write a class module that organizes the WTG into variables and exports them from it. The problem, however, is the multi level arrays, which I'll have to think hard about how to implement :D
10-14-2002, 05:37 PM#7
zepir
If I had to reverse a Jass into something editable with the WE, I would create a WTG with only custom triggers, that would be pretty easy to do (easier then a pure WTG with an empty WCT).
By the way, why would you need to make a WTG editor or even a jass --> WTG+... converter?
The only use I see is unprotecting maps.

It would be better to design a new trigger editor with a different structure than WTG+WCT+... that would give users a better control on the outputed jass. Something that would allow users to import and export triggers from a map to another without needing to look at regions and sounds and other stuff. Something that would support "prefabs" triggers.
And THAT would be a good thing, especially if it could work as a plugin for my map editor... :p (plugin support is not implemented yet but will be one day...)
10-14-2002, 06:36 PM#8
CBWhiz
Well once I build the WTG editor I'm sure it could be used for a multitude of reasons. I supose I could encompasse it as some sort of a plugin system (a dll would be hard to do - its in VB).

And I was thinking of having it act as a better trigger editor, but that lies far down the road.
10-18-2002, 06:22 PM#9
ShadowFlare
What version of VB do you have?
10-21-2002, 03:26 AM#10
CBWhiz
I have VB 5 (Pro), and from my experiances the DLL it creates needs the object interface (forgewt the name of it) but cannot use standard exported functions / Declare statements.

I've heard of the mod for VB 6 which lets you do just this, but its not availible for VB 5 :(
10-21-2002, 03:13 PM#11
ShadowFlare
You could use LoadLibrary and GetProcAddress to load the dll and get an address to the function, but you would need some way of calling the functions after that. It would be possible to make a dll written in C++ to help with that. Maybe I could try coding one for you.
10-22-2002, 05:21 AM#12
BlacKDicK
Take a look here: http://lockfree.50megs.com/linker.html
and here: http://www.fawcette.com/Archives/pre...200/mc0200.asp
10-25-2002, 09:35 PM#13
CBWhiz
I just 'aquired' VB 6 enterprise... but now I cant rmrmber the linker that let me put assembly / exp fn right in the file :(

If someone could point me to that website (VBAdvance?) then it'd be much appreciated.

I'm still working on decrypting the WTG format (functions within functions), and only the GUI code is done right now.