Staredit Network

Staredit Network -> Modding Assistance -> StarEdit's .trg trigger files
Report, edit, etc...Posted by toxik on 2006-06-23 at 05:55:51
Today, I was making a Lurker Defence map and it struck me that I've been making triggers with the wrong condition.
Then it struck me, that perhaps, with a little glimmering chance, I could save these triggers to a file, edit them with a HEX editor, and load them back in.

I failed entirely to understand it's content, it seems to be decorated with a four byte header, qw~6, and then a byte which was 0x18, but changed once, and then back to 0x18.

I tried setting a trigger to Never (x16) -> End game in draw (x64), and I got sixteen 0x17, padded with what I recall to be ten 0x0 bytes. Changing never to always did the same, with the slight change of 0x17 being 0x16.

Having strings in the trigger file got really, really weird. Parts of the string split up and repeat across the file, seemingly random.

So I ask, how is this format defined? The TRIG section of a .chk didn't strike me as resembling this at all.

Any clarification is appreciated!
Note: I'm going to make a scripting language of it, I think.
Report, edit, etc...Posted by Doodle77(MM) on 2006-07-03 at 16:34:02
You can use scmdraft and paste into notepad and then use replace to fix all your triggers.

ADDITION:
There is a program in the DLDB (it's written in perl) that converts .TRG's to text and baxk

lol wrote that in lynx.
Report, edit, etc...Posted by Cole on 2006-07-04 at 11:09:27
I believe that section is somewhat similar to the Trig section but I think it dosn't contain locations for instance.

Heres a better idea; do whatever Doodle said (I suggest scmdraft 2 idea) or extract the CHK hex edit the Trig section directly and then put the CHK back into the mpq.
I would definently suggest Scmdraft 2 idea, load the map up into trigedit, copy the triggers you want to change copy n paste them into notepad find the proper Condition and use the Replace feature. Then copy and paste them back and click the compile button and your done.

I'm guessing trigger files contains Strings, Triggers, and CUWP all into one.
Report, edit, etc...Posted by toxik on 2006-07-26 at 17:48:29
Actually, my Internet went down - and the entire map got unusable when I got back from a vaccation.

Now, because I'm such a geek I wrote my own .CHK editor in VB6 (yes, stab me in the face) to look at what could be wrong on my map. I noticed something rather strange.

My TRIG (the section of a .CHK that holds triggers) were almost 2 megabytes big.
By a little research, I found out that one trigger is 2400 bytes long exactly, remember I had no Internet, so no references - talk about reinventing the wheel - anyway, so I had to learn more about triggers. After some time, I realized that there are 16 conditions, and 64 actions. No matter how many you actually use, they're always there, and then 32 bytes to declare for whom the trigger is ran.

To my surprise, the middle of my TRIG section was flooded with nothing-triggers, that is, all conditions were unused, and all actions unused, and it was ran for nobody.

I exported then exported the TRIG section, wrote another ad-hoc (one-use) application, made it read through an input file and write out a fixed file. I didn't have much hope, but I imported it back in for the heck of it.

And it worked! Slightly smaller, rather, 2 kB.

Oh and, since I got to know the .CHK and TRIG formats so well I easily fixed my error with another ad-hoc application.

It has learned me a lot really, I now understand how ISOM works, and the TILE section. I actually did some really strange things!
Pictures of strange outcomes

If you'd like to have my editor - which isn't all that bad really - for whatever reason, just give me a mail or something.

Thanks for you attention though!
Next Page (1)