Home   Help Search Login Register  

Author Topic: loop thingy!  (Read 736 times)

0 Members and 1 Guest are viewing this topic.

titan

  • Guest
loop thingy!
« on: 15 Apr 2003, 18:03:23 »
ok, i was wonder how do you have many things in one script, as in....say i wanted 2 things being made within 2 seconds of each other, while i had the same thing but smewhere else   :-\  and it was repeating...

#loop
_bang = "heat120" camcreate getpos target1
~2
_bang1 = "heat120" camcreate getpos target1
~2
goto "loop"

(and while thats going on, this is happening at the same time...but still in the same script!)

#start
_boom = "heat120" camcreate getpos target2
~2
_boom1 = "heat120" camcreate getpos target2
~2
goto "start"

CrashnBurn

  • Guest
Re:loop thingy!
« Reply #1 on: 17 Apr 2003, 13:33:08 »
I have no idea what you're tring to do but this should work if I understand your question-

#loop
_bang = "heat120" camcreate getpos target1
_boom = "heat120" camcreate getpos target2
~2
_bang1 = "heat120" camcreate getpos target1
_boom1 = "heat120" camcreate getpos target2
~2
goto "loop"

titan

  • Guest
Re:loop thingy!
« Reply #2 on: 17 Apr 2003, 14:45:19 »
wat i mean is, how cld u have lots of things going on in a script...the prob is, that if u had one thing on a loop, and smething else on a loop at the same time, how wld it be pos?
Cause while the first thing is looping the second one cant cause the first part keeps repeating (made any more sense?)

Kinnon

  • Guest
Re:loop thingy!
« Reply #3 on: 17 Apr 2003, 15:52:04 »
You have the things you want to be happening at the same time inside the same loop, as CrashnBurn described, it is all executed so quickly it seems to be happening at the same time ...

titan

  • Guest
Re:loop thingy!
« Reply #4 on: 17 Apr 2003, 16:09:17 »
what i mean is have to things happening at the same time in the same script. so u have one thing looping...so smething like this

_target = _this select 0

#loop
_bang = "heat120" camcreate getpos _target
~2
goto "loop"

#start
_bang1 = "grenade" camcreate getpos _target
~2
goto "start"




and that happens all in the same script, so a heat120 is being made at one place while a grenade is being made at another...

but the script starts at the first loop, then goes down to the goto "loop"... this makes it so that the second part of the script wont start cause the first part will keep repeating, so how cld i make it so that they both happen (know what i mean yet?)

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:loop thingy!
« Reply #5 on: 17 Apr 2003, 16:42:09 »
That's easy (if i understand your question that is):

Call the script with the appropiate section name as 1st parameter, then more parameters as the section needs them. Like: ["loop",MyTarget] exec "MyScript.sqs"



Quote
_section=_this select 0
goto _section

#loop
_target=_this select 1
_bang = "heat120" camcreate getpos _target
~2
goto "loop"

#start
_target=_this select 1
_bang1 = "grenade" camcreate getpos _target
~2
goto "start"

EXIT

Since you don't have a point where the script exits, it will run forever. You'll need to call it twice (in this case), 1 for every section of course. That means that there will be 2 copies of this script running in memory during mission runtime. I dunno what happens if you call the script with a false section name (which doesn't exist), better add a 'EXIT' at the end.

Hope this helps  8)
« Last Edit: 17 Apr 2003, 16:46:30 by DrStrangelove »

titan

  • Guest
Re:loop thingy!
« Reply #6 on: 17 Apr 2003, 16:56:58 »
yeah i get u, in one trigger put

["loop", target] exec....

and in another...

["start", target] exec....


so once these activate, will they just repeat other and other (what i want)?