• 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] Calling function on a different page

Status
Not open for further replies.
Level 4
Joined
Dec 10, 2005
Messages
73
Let's say trig1 wants to call trig2 but they aren't on the same trigger( white page). How can I still call trig2 and pass it some data, ie trig2(string)
 
Level 12
Joined
Mar 16, 2006
Messages
992
You set a variable, run the other trigger, and use the variable in that trigger?

Wow, that was hard to figure out.
 
Level 4
Joined
Dec 10, 2005
Messages
73
I think I didn't make myself clear. I'll try again.

In GUI mode , there are two white page icons representing the two different triggers.I want to know if I can call functions that aren't in that trigger, reuse functions but with difference value parameters.

I figured it out, You have to declare the function before the trigger uses it. ie stick it in the custom script section ( top)
For neatness, Can I make a function on it's own (it's own little white page/ trigger)and have be declare right after the variables?
 

Ham

Ham

Level 5
Joined
Jan 16, 2009
Messages
132
  • Trigger
    • Events
    • Conditions
    • Actions
      • Trigger - Add to Trigger2 <gen> the event
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Basically when compiled, the world editor takes each trigger in linear order by the order they were created, but since most likely you do not check which trigger you created before which other trigger, you can't really know (unless you do know by what order you made them) what function will be on top of the other one.
So, if you don't know the order, just put it in the header and be done with (or use libraries, which do exactly that, as was mentioned above me).

  • Trigger
    • Events
    • Conditions
    • Actions
      • Trigger - Add to Trigger2 <gen> the event

For the reference, if you have no idea what people are talking about, it is most likely not smart to say anything, because it's most likely stupid.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
You can call and pass parameters to any function that is located in the final map script above the current function. WC3 not not support you calling functions located bellow the caller function.

You can however execute functions bellow the current function via a native and then pass them parameters via globals.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
THW said:
Topic name:
JASS:
 Calling function on a different page [/quote]

Youse ExecuteFunc(parameters via globas) or vJass' lybraries or place your function above the functions it is called from(generally in top of the first created trigger(from the ones you want to call it from)) or use vJass' evaluate and execute or just place teh function in the map header.
 
Level 6
Joined
Sep 5, 2007
Messages
264
The linear order of triggers in GUI, is from top to bottom... but, you may need to close the map and re-load it for order changes to take effect. I used this trick when I used to use GUI.

Personally, I'd use vJASS to do what you want, but that's just me. :thumbs_up:
 
Level 4
Joined
Dec 10, 2005
Messages
73
I found out how to use librarys now :p. So much neater vJass.

Used this to help me, (Am I allow to post links to different websites?)
JASS:
http://clanmapz.com/forum/showthread.php?p=1444

These extra features of vJass are quite complicated.
 
Level 6
Joined
Sep 5, 2007
Messages
264
As far as I know, you can post links to wherever you want (so long as it's legal and can be viewed by all ages).
As far vJASS... yeah, it is complicated, but you get the hang of it. I don't know the exact address, but do a search for vexorian's vJASS tutorial, it helped me a fair bit. :thumbs_up:

EDIT: to do a link (replace the "<>" with "[]") use <URL=address>text to put in for link</URL>
EG: this links to this page
Just click the quote button to look at how I did it.
 
Status
Not open for further replies.
Top