• 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] Super Syntax errors

Status
Not open for further replies.
Level 12
Joined
Dec 10, 2008
Messages
850
Ok, so I've been working on my scipt for a map, and its been stable for the last 4 weeks, not gettign any syntax errors or anything every time I check it. But just now, its freaked on just about every line, saying that I have undeclared variables and missing endloops and such. If somebody could find the problem that would do all this, please re-post the fixed version. Thanks
JASS:
function Trig_Artillery_Actions takes nothing returns nothing
    local location ArtilleryPoint = GetSpellTargetLoc()
    local unit ArtilleryCaster = GetSpellAbilityUnit ()
    local rect ArtilleryRegion = RectFromCenterSizeBJ(ArtilleryPoint, 1000.00, 1000.00)
    local group ArtilleryGroup = GetUnitsInRectAll(ArtilleryRegion)
    local integer ArtilleryLoop1 = 1
    local integer ArtilleryLoop2 = 1
    local location ArtilleryLocU
    local unit ArtilleryUnit
    local unit ArtilleryUnit2
    local timer ArtilleryTimer = CreateTimer()
    call GroupRemoveUnit( ArtilleryGroup, ArtilleryCaster ) 
    loop
        exitwhen ArtilleryLoop1 > 15
        loop
            exitwhen ArtilleryLoop2 > 15 
            set ArtilleryLocU = GetRandomLocInRect(ArtilleryRegion)
            set ArtilleryUnit = CreateUnitAtLoc(GetTriggerPlayer(), 'h00B', ArtilleryLocU, bj_UNIT_FACING)
            set ArtilleryUnit2 = CreateUnitAtLoc(GetOwningPlayer(ArtilleryCaster), 'h00F', ArtilleryLocU, bj_UNIT_FACING )
            call SetUnitTimeScale( ArtilleryUnit, 25.00 )
            call SetUnitScalePercent( ArtilleryUnit, 500.00, 500.00, 1000.00 )
            call SetUnitAnimation( ArtilleryUnit, "birth" )
            call SetUnitAnimation( ArtilleryUnit2, "birth" )
            call UnitApplyTimedLife( ArtilleryUnit, 'BTLF', 0.50 )
            call UnitApplyTimedLife(ArtilleryUnit2,'BTLF',0.50)
            call UnitDamagePointLoc( ArtilleryCaster, 0, 500, ArtilleryLocU, 5.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
            call RemoveLocation (ArtilleryLocU)
            call UnitDamagePointLoc( ArtilleryCaster, 0, 1000.00, GetRectCenter(ArtilleryRegion),10.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
            call TimerStart(ArtilleryTimer,0.30,false,function Trig_Artillery_Actions)
            set ArtilleryLoop2 = ArtilleryLoop2 + 1
            endloop
        endloop 
        call TriggerSleepAction (0.30)       
        set ArtilleryLoop1 = ArtilleryLoop1 + 1
    endloop
    call RemoveRect (ArtilleryRegion)
    call RemoveLocation (ArtilleryPoint)
    call DestroyGroup (ArtilleryGroup)
    set ArtilleryCaster = null
    set ArtilleryUnit = null
    set ArtilleryUnit2 = null
endfunction

function Trig_Cluster_Actions takes nothing returns nothing
    local unit ClusterCast = GetSpellAbilityUnit()
    local location ClusterCastLoc = GetUnitLoc(ClusterCast)
    local location ClusterTarg = GetSpellTargetLoc()
    local rect ClusterRegion = RectFromCenterSizeBJ(ClusterTarg, 750.00, 750.00)  
    local integer ClusterLoop = 1
    local unit ClusterUnit
    local location ClusterLoc
    loop
        exitwhen ClusterLoop > 90
        call CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetTriggerUnit()), ClusterCastLoc, bj_UNIT_FACING )
        set ClusterUnit = GetLastCreatedUnit()
        set ClusterLoc = GetRandomLocInRect(ClusterRegion)
        call IssuePointOrderLoc( ClusterUnit, "clusterrockets", ClusterLoc )
        call UnitApplyTimedLifeBJ( 3.00, 'BTLF', ClusterUnit )
        call RemoveLocation (ClusterLoc)
        set ClusterLoop = ClusterLoop + 1
    endloop
    call RemoveRect (ClusterRegion)
    call RemoveLocation (ClusterCastLoc)
    call RemoveLocation (ClusterTarg)
endfunction
(Its really 2 functions, but they both get the same errors)

Edit: Ok, I took out one of the loops, and this happend, Why?
 
Level 3
Joined
Aug 20, 2008
Messages
54
Are you using NewGen? Do you see all the ones in red writing? Those are BJs, use GUI if youre going to use BJs, its the same thing.

You have an extra endloop.
JASS:
endloop
endloop
        call TriggerSleepAction (0.30)
        set ArtilleryLoop1 = ArtilleryLoop1 + 1
    endloop
You also have tons of leaking. The code is so sloppy I can barely read it :(
 
Status
Not open for further replies.
Top