• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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