| 01-25-2008, 12:44 PM | #1 |
When using loops, how can you reach an op limit? I was trying some script that has 2 loops ( loop within a loop ). |
| 01-25-2008, 01:15 PM | #2 |
if the function is too long (time of his execute). If you use grimoire he will tell you if a function reach a limit op Btw if you do that : JASS:loop exitwhen true endloop You will reach a limit op. 2 way : -the condition is never true (like the example) - or they're too many actions But why you want that, you probably want say how to avoid a limit op ? if you need a big loop like JASS:local integer i=0 loop set i = i+1 exitwhen i == 100000 // your actions endloop You can use a global instead and a short timer. JASS:globals integer I=0 timer T=CreateTimer() endglobals function Loop takes nothing returns nothing local integer i=I+200 loop exitwhen i==I set I=I+1 // your actions if I==100000 then call PauseTimer(T) endloop endfunction function DoTheLoop takes nothing returns nothing call TimerStart(T,0,true,function Loop) endfunction Of course it's just an example |
| 01-25-2008, 03:44 PM | #4 |
So that's why lol! Thanks troll! |
| 01-25-2008, 04:25 PM | #5 |
Just a bit more information: If you're hitting the op limit chances are the script will lag in game. If you absolutely need to have more operations, you can call a function using a trigger and TriggerEvaluate, and the called function will have a separate op count. |
| 01-25-2008, 04:30 PM | #6 |
Thanks Strilanc!, I was using the loop to initialize my variables, but I gues it got too many lol! thanks again! |
| 01-25-2008, 04:46 PM | #7 |
Nice to know :) |
