| 06-24-2004, 07:07 PM | #1 |
Why does'nt the polled wait function work in the loop ? It works perfectly without it. :\ Code:
function Recovery takes nothing returns boolean
if ( not ( IsUnitLoadedBJ(udg_P1Units[GetForLoopIndexA()]) == true ) ) then
return false
endif
if ( not ( udg_P1Sleep[GetForLoopIndexA()] < 100 ) ) then
return false
endif
return true
endfunction
function Trig_P1_Recover_On_Copy_2_Func001Func001C takes nothing returns boolean
if ( not ( udg_P1Units[GetForLoopIndexA()] == GetLoadedUnitBJ() ) ) then
return false
endif
return true
endfunction
function Korv takes nothing returns nothing
[color=Red] local integer x = 0
loop
exitwhen x > 500
if Recovery() then
set udg_P1Sleep[GetForLoopIndexA()] = ( udg_P1Sleep[GetForLoopIndexA()] + 3 )[/color]
[color=DarkRed]call PolledWait( 1.00 )[/color]
[color=Red] set x = x + 1
else
set x = 500
endif[/color]
endloop
endfunction
function Trig_P1_Recover_On_Copy_2_Actions takes nothing returns nothing
set bj_forLoopAIndex = 0
set bj_forLoopAIndexEnd = udg_P1IntAllUnits
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( Trig_P1_Recover_On_Copy_2_Func001Func001C() ) then
call Korv()
else
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction |
| 06-24-2004, 10:56 PM | #2 |
bj_forLoopAIndex is a global variable and GetForLoopIndexA() just returns its value, in other words, the value of the global variable might be change during waits by another trigger |
| 06-25-2004, 11:17 AM | #3 | |
Quote:
ahh.. OK, But what if I use a local variable and handles, would that work ? I've come around the problem without using a loop, but I'm just wondering. thx. |
| 06-25-2004, 12:47 PM | #4 |
yep, but you don't really need all those functions, you first need to have everything in the same function |
