HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do you change the order of functions?

02-22-2006, 07:48 AM#1
Moss
I noticed in Bomber Command there are many custom text function at the top of each category with functions for that category. I tried doing the same but for some reason my custom text function comes after the trigger that calls it at compile time. I thought that the order you have the triggers in the trigger editor = the order they get compiled in.
02-22-2006, 12:34 PM#2
Vexorian
It would have been so full of sense and so useful if it was that way but it isn't

The order of the triggers in the list is meaningless (boo blizzard) the editor only considers the order of creation of the triggers.
02-22-2006, 04:24 PM#3
The__Prophet
Well, in my experiences, thats not entirly true. For instance, I could have 2 triggers. The first one has a function that is used in both that trigger, and the 2nd trigger. I try saving it, it works fine. Then I move the 2nd trigger so its ahead of the 1st trigger, save it, and it seems to work fine (again). Then close the world editor, and open the world editor and your map again. Save it, and it gives a compile error.

My guess, is that it depends on the order of the triggers when the world editor loads it up.
02-22-2006, 08:08 PM#4
Moss
So how did the creator of Bomber Command do it? I guess I could make a new trigger and copy the stuff out the old one that calls the function and the new trigger would then come after the function. But then I will also have to fix all the other triggers that point to the orginal and make them point to the new one. And is this going to randomly fail on me sometimes or should the functions stay in that order as long as I don't delete them or move them?
02-23-2006, 01:00 AM#5
Sardrixx
disable the one
and in the next enable the first
and if you wish to reuse (*)
disable the next on the next, then enable it with the one

I.E.

trigger one (disabled on map startup)
Events:
Blah Blah
Conditions:
Blah Blah
Actions:
Blah Blah
*enable trigger two
*disable trigger one

Trigger two (enabled on map startup)
Events:
blah blah
Conditions:
blah blah
Actions:
blah blah
Enable trigger one
*disable trigger two
02-23-2006, 01:13 AM#6
Vexorian
Quote:
Originally Posted by The__Prophet
Well, in my experiences, thats not entirly true. For instance, I could have 2 triggers. The first one has a function that is used in both that trigger, and the 2nd trigger. I try saving it, it works fine. Then I move the 2nd trigger so its ahead of the 1st trigger, save it, and it seems to work fine (again). Then close the world editor, and open the world editor and your map again. Save it, and it gives a compile error.

My guess, is that it depends on the order of the triggers when the world editor loads it up.
And how does that exactly contradict what I've said?.

Sardrix: your post doesn't seem to make any sense. At least it does not answer the question.

Well moss what I do is to find out a trigger that compiles before the other triggers by reading the map's script (after exporting it using WE)

Once I know of a trigger that compiles first I copy and paste it, rename the first one to something like "functions" and rename the copy to the previous name of the trigger. Convert the original trigger to custom text (if necessary) and then just add the functions there.
Something I noted is that there is a chance that the order changes, but I am not sure how to make it change or how to figure out some operation will change the order.

In my opinion the editor should save the triggers in the same order as they appear in the world editor. It is a shame it doesn't. blizz could have also just made a prototyping feature for jass or something
02-23-2006, 02:33 AM#7
The__Prophet
Quote:
Originally Posted by Vexorian
And how does that exactly contradict what I've said?.

You stated that the order of the creation of the triggers is the deciding factor, yet I stated that its not the order of creation of the triggers, but the order of the triggers when the world editor loads the map.
02-23-2006, 02:41 AM#8
Vexorian
didn't see the part of the compile error.

But I do not think it is true either.

There are a lot of random things going there I am going to do some tests
02-23-2006, 02:50 AM#9
Vexorian
Yep it is the order of the triggers when it loads the map.

So you can just re order the triggers, save, close and load again.

There is a problem when using triggers to hold functions and it is that when you enable a JASS trigger world editor checks for errors in the trigger, the problem is that it only compiles globals, custom script section and that trigger (to save time probably) , it ignores any other trigger so if it is calling a function from another trigger it will be impossible for you enable that trigger until you comment out every attempt to call a function in another trigger or until you copy the functions from the other trigger to the custom section
02-23-2006, 02:56 AM#10
Moss
Thanks, Vex, good to know. I was going to test that save/close/reopen hypothesis myself but I have been abstaining from the WE today so I can get other stuff done.