HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Running same function with argument?

01-24-2008, 12:14 AM#1
SockSquirrelMouthwash
There's a function that I'm wanting to run that takes integer i, and I want it to constantly run itself until the counter is reached:

Collapse JASS:
private function spawncmd takes integer i returns nothing
    local real wait = delay[array[i]]
    local integer counterend = counterexpires[array[i]]
    
    if counter[i] <= spawngoal and counterend [i] == false then
        call whatever(i, rectarray[i], facing[i]) 
        set counter[i] = counter[i] + 1
        call PolledWait(wait)
        call spawn(i)
    endif
endfunction

I tried running it several times and it only fired once - is there a way around this? I figured a separate trigger that calls the function would work, but then how would I transfer integer i over?

EDIT: Given some thought I figured I could use timers instead of this approach, but is it still possible the way it is?
01-25-2008, 04:34 PM#3
Strilanc
Why don't you just use a loop?
01-25-2008, 06:41 PM#4
xombie
What exactly do you want this to do? By the way, PolledWait() is not very accurate at all, so there will be a noticeable margin of error in the timing.