mzscript variables in bangs Thread last updated on 2003-06-13 22:20:41

Posted by member 40529 on 2003-06-12 21:08:37

In order to write a script in a bit more efficient way, I'm trying to have it execute a variable !bang.

*Script !VarSet bangprefix 'something'
*Script exec "!%{bangprefix}postfix"

Obviously the above doesn't work, but it should give you an idea as to what I'm trying to do. Is there a way?

Posted by member 7 on 2003-06-13 01:30:44 link

actually it should work... if not try
*Script exec !%{bangprefix}postfix

ie. without the "" quotes. If that still doesn't work use
*Script exec !exec !%{bangprefix}postfix

Posted by member 1783 on 2003-06-13 05:28:23 link

well, shouldn't it be:
*Script exec !VarSet bangprefix 'something'

i think you missed one 'exec'.

Posted by member 40529 on 2003-06-13 10:07:03 link

I have tried
*Script exec !VarSet SelectedStat 'CPU'


followed by each of the following
*Script exec !exec "!%{SelectedStat}LabelShow"
*Script exec !exec !%{SelectedStat}LabelShow
*Script exec !exec "|%{SelectedStat}LabelShow"
*Script exec !exec |%{SelectedStat}LabelShow
*Script exec "!%{SelectedStat}LabelShow"
*Script exec !%{SelectedStat}LabelShow
*Script exec "|%{SelectedStat}LabelShow"
*Script exec |%{SelectedStat}LabelShow


and none work. The only thing that works is
*Script exec !CPULabelShow



btw, the missing exec was only a typo in the post :)

Posted by member 1783 on 2003-06-13 10:27:05 link

maybe use double-quotes or just quotes around the substitution:
*Script ... "!'%{SelectedStat}'LabelShow"
*Script ... !"%{SelectedStat}"LabelShow

no other idea :(

ilmcuts! *me cries for help*

Posted by member 32550 on 2003-06-13 11:27:07 link

Hi just my little tribute. Maybe it's just the case you didn't set
mzScriptNewSyntax

because the %{ } work only if this is set ;-)
Hope this helps ... It works in my scripts
mzScriptNewSyntax ; ANYWhere in step
*script exec !%{label}labelsetfontcolor 444444

Andymon

Posted by member 7 on 2003-06-13 14:33:08 link

Welllll you didn't say which mzscript version you're using. 0.7.x and 0.8.x might not support this, though i think the 0.9 previews do. Anyway, the next mzscript version will support it. :P

Posted by member 40529 on 2003-06-13 22:20:41 link

I was using 0.8. Switching to 0.9 and changing

mzScriptFile "$ConfigDir$script.rc"

to

*mzScriptFile "$ConfigDir$script.rc"

made it work. Thank you everybody for the help :)