summaryrefslogtreecommitdiffstats
path: root/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt
downloadStudium-master.tar.gz
Studium-master.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt')
-rw-r--r--Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt b/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt
new file mode 100644
index 0000000..909b3b7
--- /dev/null
+++ b/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/originaltexts/actions_timer.txt
@@ -0,0 +1,30 @@
+// Timing Functions
+
+StartTime = null; // this variable is set when the start button is pressed
+ // so that the user is not penalized for the loading time of flash
+
+// timer_timeCompute()
+// IN : none
+// DO : calculates the minutes and seconds elapsed since the user began the simulation
+// OUT: print it out into a text field
+
+function timer_timeCompute()
+{
+ var CurrentTime = (getTimer()-StartTime)/1000; // gets the current time in milliseconds, subtracts the starttime,
+ // and converts it into seconds.
+
+ var Minute = Math.floor(CurrentTime/60); // get # of minutes in current time
+ var Second = Math.floor(((CurrentTime/60) - Minute) * 60); // get # of seconds in current time
+
+ if ((Minute.toString()).length == 1) {
+ // adding a zero to # of minutes if it is less than 10 for correct display
+ Minute = "0" + Minute;
+ }
+
+ if ((Second.toString()).length == 1) {
+ // adding a zero to # of seconds if it is less than 10 for correct display
+ Second = "0" + Second;
+ }
+
+ _root.Menu.Clock.TIME = Minute + ":" + Second; // display time elapsed
+} \ No newline at end of file