Takes Nothing Returnes NOthing

M

MoonRazer

Guest
I am doing a tuturial on JASS and i can't figure out what this means.
Code:
function sleep [I][U][B]takes nothing returns nothing[/B][/U][/I]
call entangle
endfunction
Any help here?

EDIT: Never mind lol i got it now
 

corvusHaunt

New Member
Reaction score
96
That's where you can use a variable from another trigger in that trigger, or send back a variable to the trigger that called it. For example:

Code:
function Message takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,[COLOR=Red]"Look, a message!"[/COLOR])
endfunction

The red is the string. This is the message that will be displayed. Now, here we will use another function to define our string.


Code:
function GetMyMessage takes nothing returns string
    return "Look, a message!"
endfunction

function Message takes nothing returns nothing
    call DisplayTextToPlayer(Player(0),0,0,[COLOR=Red]GetMyMessage()[/COLOR])
endfunction

The red here calls "GetMyMessage", and GetMyMessage returns the string.


Now, here is the reverse.

Code:
function DisplayMyMessage takes string msg returns nothing
    call DisplayTextToPlayer(Player(0),0,0,msg)
endfunction

function Message takes nothing returns nothing
    call DisplayMyMessage("Look, a message!")
endfunction


All three sets will work, and display the same message. You can use this with every variable type, not just strings, and you can "take" multiple variables.

Hope that clears things up :)

EDIT: Oh. I kinda stopped in the middle of my reply to do something else, which is why it took me so long. Glad you found it out!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top