OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: _Ross_ on 17 Jun 2003, 19:45:25

Title: Making loops stop
Post by: _Ross_ on 17 Jun 2003, 19:45:25
I know this sound really dumb, but could someone tell me how to make loops stop? I cant find a TUT

Thanks ;D
Title: Re:Making loops stop
Post by: Messiah on 17 Jun 2003, 19:51:52
do u mean in a script?

then add a condition into the loop which searches for a variable:

Quote
#loop

bla
bla
bla

? endloop : exit

goto "loop"

the condition is endloop so when in ur mission u want the loop to end, then make endloop = true...

in the current format it will exit the script entirely - if u want it to move onto the next part of the script use:

Quote
#loop

bla
bla
bla

? endloop : goto "next"

goto "loop"

#next

more bla bla bla

hope that helps u out...
Title: Re:Making loops stop
Post by: _Ross_ on 17 Jun 2003, 19:59:20
 ???what?

Im tryin to make a loop where averytime it happens, a counter adds one to itself would this work?

#loop

something
something
something
ctr = ctr + 1

? endloop: Ctr = 30

Goto #loop
Title: Re:Making loops stop
Post by: Messiah on 17 Jun 2003, 20:05:40
not sure what ur getting at.... do u want a loop to end after a certain number of times?

then use:

Code: [Select]
#loop

something
something
something
_ctr = _ctr + 1

? (_ctr == 30) : exit

Goto #loop

that will exit the script.... the : is the same as the 'on activation' of a trigger
Title: Re:Making loops stop
Post by: _Ross_ on 17 Jun 2003, 20:07:55
thanks thats what i was getting at