Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: How can I break a loop after a few seconds have past?  (Read 617 times)

0 Members and 2 Guests are viewing this topic.

Anton VonE

  • Guest
The following is a great little snippet that will follow a unit. However, it follows it indefinately...how would I make it stop after 12 seconds?

Anton

;tracking.sqs created by: ???
_unit = _this select 0
_x = _this select 1
_y = _this select 2
_z = _this select 3
stoptracking = false

_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_cam camSetTarget _unit
_cam CamSetFOV 0.7
 
#loop
~0.01
_cam camSetRelPos [_x,_y,_z]
_cam camCommit 0
? not stoptracking : goto "loop"


_cam cameraeffect ["terminate", "back"]
camdestroy _cam
exit


Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:How can I break a loop after a few seconds have past?
« Reply #1 on: 19 Mar 2003, 01:36:51 »
Well... you could change this line here:

? not stoptracking : goto "loop"

To look like this:

? _time < 12: goto "loop"

That will make the script destroy the camera and exit twelve seconds after the script starts running ;)

Anton VonE

  • Guest
Re:How can I break a loop after a few seconds have past?
« Reply #2 on: 19 Mar 2003, 02:58:48 »
Thank you so much for your help!

Anton