• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Sharing functions across multiple custom text triggers

Status
Not open for further replies.
Level 3
Joined
Aug 31, 2004
Messages
4
I'm trying to call shared utility functions from multiple custom text triggers. I did this successfully when I just added the functions to the war3map.j file, but now I'm trying to implement the same features in a worldeditor compatible form by breaking up the code into custom text triggers.

Worldeditor complains whenever I reference any function (other than natives) that does not appear in the same custom text trigger. I am defining the utility functions in custom text triggers which appear before the triggers which reference them, so this is not a forward reference problem.

This is for a ROC map. TFT maps allow for a single common custom text section, I'm guessing that is where utility functions are expected to be put.

Am I just out of luck on sharing utility functions in an ROC map?

Thanks.
 
Level 2
Joined
Apr 13, 2004
Messages
29
Triggers that appear before other triggers in the editor are not necessarily placed before them in the created script (especially new triggers). Also when you activate a trigger WE checks it separately from the rest so an error is given then. So avoid that. If you need to reactivate it temporarily place dummy functions for the missing functions in that trigger and then remove them again before saving. While saving he only checks the entire script together so if you properly placed the utility functions in triggers that land further up than their uses it should work.
Another possibility is to use ExecuteFunc. As it uses a string as parameter that is only resolved on runtime, you can call functions that are further down in the script that way. Parameter passing has to be done over globals then though.
 
Status
Not open for further replies.
Top