Home   Help Search Login Register  

Author Topic: Lap Timer?  (Read 1164 times)

0 Members and 1 Guest are viewing this topic.

Offline danturn

  • Members
  • *
Lap Timer?
« on: 20 Jul 2008, 03:24:29 »
I got bored and decided to build a race track, I fancy including a lap timer but have no idea where to start! I want it to activate as you go through the start gate and finish and display your time as you pass under it again which will restart the timer to time the new lap.

Any ideas?

Offline Carroll

  • Members
  • *
  • Mission Designer (MP-"well tryin to capiche"
Re: Lap Timer?
« Reply #1 on: 20 Jul 2008, 06:51:44 »
hi Danturn, heres a very simple timer script that shows your time in seconds as a Hint in the top left hand of screen

Code: [Select]
;LapTime.sqs
_TimeSpent = _this select 0
_Caption = _this select 1

#Update
_TimeSpent = _TimeSpent +1
?trigFinish : goto "FinishTime"
Hint format[_Caption + "%1",_TimeSpent]
~1
goto "Update"

#FinishTime
;Option here to elaborate
trigFinish=False
exit

call it with:
Code: [Select]
[0, "Lap Time: "] exec "LapTimer.sqs";
Don't expect anything too exciting with this. You'll need to place a Start trigger to detect when the racer has left the start line to call the script....then a 2nd trigger to detect when the racer has crossed the Finish line (trigFinish=true).

EDIT: Just be sure make both triggers are repeating. Also make sure both Start & Finish triggers are at least as wide as the road & about 3m deep, allowing for about a 1m gap between the 2. Obviously, Group both triggers to the Player... Start Trig set to 'Vehicle' - 'Not Present'... Finish Trig set to 'Vehicle' - 'Present' (not sure if i can be any clearer)

When you cross back over the Start trigger again the trigger will restart the script from 0
« Last Edit: 20 Jul 2008, 13:44:49 by Carroll »

Offline danturn

  • Members
  • *
Re: Lap Timer?
« Reply #2 on: 28 Jul 2008, 17:04:54 »
Cheers will give this a go!, forgot i posted this haha, thanks