Jump to content
Wildstyle

A visible timer script?

Recommended Posts

title says it all

Hi everyone i need a VISIBLE timer script that times how long it take to get to a trigger...EG: START trigger-----1----2----3----4---Finish trigger

--------------------------------------------------------

"Pfc.Commando finished the course in 4 seconds"

--------------------------------------------------------

in other words i need a script that when you get to the start line a timer starts counting up and when you get to the finished line the timer stops counting and tells EVERYONE your time

i also need it to be used repeatedly...

Could you please help me i've searched everywhere and no one has made a script that works...they all have glitchs in it and errors

:happyagentSmith::war::happyagentSmith:

Edited by Wildstyle

Share this post


Link to post
Share on other sites

bump.....please help me i need the script or need a way to make one in less then 5 days

Share this post


Link to post
Share on other sites

"client.sqf" runs in the init field of all players ( e.g. init="client = [] execVM ""client.sqf"""; )

broadcast = "";

GlobalMsg =
{
titleText [format ["%1",broadcast],"plain down"];
broadcast = "";
};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{	
sleep 0.5;
if (broadcast != "") then {[] call GlobalMsg};
};

"stopwatch.sqf" does the timing

counter=0;
runStopwatch = true;

while {runStopwatch} do
{
broadcast = format["%1 second(s)", counter];
publicVariable "broadcast";
sleep 1;
counter = counter + 1;
};

"mission.sqm" contains the following activation/deactivation lines

expActiv="coach = [] execVM ""stopwatch.sqf"";";
expDesactiv="runStopwatch=false; broadcast=format[""%1 took %2 second(s)"", this, counter];publicVariable ""broadcast"";";

Share this post


Link to post
Share on other sites

how exactly do i use it

1 script into every player

second script on start line trigger

last script on finish line?

Share this post


Link to post
Share on other sites

there are 2 new scripts and an edit of the pre-existing mission file

Listing 1 is the file client.sqf executed whenever a player joins

Listing 2 is the file stopwatch.sqf called by your trigger

Listing 3 is the trigger code which you can hand-edit into mission.sqm file or paste into the editor's trigger dialogue-box.

Share this post


Link to post
Share on other sites
there are 2 new scripts and an edit of the pre-existing mission file

Listing 1 is the file client.sqf executed whenever a player joins

Listing 2 is the file stopwatch.sqf called by your trigger

Listing 3 is the trigger code which you can hand-edit into mission.sqm file or paste into the editor's trigger dialogue-box.

put 1 in player

2 in start

3 in finish yes?

Share this post


Link to post
Share on other sites

What's start and finish? Is it the scripts that you don't understand? You can't really do this in the mission editor... Your mission may be in a .pbo file. Un-pbo it and you get a mission.sqm file and maybe other files. client.sqf and stopwatch.sqf go in the same place and then you create a pbo including them.

Share this post


Link to post
Share on other sites

I am making the map and i do know abit about scripting...i can't make scripts but i know how to make ok maps.

Start is my trigger at the start line where i want the stop watch to start

Finish is my second trigger where i want the stop watch to finish

and the client.sqs would go in players

what your saying is the mission.sqs scripts are the deactivation and activation lines.....sorry i had a mental shutdown yesterday.....getting up at 5 in the morning to drop somone off at the airport after having only 5 hours sleep is not great for your brain

but could i put the client.sqs in the init.sqs file in my mission to save myself time?

I went and put the scripts in my mission folder and activation and deactivation codes into the triggers and nothing popped up and nothing came up at the end telling me my time....

Edited by Wildstyle

Share this post


Link to post
Share on other sites

OK, I see we had a communication failure at the start: you have two triggers instead of the one. My code uses a single trigger e.g. the player enters the trigger area and starts the (broadcasting) clock . He leaves the area at the finish line and his final time is broadcast.

If you can do it with one trigger encompassing the course then what I've done will work with the edits given below. If you want/need to keep 2 triggers, I'll explain a (hopefully) quick fix at the end.

1. Ok, you have an "init.sqs" file. In that, put a line as follows: -

?isPlayer _clientThread = "[] execVM ""client.sqf"""

2. Make "client.sqf" as I specified earlier.

3. Make "stopwatch.sqf" as I specified earlier.

4. Edit "mission.sqm". This file is created by the editor for any and every mission. I imagine it's in the same place as your "init.sqs" (and hopefully the same place as "client.sqf" and "stopwatch.sqf"). "mission.sqm" contains all the objects, triggers etc you placed inside the ingame editor.

4.1. You gave your start trigger a name. Find that entry and put the activation and deactivation code I specified earlier. Maybe it's already there if you typed it inside the ingame editor.

----------

If you've got two triggers, then you can do instructions 1,2 and 3 above. Then you take the activation code-line I originally gave and put that in the activation line for the Start trigger. Then you take the deactivation line I gave and move it into the _activation_ field of the Finish trigger. Both the triggers' deactivation fields are then left empty.

Edited by Mr Fenix
PS there is no "mission.sqs" script. It's "mission.sqm"

Share this post


Link to post
Share on other sites

Mr. Fenix

I am attempting to use this script in a trigger. I have done exactly like you explained in the post above with the activate line in my trigger and the first three steps done as well.

From what I can tell, it should be working, but whenever a player enters the trigger area, the timer won't show up. Has anyone else tried this and had it work or am I missing something?

As usual thanks in advance for the help guys:rolleyes:

Share this post


Link to post
Share on other sites

is tthis still working??

 

Eny body have a eksamble mission?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×