Home   Help Search Login Register  

Author Topic: Making loops stop  (Read 701 times)

0 Members and 1 Guest are viewing this topic.

_Ross_

  • Guest
Making loops stop
« 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

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Making loops stop
« Reply #1 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...
« Last Edit: 17 Jun 2003, 19:52:42 by Messiah »
Proud Member of the Volunteer Commando Battalion

_Ross_

  • Guest
Re:Making loops stop
« Reply #2 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

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:Making loops stop
« Reply #3 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
Proud Member of the Volunteer Commando Battalion

_Ross_

  • Guest
Re:Making loops stop
« Reply #4 on: 17 Jun 2003, 20:07:55 »
thanks thats what i was getting at