1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest.
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Calling function on a different page

Discussion in 'Triggers & Scripts' started by PenKnight, Feb 18, 2009.

  1. PenKnight

    PenKnight

    Joined:
    Dec 10, 2005
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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)
     
  2. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Yes, you can.
     
  3. Vegavak

    Vegavak

    Joined:
    Mar 16, 2006
    Messages:
    1,010
    Resources:
    0
    Resources:
    0
    You set a variable, run the other trigger, and use the variable in that trigger?

    Wow, that was hard to figure out.
     
  4. PenKnight

    PenKnight

    Joined:
    Dec 10, 2005
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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?
     
  5. Ham

    Ham

    Joined:
    Jan 16, 2009
    Messages:
    132
    Resources:
    0
    Resources:
    0
    • Trigger
      • Events
      • Conditions
      • Actions
        • Trigger - Add to Trigger2 <gen> the event
     
  6. Lord_BoNes

    Lord_BoNes

    Joined:
    Sep 5, 2007
    Messages:
    264
    Resources:
    0
    Resources:
    0
    Add the function to the map header... Click the map's name at the top of the trigger list. A "blank" page will be there, this is put into the map before all the other triggers, so a function that is there may be called by any triggers.
     
  7. PenKnight

    PenKnight

    Joined:
    Dec 10, 2005
    Messages:
    73
    Resources:
    0
    Resources:
    0
    Yea, I was wondering if there was a way to not place it in the map header.
     
  8. busterkomo

    busterkomo

    Joined:
    Jun 17, 2007
    Messages:
    1,423
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    Using libraries, but that solution is JASS only. AFAIK, GUI has no way to determine script placement other than the map header.
     
  9. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,843
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2
    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).

    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.
     
  10. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  11. spiwn

    spiwn

    Joined:
    Apr 27, 2008
    Messages:
    1,228
    Resources:
    0
    Resources:
    0
     
  12. PenKnight

    PenKnight

    Joined:
    Dec 10, 2005
    Messages:
    73
    Resources:
    0
    Resources:
    0
    Ok, it there any tuts or post where I could see libraries in action/ how to use them?
     
  13. Lord_BoNes

    Lord_BoNes

    Joined:
    Sep 5, 2007
    Messages:
    264
    Resources:
    0
    Resources:
    0
    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:
     
  14. PenKnight

    PenKnight

    Joined:
    Dec 10, 2005
    Messages:
    73
    Resources:
    0
    Resources:
    0
    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?)
    Code (vJASS):
    http://clanmapz.com/forum/showthread.php?p=1444


    These extra features of vJass are quite complicated.
     
  15. Lord_BoNes

    Lord_BoNes

    Joined:
    Sep 5, 2007
    Messages:
    264
    Resources:
    0
    Resources:
    0
    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.
     
  16. GhostWolf

    GhostWolf

    Joined:
    Jul 29, 2007
    Messages:
    4,843
    Resources:
    2
    Tools:
    1
    Tutorials:
    1
    Resources:
    2