Mzscript & e-vars Thread last updated on 2003-11-03 17:11:58

Posted by member 51749 on 2003-10-31 22:30:51

hey

i have a few vars which i want to change from within a bang defined with mzscript. how do i go about this?

something like this.
*script bang !prevImg
*script exec !varset t $currentImg$
*script exec !ifEq t "1" |set3
*script exec !ifEq t "2" |set1
*script exec !ifEq t "3" |set2
*script exec !UpdateWeather
*script ~bang

;Satellite Photo
*script bang !set1
*script exec !Setvar currentImg "1"
*script exec !Setvar SatImg "$WeatherDir$temp\satellite.png"
*script ~bang

;Isobar Photo
*script bang !set2
*script exec !Setvar currentImg "2"
*script exec !Setvar SatImg "$WeatherDir$temp\satisobar.png"
*script ~bang

;Radar Photo
*script bang !set3
*script exec !Setvar currentImg "3"
*script exec !Setvar SatImg "$WeatherDir$temp\satradar.png"
*script ~bang

Posted by member 12025 on 2003-10-31 23:09:50 link

AFAIK, the evars still don't change from mzScript. Based on beta11's readme, it is planned for 0.9's release. beta12's readme didn't seem to mention it (that I saw), and I haven't tested it, as I'm somewhat loathe to use it, given that shellfront doesn't have it for download (I know I could set loose-screws as a site in my RC, but still...).
*mzVarFile "$ConfigDir$vars.rc"
include "$ConfigDir$vars.rc"

That will load the variables as evars for use with start coordinate and image settings.
*script bang !prevImg
*script exec !varset t $currentImg$
*script exec !UpdateWeather
*script GotoIf ( "%{SatImg}" = "ellite" ) set3
*script GotoIf ( "%{SatImg}" = "isobar" ) set1
*script GotoIf ( "%{SatImg}" = "radar" ) set2
*script Label set1
*script exec !varSet SatImg "ellite" ;Satellite Photo
*script Goto Imgupdate
*script Label set2
*script exec !varSet SatImg "isobar" ;Isobar Photo
*script Goto Imgupdate
*script Label set3
*script exec !varSet SatImg "radar" ;Radar Photo
*script Label ImgUpdate
*script exec !BangToChangeImageUsedInModule $WeatherDir$temp\sat%{SatImg}.png
*script exec !UpdateWeather ; ????
*script ~bang

...then try something like that (that may not be perfect, as I don't know the specifics of your situation, and coudn't test it, so may have an error or two I didn't catch). I couldn't find the weather module you were using (well, with a bang called !UpdateWeather), which would also help solve the problem.
Hope that helps

Posted by member 51749 on 2003-10-31 23:22:41 link

cheers man :) ill give that a go.

well, i am using getWeather, but ive modified it heavily, so its not really getWeather anymore :P

Posted by member 1 on 2003-10-31 23:37:44 link

yah...mzscript .9b12jam4 was written specifically for GetWeather to work with a label. Thanks Leafy Phil!

Posted by member 51749 on 2003-11-01 00:20:39 link

hmm...im not sure if that version of mzscript is what i need.

i need to set a value to an evar that is used by litestep (doesnt matter which module, but in this case it is label), from within a bang which i define in mzscript. im just not sure which command to use, or if its possible yet.

if it is, and im just stupid, tell me how its done, please!

i know (i think) that...
*script var SatImg "stuff"
*script exec !varset SatImg "stuff"
*script exec !setvar SatImg "stuff"

...all set a mzscript internal var, so they are no good. D:! i just need it to set $SatImg$ so i can use it in label :(

Posted by member 12025 on 2003-11-01 00:55:57 link

Won't get it exactly done, but what about making a label for each image and doing a show/hide based on which image should be used? Make it such that mzScript only has to read evars, not write them.

Posted by member 36955 on 2003-11-01 02:07:22 link

well... the best solution would really be naming the mzvars the same as the evars, and then including the mzvarfile in your step.rc. so for your example, use
;mzvarfile.rc
SatImg "stuff"

;mzscriptfile.rc
*script bang !dostuff
*script exec !varset SatImg "morestuff"
*script exec !varsave SatImg
*script ~bang

;step.rc
*mzScriptFile "$ConfigDir$mzscriptfile.rc"
*mzVarFile "$ConfigDir$mzvarfile.rc"
include "$ConfigDir$mzvarfile.rc"

this requires mzscript 0.9 beta 8 or later, and it requires 0.9 beta 12 jam 4 if you need to use $ or " in your value for SatImg

Posted by member 7 on 2003-11-01 02:30:58 link

If you need a module to pick up $evar$ changes you can use !reloadmodule.

Posted by member 51749 on 2003-11-01 12:48:57 link

Won't get it exactly done, but what about making a label for each image and doing a show/hide based on which image should be used? Make it such that mzScript only has to read evars, not write them.
---------------------------

this is exactly what i thought of while in bed last night :P will try it out now.

Posted by member 12025 on 2003-11-01 20:14:41 link

Steering away from vertigoalopolus here...
"If you need a module to pick up $evar$ changes you can use !reloadmodule."
...but how do you actually change the evars? How do you set them or load a file with new values?

Posted by member 1783 on 2003-11-02 02:55:27 link

textedit is one possibility...

Posted by member 51749 on 2003-11-02 15:42:40 link

heh, my idea worked.

but mzscript really should be able to update evars.

Posted by member 36955 on 2003-11-02 20:34:49 link

i believe thats planend for the core, but im not entirely sure (wasnt it added to the indiestep builds near the end with !setvar? or am i just being stupid?)

Posted by member 7 on 2003-11-03 05:42:02 link

No, mzscript should not be able to update evars. It's a completely different variable system managed by the core. The !setvar stuff is just a hack which doesn't reliably work. What you want is either mzscript 0.8.x with textedit2, or alternatively just a mzscript 0.9 preview with an *mzVarFile. Just "include" that varfile, then all the variables in there are available as $evars$ as well.
After mzscript saves the var to the varfile you call !reload. Then call !reloadmodule for the module that needs to pick up the variable change and you should be done.

Posted by member 51749 on 2003-11-03 13:15:31 link

or it could just ask litestep to update $evarname$

Posted by member 7 on 2003-11-03 15:14:30 link

And what then? The modules would not be aware of the change. Someone has to tell them. That's what you need !reloadmodule for.

Posted by member 51749 on 2003-11-03 17:11:58 link

thats fine...i use !reload anyway. itd just be nice if there was something to reload.