HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Whats the best way to make a clock?

09-22-2006, 02:52 PM#1
grupoapunte
Hi, i want to make a clock for my map, and i was wondering whats the best way to make it. It don't have to be totaly accurate but for example one of the ways i imagine it could be is:

Run a trigger every 1 second updating the clock in the MB

I know this is probably the less accurate the other way would be:

Make a 99999 timer, and run a trigger every 1 second asking for the time elapsed and update it to the MB so this way if theres a delay in the trigger execution the worst a player could notice is a jump of 2 seconds (2min 30 sec to 2 min 32sec), but my question is if this may lagg? cuz i have 2 timers, the one that is runing the trigger and the endless timer.

I also was wondering if theres some way to retrive the Game Time that is shown when the game ends in the scores table?

Thanks
09-22-2006, 03:38 PM#2
Captain Griffen
1 second repeating timer would probably be the most efficient method. Also, that would enable you, if needed, to get the exact the value (by adding on the time elapsed of the timer).
09-22-2006, 08:10 PM#3
The)TideHunter(
Example of a non-Jass trigger.

Trigger:
Time
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Set Seconds = (Seconds + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Seconds Equal to 60
Collapse Then - Actions
Set Seconds = 0
Set Minutes = (Minutes + 1)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Minutes Equal to 60
Collapse Then - Actions
Set Minutes = 0
Set Hours = (Hours + 1)
Else - Actions
Else - Actions
Set Time = (((((String(Hours)) + :) + (String(Minutes))) + :) + (String(Seconds)))

You will need 3 integers, and 1 string.
The 3 integers being called Seconds, Minutes and Hours, and the string being called Time or whatever.
Thats the basis of a clock.
09-24-2006, 11:15 AM#4
BertTheJasser
Just use a timer and and get the expired time.