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 havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. 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 functions

Discussion in 'Triggers & Scripts' started by The_Guy, Feb 25, 2006.

  1. The_Guy

    The_Guy

    Joined:
    Sep 15, 2005
    Messages:
    42
    Resources:
    4
    Maps:
    4
    Resources:
    4
    how come when i do this in a trigger

    Custom Script: call InitMultiboards()

    i get an error that says "Expected a function name"
     
  2. Lord Raszul

    Lord Raszul

    Joined:
    Feb 18, 2005
    Messages:
    263
    Resources:
    1
    Maps:
    1
    Resources:
    1
    most likley you do not have a function calle InitMultiboards, or if you have one, it does not stand above the part, where you call it.

    -> in jass a function can only call functiones that have been defined before the function that wants to call.
     
  3. SnaKy

    SnaKy

    Joined:
    Jul 15, 2004
    Messages:
    333
    Resources:
    8
    Models:
    2
    Icons:
    1
    Maps:
    5
    Resources:
    8
    Or -> Custom Script: call ExecuteFunc("InitMultiboards")
    then it doesn't matter if it's above or not.
     
  4. The_Guy

    The_Guy

    Joined:
    Sep 15, 2005
    Messages:
    42
    Resources:
    4
    Maps:
    4
    Resources:
    4
    what do you mean?
     
  5. Lord Raszul

    Lord Raszul

    Joined:
    Feb 18, 2005
    Messages:
    263
    Resources:
    1
    Maps:
    1
    Resources:
    1
    if you have some custom code like this
    Code (Text):

    function foo takes unit returns nothing
       call kill(unit)
    endfunction

    function bar takes nothing returns nothing
       call foo(GetTriggerUnit())
    endfunction
     
    everything will work proberly
    but if you would have writen it like this:
    Code (Text):

    function bar takes nothing returns nothing
       call foo(GetTriggerUnit())
    endfunction

    function foo takes unit returns nothing
       call kill(unit)
    endfunction
     
    it woul give an error like "function name excpected" or something like that.
    That is, becouse the function bar() does not 'know' the function foo(). A function knows only functions that have been created above itself.

    therefore if you create two triggers in GUI, the one below does know the one above, but not vice versa (the editor fixes this if you use the GUI-Version of calling triggers)