HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Loop crashes.

06-28-2004, 03:33 PM#1
Mjukland
Here's the deal, udg_IntTiles = 2704

When using forloopAindex in the loop, it crashes at loop number 1768, Having an local integer, x makes the loop crash at 1850- something. ( the second loop does'nt run at all, the triggers is aborted or somethin when the loop reaches that number. Having it loop only to 1768 and it works, ( the second loop aswell ).

Ok, why does the loop crash and how to get around it?

( same thing when having many array variables that r looped through at map iniziation, like bool arrays that are all set to false at iniziation for example. Im realy in need of many 1500+ arrays of all types and this is a HUGE problem. )

Code:
function Trig_Create_Regions_and_Specials_Copy_2_Func004Func005C takes nothing returns boolean
    if ( not ( udg_IntCheckLastOne == 52 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Create_Regions_and_Specials_Copy_2_Actions takes nothing returns nothing
    
    local integer x = 1

    set udg_RegionWorld[0] = gg_rct_RegionStart
    set udg_OwnerOfRegion[0] = Player(8)

    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = udg_IntTiles
    loop
        exitwhen x > udg_IntTiles
        set udg_RegionWorld[x] = RectFromCenterSizeBJ(OffsetLocation(GetRectCenter(gg_rct_RegionStart), udg_RealOffsetRegion1, udg_RealOffsetRegion2), 120.00, 120.00)
        set udg_OwnerOfRegion[x] = Player(8)
        set udg_RealOffsetRegion1 = ( udg_RealOffsetRegion1 + 128.00 )
        set udg_IntCheckLastOne = ( udg_IntCheckLastOne + 1 )
        if ( Trig_Create_Regions_and_Specials_Copy_2_Func004Func005C() ) then
            set udg_RealOffsetRegion1 = 0.00
            set udg_RealOffsetRegion2 = ( udg_RealOffsetRegion2 - 128.00 )
            set udg_IntCheckLastOne = 0
        else
            call DoNothing(  )
        endif
        set x = x + 1
    endloop
    call TriggerSleepAction( 0.05 )
    set x = 1
    loop
        exitwhen x > udg_IntTiles
        call AddSpecialEffectLocBJ( GetRectCenter(udg_RegionWorld[x]), "Units\\Special\\Playerneutral.mdx" )
        set udg_SpecialOwnerGround[x] = GetLastCreatedEffectBJ()
        set x = x + 1
    endloop
endfunction
06-29-2004, 09:30 AM#2
PitzerMike
Looks like you are reaching the max execution time of the trigger and it gets aborted.
You should first loop until 1800, then start a new thread (using ExecuteSeparate from the JASS-vault) to do the rest of the loop.
06-29-2004, 10:15 AM#3
Mjukland
Quote:
Originally Posted by PitzerMike
Looks like you are reaching the max execution time of the trigger and it gets aborted.
You should first loop until 1800, then start a new thread (using ExecuteSeparate from the JASS-vault) to do the rest of the loop.

Ok, I came around it by making,
Code:
if ( x == 1500 )
call pollewait(0.01 sec)


Ill test that function though.
thanx.
06-29-2004, 01:47 PM#4
AIAndy
You don't really need a polled wait there. A standard wait is enough.
07-02-2004, 08:17 PM#5
Starcraftfreak
This should do the job:
Code:
call TriggerSleepAction(0.01)