Countdown Timer Thread last updated on 2006-10-12 11:30:47

Posted by member 212670 on 2006-10-10 17:03:56

-Made with mzscript-1.0-rc2 and xlabel-3.6.2.
-Should work with any xlabel, but mzscript syntax isn't compatible with all versions of mzscript.
-The site is wrapping stuff, so copy/paste in to your text editor for easier viewing.
*edit*
-Replace all NET with the 'not equal to' operator (less than and greater than symbols together - the site ate them).

*Label timer
timerX 50
timerY 50
timerWidth 146
timerHeight 24
timerSolidColors EEEEEE FFFFFF 000000
timerSolidBevelSize 1
timerText "02:00:15" ;can be set to the initial time before pressing go
timerFontAlign left
timerBorders 6 0 0 0
timerAlwaysOnTop true

*Label go
goX -84
goY 2
goWidth 40
goHeight 20
goSolidColors A6A6A6 FFFFFF 000000
goSolidBevelSize 1
goPressedSolidColors A6A6A6 000000 FFFFFF
goPressedSolidBevelSize 1
goText "go"
goOnLeftClick !start

*timerModuleHook !LabelLsBoxHook go

*Label stop
stopX -42
stopY 2
stopWidth 40
stopHeight 20
stopSolidColors A6A6A6 FFFFFF 000000
stopSolidBevelSize 1
stopPressedSolidColors A6A6A6 000000 FFFFFF
stopPressedSolidBevelSize 1
stopText "stop"
stopOnLeftClick !varset stop 1 ;important for stopping the timer

*timerModuleHook !LabelLsBoxHook stop

*Script bang !start

*Script exec !varset hrs 02 ;hours, likely set with %{args:1}
*Script exec !varset mins 00 ;mins, likely set with %{args:2}
*Script exec !varset secs 15 ;secs, likely set with %{args:3}

;set the vars to 00 if they aren't inputted above, otherwise, they'll be %{args:x}
*Script exec !IfExist [hrs] [][!varset hrs 00]
*Script exec !IfExist [mins] [][!varset mins 00]
*Script exec !IfExist [secs] [][!varset secs 00]

;determine whether mins starts at 59 which affects if an hour should be removed at start.
*Script exec !If ["%{mins}" = "59"] [!varset hrstog 1][!varset hrstog 0]

*Script label top

;if secs is 0, you want them to be 59. Otherwise, you just want - 1. Nested !ifs for leading 0s.
*Script exec !If ["%{secs}" = "0"] [!varset secs 59][!If ["%{secs}" < "11"][!varset secs 0%#%{secs} - 1%#][!varset secs %#%{secs} - 1%#]]

;if seconds are 59, you'll want to remove 1 from the minutes, if available. Nested !ifs for leading 0s.
*Script exec !If ["%{secs}" = "59"] [!If ["%{mins}" = "0"] [!If ["%{hrs}" NET "0"][!varset mins 59]][!If ["%{mins}" < "11"][!varset mins 0%#%{mins} - 1%#][!varset mins %#%{mins} - 1%#]]]

;if mins are 59, you'll want to remove 1 from hrs, if available. Nested !ifs are for leading 0s.
;Need to only run this once for the duration of mins = 59. Also, if mins starts at 59 this will be skipped.
*Script gotoif ["%{hrstog}" = "1"] skip
*Script exec !If ["%{mins}" = "59"] [!If ["%{hrs}" NET "0"] [!If ["%{hrs}" < "11"][!execute [!varset hrs 0%#%{hrs} - 1%#][!varset hrstog 1]][!execute [!varset hrs %#%{hrs} - 1%#][!varset hrstog 1]]]]
*Script label skip
*Script exec !If ["%{mins}" = "58"] [!varset hrstog 0]

;set the label's text
*Script exec !LabelSetText timer "%{hrs}:%{mins}:%{secs}"

*Script exec !pause 1000

*Script gotoif ["%{stop}" = "1"] done

*Script gotoif ["%{hrs}" = "0"] minscheck
*Script goto top

;if mins are 0, check if secs are 0, otherwise back to the loop.
*Script label minscheck
*Script gotoif ["%{mins}" = "0"] secondscheck
*Script goto top

;if mins are 0, secs will be checked. If they're 0, done, otherwise, back to the top.
*Script label secondscheck
*Script gotoif ["%{secs}" = "0"] done
*Script goto top

*Script label done

*Script exec !alert "finished or stopped!"

*Script exec !varset stop 0
*Script exec !varremove hrstog
*Script exec !varremove hrs
*Script exec !varremove mins
*Script exec !varremove secs
*Script ~bang

Posted by member 1885 on 2006-10-10 17:18:09 link

Stand by for the next part of this series, the !Bomb command.

Posted by member 5575 on 2006-10-10 21:04:07 link

What's wrong with the good old !bang?

Posted by member 212670 on 2006-10-10 21:25:02 link

West hasn't been married long enough yet to be tired of the good old !bang.

Posted by member 5575 on 2006-10-11 00:39:22 link

Which, as we all know, is usually preceded by a popup.

Posted by member 248213 on 2006-10-11 16:04:06 link

Is nothing sacred!?

Posted by member 5575 on 2006-10-11 16:30:46 link

Why do you ask? Are you thinking of starting the Church of the Holy Nothing?

Posted by member 1885 on 2006-10-11 18:26:27 link

I thought that was what religion was about basically, the sacredness of nothingness...

Posted by member 248213 on 2006-10-11 20:21:09 link

No, I think its more about something'ness than nothing'ness... more something in nothing. Hope, belief... God.

I dont want to start a popup jihad or anything ("Death by Popup!!!") but what do you believe/hope/affiliate your self with, religion wise?

Posted by member 1885 on 2006-10-11 20:36:19 link

Well, nothing at all really. I wouldn't call myself an atheist, I like to keep an open mind, but I have no religious beliefs of any kind and I am not a member of any church. I'm also against all kinds of organised religion (as I believe that a person and his/her deity should not need any human intermediaries) but that's another matter.

Posted by member 212670 on 2006-10-11 20:43:52 link

If I had a dime for everytime a litestep code thread turned religious...

Posted by member 248213 on 2006-10-11 21:43:42 link

xcal: You'd have 1 dime! XD

West: Well... I dunno... organised religion is kinda like organised... litestep.

ls.net would be a church.
DeV and the rest would be the pastors, priests, nuns and such

Litestep would be our saviour :D

Posted by member 1885 on 2006-10-11 22:12:24 link

DeViLbOi... a pastor? Yeah... that sounds like the right man for the job... Maybe we can find some guys named Satan666 or FallenAngel to add to our clergy as well.

Posted by member 31 on 2006-10-12 11:30:47 link

ah-hem. ontopic folks...