Posted by member 302889 on 2006-10-09 19:24:10 link
ok, i was wrong. i still can't get it working.
i'm using the timer-0.5 module and the ByeWindows-0.4 aling with xlabel and mzscript.
lets say for example that i set the timer to countdown for 3 hours before turning the PC off. That works out at 10800000 millisceonds.
How do i write a piece of mzscript which will interpret that and convert it to hours, minutes and seconds.
i can show the calculations on my xlabel using the code i posted earlier but they show up lots of odd numbers and decimal places and it doesn't even count down for the length of time that it should.
If you are interested, here is the code i have so far
this is really begining to bug my ti*s.
cheers
John
i'm using the timer-0.5 module and the ByeWindows-0.4 aling with xlabel and mzscript.
lets say for example that i set the timer to countdown for 3 hours before turning the PC off. That works out at 10800000 millisceonds.
How do i write a piece of mzscript which will interpret that and convert it to hours, minutes and seconds.
i can show the calculations on my xlabel using the code i posted earlier but they show up lots of odd numbers and decimal places and it doesn't even count down for the length of time that it should.
If you are interested, here is the code i have so far
*Script bang !Panel_Sleep
*Script exec !NetReloadModule ByeWindows-0.4
*Script exec !NetReloadModule Timer-0.5
*Script exec !LabelShow SleepPanel
*Script exec !varset sleepstarted 0
*Script exec !LabelSetText SleepDownPanelBtn2 "START"
*Script exec !TimerAdd Sleep 300000 !Sleep
*Script exec !varset SleepMSecs 300000
*Script ~bang
*Script bang !Sleep_Start_Countdown
*Script exec !varset sleepstarted 1
*Script exec !LabelSetText SleepDownPanelBtn2 "CANCEL"
*Script exec !LabelRefresh SleepDownPanelBtn2
*Script exec !TimerStart Sleep
*Script exec !Shutdown_Sleep_Counter
*Script ~bang
*Script bang !Shutdown_Sleep_Counter
*Script gotoif ("%{canceled}" = "1") Counter_End
*Script exec !Pause 1000
*Script exec !varAdd SleepMSecs -1000
*Script exec !Varset SleepHrs %{SleepMSecs}
*Script exec !varDiv SleepHrs 3600000
*Script exec !Varset SleepHrsMod %{SleepMSecs}
*Script exec !varMod SleepHrsMod 3600000
*Script exec !varAdd SleepHrs -%{SleepHrsMod}
*Script exec !Varset SleepMins %{SleepMSecs}
*Script exec !Varset SleepMinsMod %{SleepHrs}
*Script exec !VarMul SleepMinsMod 3600000
*Script exec !ifEval ("%{SleepHrs}" > "0") !varAdd SleepMins -%{SleepMinsMod}
*Script exec !varDiv SleepMins 60000
*Script exec !Varset SleepMinsMod2 %{SleepMSecs}
*Script exec !varMod SleepMinsMod2 60000
*Script exec !varAdd SleepMins -%{SleepMinsMod2}
*Script exec !Varset SleepSecs %{SleepMSecs}
*Script exec !ifEval ("%{SleepHrs}" > "0") !varAdd SleepSecs -%{SleepMinsMod}
*Script exec !Varset SleepSecsMod %{SleepMins}
*Script exec !VarMul SleepSecsMod 60000
*Script exec !varAdd SleepSecs -%{SleepMinsMod}
*Script exec !varDiv SleepSecs 1000
*Script exec !LabelSetText SleepCounter "%{SleepHrs}:%{SleepMins}:%{SleepSecs}"
*Script exec !Cycle
*Script goto end
*Script label Counter_End
*Script exec !LabelHide SleepPanel
*Script label end
*Script exec !Varset canceled 0
*Script exec !varset sleepstarted 0
*Script ~bang
*Script bang !Cycle
*Script exec !Shutdown_Sleep_Counter
*Script ~bang
*Script bang !Sleepdown_Cancel
*Script exec !TimerKill Sleep
*Script exec !LabelHide SleepPanel
*Script exec !Pause 2000
*Script exec !NetUnloadModule Timer-0.5
*Script exec !NetUnloadModule ByeWindows-0.4
*Script exec !LabelSetText Counter 10
*Script exec !Varset canceled 1
*Script ~bang
*Script exec !NetReloadModule ByeWindows-0.4
*Script exec !NetReloadModule Timer-0.5
*Script exec !LabelShow SleepPanel
*Script exec !varset sleepstarted 0
*Script exec !LabelSetText SleepDownPanelBtn2 "START"
*Script exec !TimerAdd Sleep 300000 !Sleep
*Script exec !varset SleepMSecs 300000
*Script ~bang
*Script bang !Sleep_Start_Countdown
*Script exec !varset sleepstarted 1
*Script exec !LabelSetText SleepDownPanelBtn2 "CANCEL"
*Script exec !LabelRefresh SleepDownPanelBtn2
*Script exec !TimerStart Sleep
*Script exec !Shutdown_Sleep_Counter
*Script ~bang
*Script bang !Shutdown_Sleep_Counter
*Script gotoif ("%{canceled}" = "1") Counter_End
*Script exec !Pause 1000
*Script exec !varAdd SleepMSecs -1000
*Script exec !Varset SleepHrs %{SleepMSecs}
*Script exec !varDiv SleepHrs 3600000
*Script exec !Varset SleepHrsMod %{SleepMSecs}
*Script exec !varMod SleepHrsMod 3600000
*Script exec !varAdd SleepHrs -%{SleepHrsMod}
*Script exec !Varset SleepMins %{SleepMSecs}
*Script exec !Varset SleepMinsMod %{SleepHrs}
*Script exec !VarMul SleepMinsMod 3600000
*Script exec !ifEval ("%{SleepHrs}" > "0") !varAdd SleepMins -%{SleepMinsMod}
*Script exec !varDiv SleepMins 60000
*Script exec !Varset SleepMinsMod2 %{SleepMSecs}
*Script exec !varMod SleepMinsMod2 60000
*Script exec !varAdd SleepMins -%{SleepMinsMod2}
*Script exec !Varset SleepSecs %{SleepMSecs}
*Script exec !ifEval ("%{SleepHrs}" > "0") !varAdd SleepSecs -%{SleepMinsMod}
*Script exec !Varset SleepSecsMod %{SleepMins}
*Script exec !VarMul SleepSecsMod 60000
*Script exec !varAdd SleepSecs -%{SleepMinsMod}
*Script exec !varDiv SleepSecs 1000
*Script exec !LabelSetText SleepCounter "%{SleepHrs}:%{SleepMins}:%{SleepSecs}"
*Script exec !Cycle
*Script goto end
*Script label Counter_End
*Script exec !LabelHide SleepPanel
*Script label end
*Script exec !Varset canceled 0
*Script exec !varset sleepstarted 0
*Script ~bang
*Script bang !Cycle
*Script exec !Shutdown_Sleep_Counter
*Script ~bang
*Script bang !Sleepdown_Cancel
*Script exec !TimerKill Sleep
*Script exec !LabelHide SleepPanel
*Script exec !Pause 2000
*Script exec !NetUnloadModule Timer-0.5
*Script exec !NetUnloadModule ByeWindows-0.4
*Script exec !LabelSetText Counter 10
*Script exec !Varset canceled 1
*Script ~bang
this is really begining to bug my ti*s.
cheers
John