Mzscript Thread last updated on 2003-08-01 21:00:35

Posted by member 15303 on 2003-08-01 19:04:15

hey guys,

I haven't written a litestep theme in a long time... probably over a year, and I'm really rusty. I'm trying to use mzscript, can anyone tell me why this won't do *anything*?

;=======
;MZSCRIPT CHUNK
;=======
*Script var timenow %[hour]

*Script bang !null
*Script exec !none
*Script ~bang

*Script bang !setGreet
*Script exec !ifEval ("timenow" <= 12) '|NewLabelSetText "Good Afternoon"'
*Script exec !ifEval ("timenow" >= 18) '|NewLabelSetText "Good Evening"'
*Script ~bang

*Script start !setGreet
*Script start !null
;=======

I have the null there because I remember some bug that required that... but that was way back when... I lost touch with litestep when ls.net went down for a long period of time. Any help would be greatly appreciated!

Posted by member 15303 on 2003-08-01 19:05:33 link

umm it messed up the less than an greater than sign, it's supposed to be less than or equal to 12, not = 12.

Posted by member 15303 on 2003-08-01 19:06:41 link

whoa it really messed it up... it's suppoed to good morning if less than 12, and good afternoon if greater than or equal to 12

Posted by member 1 on 2003-08-01 20:09:20 link

you can't just type <...you have to use the HTML code because otherwise it thinks its an HTML tag. And you should also have used the code formatting. all fixed now.

Now...the reason why it doesn't work is because your timenow doesn't adjust hourly...it is just set when your script is loaded and never updated. You need to check a dynamic variable.

Posted by member 37809 on 2003-08-01 21:00:35 link

ltns DaPCWiz.

You should cover all cases... afternoon isn't midnight to noon, or maybe it is for you :)

Nice idea for a theme function, so I indulge a bit here. Feela free to adjust according to lifestyle (untested btw):

*script bang !setGreet
*script gotoif ("%[hour]" <= 2) evening
*script gotoif ("%[hour]" <= 5) late
*script gotoif ("%[hour]" <= 7) early
*script gotoif ("%[hour]" <= 12) morning
*script gotoif ("%[hour]" >= 18) evening
; else it's afternoon
*script exec !NewLabelSetText "Good afternoon, $UserName$"
*script goto rest
*script label late
*script exec !NewLabelSetText "Go sleep, foo."
*script goto rest
*script label evening
*script exec !NewLabelSetText "Good evening, $UserName$"
*script goto rest
*script label early
*script exec !NewLabelSetText "Get some coffee."
*script goto rest
*script label morning
*script exec !NewLabelSetText "Good morning, $UserName$"
*script label rest
; you could have used *script exit, instead of coming here.
*script ~bang


For added variety, make files for each case and try Label's [randomLine()]