• 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] JASS: Easy Question

Status
Not open for further replies.
Level 2
Joined
Sep 8, 2008
Messages
15
I'm trying to understand locals.

Pseudocode:

--Run on Map Initialization--
Create Global String
Create Local String and Set Global String to it
Display Local String

But now I've run into another problem.. it won't even display the WTF? text I manually put in. I called remove, but it still wont work. What am I doing wrong here? ::explodes::





JASS:
function Message takes string test , real wait returns nothing

    call TriggerSleepAction(wait)
    call DisplayTextToForce( GetPlayersAll(), test )
    call DisplayTextToForce( GetPlayersAll(), "WTF?" )

endfunction

//===========================================================================

function InitTrig_start takes nothing returns nothing

       set gg_trg_start = CreateTrigger(  )
    set udg_string = ("Am I getting this???")
    call Message (udg_string, 1.00)    
    
endfunction

Furthermore, I tried this:

JASS:
function Message takes string test , real wait returns nothing

    call TriggerSleepAction(wait)
    call DisplayTextToForce( GetPlayersAll(), test )
    call DisplayTextToForce( GetPlayersAll(), "WTF?" )

endfunction

//===========================================================================

function InitTrig_start takes nothing returns nothing

       set gg_trg_start = CreateTrigger(  )
    set udg_string = ("Am I getting this???")    
    call TriggerAddAction (gg_trg_start, function Message)
endfunction
This created a fatal error.

I've programmed games in VB, so this is really driving me insane. Please help.


So I know now that the second example crashes because I don't give it the values it's looking for in the remove function (string, wait).

JASS:
TriggerAddAction(gg_trg_start, function Message ("Musu",'1'))
Doesn't Work]




----------------------------
 
Last edited:
Level 16
Joined
Feb 22, 2006
Messages
960
hm, oO looks crazy^^ try this

JASS:
function Message takes string text,real wait returns nothing
     call TriggerSleepAction(wait)
     call DisplayTextToForce( GetPlayersAll(), test )
     call DisplayTextToForce( GetPlayersAll(), "WTF?")
endfunction

put this in the "head" of the trigger editor, now create a new trigger whit a event, what u want
  • Events
    • Player Event ....
  • Conditions
  • Actions
    • set string = (your message)
    • Custom script - call Message(udg_string,1.00)
if u want to do it in one trig then maybe so (locals included, which u want to learn)
JASS:
function Message takes nothing returns nothing
  local string text = udg_string
     call TriggerSleepAction(1.00)
     call DisplayTextToForce( GetPlayersAll(), text )
     call DisplayTextToForce( GetPlayersAll(), "WTF?")
endfunction

function InitTrig_start takes nothing returns nothing
  local trigger thistrig = CreateTrigger()
     //is triggered if Player1 presses ESC
     call TriggerRegisterPlayerEvent(thistrig,Player(0),EVENT_PLAYER_END_CINEMATIC)
     call TriggerAddAction(thistrig,function Message)
  set thistrig = null
endfunction

So all in all there are also good Tutorials in the Tutorialsection
 
Level 2
Joined
Sep 8, 2008
Messages
15

hm, oO looks crazy^^ try this

JASS:
function Message takes string text,real wait returns nothing
     call TriggerSleepAction(wait)
     call DisplayTextToForce( GetPlayersAll(), test )
     call DisplayTextToForce( GetPlayersAll(), "WTF?")
endfunction

put this in the "head" of the trigger editor, now create a new trigger whit a event, what u want
  • Events
    • Player Event ....
  • Conditions
  • Actions
    • set string = (your message)
    • Custom script - call Message(udg_string,1.00)
if u want to do it in one trig then maybe so (locals included, which u want to learn)
JASS:
function Message takes nothing returns nothing
  local string text = udg_string
     call TriggerSleepAction(1.00)
     call DisplayTextToForce( GetPlayersAll(), text )
     call DisplayTextToForce( GetPlayersAll(), "WTF?")
endfunction

function InitTrig_start takes nothing returns nothing
  local trigger thistrig = CreateTrigger()
     //is triggered if Player1 presses ESC
     call TriggerRegisterPlayerEvent(thistrig,Player(0),EVENT_PLAYER_END_CINEMATIC)
     call TriggerAddAction(thistrig,function Message)
  set thistrig = null
endfunction

So all in all there are also good Tutorials in the Tutorialsection



Thank you... I've been cursing up a storm trying to figure out how to understand how these things work. I've got to say you've come through for me. (There was a typo on the text/test, but I caught it. )


I've been looking through the tutorials, I've read them, and I don't want to bash them because I've also read they've helped other people. The biggest flaw for me is that they hardly show actual examples with walk-throughs (when it came to locals).


I can't begin to say how much you've helped me, I wish I could be like "Ahh.. my son, take this item on your quest." But all I can give you is a thank you.. and 6 gold pieces. No, just a thank you.

And just out of chance you wouldn't by chance be taking pupils would you? I'm very determined and have a great capacity for work. :)
 
Level 2
Joined
Sep 8, 2008
Messages
15
Ahh... Alright. Well, maybe in time we can help each other out. I'll be learning JASS until SC2 comes out, which case my plans are to make a decent map, then jump head first into C++ and the like (Doing online ArtSchool) and hopefully I wont drown. Goodluck to you sir! Also I compose music on the side so if you need anything, be it sounds or musical pieces I'm quite resourceful. Thanks again for your help.
 
Status
Not open for further replies.
Top