• 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] Local variable creation errors

Status
Not open for further replies.
Level 3
Joined
Jan 4, 2010
Messages
14
I'm puzzled about creating local variables. These 2 lines are what is causing the following 2 errors. It seems alright to me, I even searched google and sites like this and this is how people do it.

I just want to get a local variable so I can do stuffs with the floating text without it being a global variable.

Expected 'endif'
Code:
local texttag LastTextTag = CreateTextTag()

Expected a variable name
Code:
set LastTextTag = GetLastCreatedTextTag()

Full function
Code:
function Trig_Show_Gold_Gained_or_Lost_Copy_Actions takes nothing returns nothing
    if ( Trig_Show_Gold_Gained_or_Lost_Copy_Func001C() ) then
        call CreateTextTagLocBJ( ( "+" + I2S(udg_tempInt) ), udg_tempPoint, 0, 10, 100, 100, 0.00, 0 )
    else
        if ( Trig_Show_Gold_Gained_or_Lost_Copy_Func001Func001C() ) then
            call CreateTextTagLocBJ( ( "+" + I2S(udg_tempInt) ), udg_tempPoint, 0, 10, 0.00, 100, 0.00, 0 )
        else
            if ( Trig_Show_Gold_Gained_or_Lost_Copy_Func001Func001Func001C() ) then
                call CreateTextTagLocBJ( ( "-" + I2S(udg_tempInt) ), udg_tempPoint, 0, 10, 100, 0.00, 0.00, 0 )
            else
            endif
        endif
    endif

    local texttag LastTextTag = CreateTextTag()
    set LastTextTag = GetLastCreatedTextTag()
endfunction
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
the 2nd line is unnessecary because CreateTextTag() will return the text tag and set it to the variable, no need to re-set -it to that text tag u just made
 
Status
Not open for further replies.
Top