• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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