| 02-17-2007, 04:59 AM | #1 |
I'm fairly new to JASS, and have run into something that baffles me. How can functions contained in a trigger be called on-the-fly by other triggers? I thought things like that had to be in the Map Script. For example, Vile's Knockback System's functions are all contained in a trigger labled "Knockback Functions", yet the functions in that trigger can be called by other triggers, as is demonstrated in the test map. I checked the Map Script section, and the only thing in there are the CScache functions. I then tried moving the functions in the "Knockback Functions" trigger into the map script and disabling the "Knockback Functions" trigger, yet I got compile errors. I would like too understand how this works. |
| 02-17-2007, 05:06 AM | #2 | |
Quote:
If you create trigger A before trigger B, then trigger A appears in the map's script file before trigger B. This also means trigger B can call any of the functions from trigger A, since they're defined. You should look at a map's .j file for more details. That's the map script file I refer to. |
| 02-17-2007, 05:21 AM | #3 |
Oh. That makes sense. What I don't understand then, is why the map wouldn't compile if I put the functions in the Map Script part. Surely that's got to be compiled first in the map script... As for accessing a map's .j file, do I just open it with a MPQ editor or something? How do I access it? Off Topic: I like your new Avatar; it's rather (for lack of a better word) nice-looking. |
| 02-17-2007, 05:53 AM | #4 | |
Quote:
It even says so in the section's header. Make sure your functions are spelled correctly and are properly implemented. If not, they of course won't work. And thanks. :P The tides of change called for a new avatar. |
| 02-17-2007, 08:32 AM | #5 |
This is a case where preprocessors come in handy. Many of the current ones allow you to define sections (libraries/etc) which will automatically be moved to the top of the script, meaning you don't have to have a 2000 line custom script section any more. |
