HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Getting a wierd syntax error.

09-04-2008, 04:01 PM#1
Gwypaas
I tried making a script that changes the units color, but I'm getting a wierd syntax error.

The syntax error is "Unclosed Arguemt" appearing inside the elseifs and ifs..

Collapse JASS:
scope GwypaasUnit
//! runtextmacro HSAS_Static("Gwypaas, private)
private struct GwypaasData
    real red   = 0
    real green = 0
    real blue  = 0

    unit whichUnit
    integer currentcolor = 0 // If 0 red, 1 green, 2 blue
    boolean increase = true
endstruct
private function GwypaasTimerCallback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local GwypaasData GD = GetAttachedStructGwypaas(t)


        if increase == true then
            if GD.currentcolor == 0 then
                set GD.red = GD.red + 0.01
                if GD.red >= 1 then
                    set GD.currentcolor = 1
                endif
            elseif GD.currentcolor == 1 then
                set GD.green = GD.green + 0.01
                if GD.green >= 1 then
                    set GD.currentcolor = 2
                endif
            elseif GD.currentcolor == 2 then
                set GD.blue = GD.blue + 0.01
                if GD.blue >= 1 then
                    set GD.currentcolor = 3
                endif
            else
                set increase == false
                set GD.currentcolr = 0
            endif
        else
            if GD.currentcolor == 0 then
                set GD.red = GD.red - 0.01
                if GD.red >= 1 then
                    set GD.currentcolor = 1
                endif
            elseif GD.currentcolor == 1 then
                set GD.green = GD.green - 0.01
                if GD.green >= 1 then
                    set GD.currentcolor = 2
                endif
            elseif GD.currentcolor == 2 then
                set GD.blue = GD.blue - 0.01
                if GD.blue >= 1 then
                    set GD.currentcolor = 3
                endif
            else
                set increase == true
            endif
        endif
        call SetUnitVertexColor(GD.whichUnit, GD.red, GD.green, GD.blue , 0)
endfunction

function InitGwypaasUnit takes unit u returns nothing
    local timer t = CreateTimer()
    local GwypaasData GD = GwypaasData.create()
    set GD.whichUnit = u
    call AttachStructGwypaas(t, GD)
    call TimerStart(t, 0.02, true, function GwypaasTimerCallback)
endfunction

endscope
09-04-2008, 04:27 PM#2
Alexander244
The unclosed argument is because your're missing some quotes in the textmacro:
Collapse JASS:
//! runtextmacro HSAS_Static("Gwypaas", "private")
09-04-2008, 04:31 PM#3
Gwypaas
Argh.. I typed it too fast :P

Thanks, atleast I doesn't get that error now :P

Can't rep you.. gotta spread some rep first :(