IF statements in .box file Thread last updated on 2004-07-16 03:34:48

Posted by member 125450 on 2004-07-15 14:05:24

I can't seem to get IF statements to function in LSBox

My idea is the have an amp control where the user selects the controls he or she wants and the box sizes to fit.
I set up the vars and the box sizes correctly, but if I set a button to false it still appears also the box does not appear on recycle I would have to toggle it off and then back on.

LsBoxName amp
LsBoxX 170
LsBoxY $ontopy$
LsBoxBackGround boxback.png
LsBoxZOrder normal
LsBoxHeight 28
LsBoxWidth $ampx$
LsBoxAlphaTransparency $alpha$

*shortcut "Volume Control/Multimedia" 3 $ontopy$ speaker.png speakerin.png .none #2 [sndvol32.exe] [Mmsys.cpl]

If Prev = true
*shortcut "Prev Track/REW" $amp01$ $ontopy$ vwml.png vwmls.png .none #1 [!amp_prev] [!Amp_Rewd5s]
Endif

If Play = true
*shortcut "Play/PlayDIR" $amp01+amp02$ $ontopy$ mpplay.bmp mpplayin.bmp mpplay.bmp #1 [!amp_play] [!Amp_LoadDir]
Endif

If Pause = true
*shortcut "Pause/Shuffle" $amp01+amp02+amp03$ $ontopy$ mppause.bmp mppausein.bmp mppause.bmp #1 [!amp_pause] [!Amp_Shuffle]
Endif

If Stop = true
*shortcut "Stop/$Eject_1$" $amp01+amp02+amp03+amp04$ $ontopy$ mpstop.bmp mpstopin.bmp mpstopin.bmp #1 [!amp_stop] [$Eject1$]
Endif

If Playlist = true
*shortcut "Playlist/VIS" $amp01+amp02+amp03+amp04+amp05$ $ontopy$ mplist.bmp \mplistin.bmp mplist.bmp #1 [!amp_playlist] [!Amp_StartPlugin]
Endif

If Next = true
*shortcut "Next Track/FFW" $amp01+amp02+amp03+amp04+amp05+amp06$ $ontopy$ vwmr.png vwmrs.png .none #1 [!amp_next] [!Amp_Ffwd5s]
Endif

If Volume = true
amp07 23
*ModuleHook !SliderHook "Volume" $amp01+amp02+amp03+amp04+amp05+amp06+amp07$ 4 1 sliderbg1.png sliderdot1.png V [VOLUME] 0
Endif

If Position = true
*ModuleHook !SliderHook "Position" $amp01+amp02+amp03+amp04+amp05+amp06+amp07+amp08$ 4 1 sliderbg2.png sliderdot1.png V [Winamp]
Endif

ampx $amp01+amp02+amp03+amp04+amp05+amp06+amp07+amp08$+35

Posted by member 125450 on 2004-07-15 14:11:16 link

using lsbox-3.0-pre3 & mzscript-0.9-beta_12 with these mzscript settings
*mzVarFile "$ConfigDir$vars.rc"
*mzScriptFile "$ConfigDir$script.rc"
mzAutosaveVars immediately
*mzScriptNewSyntax
xLabelUseTextEdit
xLabelUseShortcut2

Here are the vars I used in my vars.rc

Prev true
Play true
Pause true
Stop true
Playlist true
Next true
Position false
Volume true
amp01 30
amp02 15
amp03 20
amp04 20
amp05 20
amp06 20
amp07 20
amp08 10

Posted by member 37809 on 2004-07-15 20:43:45 link

In your case I would try this, but I don't know if it works or not because I haven't used LsBox for a while now.

Set some backend If's in some .rc file (not your vars.rc)
if Prev
doPrev shortcut
endif
doPrev no ;I put this outside to act as a default value


then try
*$doPrev$ "Prev Track/REW" $amp01$ $ontopy$ vwml.png vwmls.png .none #1 [!amp_prev] [!Amp_Rewd5s]


and a similar thing for the "ModuleHook"--it's ugly I know...

Oh, if your vars.rc is mzscript-edited I guess you could use the actual values to not have double the number of evars.

Posted by member 125450 on 2004-07-15 22:22:39 link

I'll give that a try, Thanks

Posted by member 125450 on 2004-07-15 22:26:16 link

The vars amp01 amp02 and so on will be a positive value like 20 or 25 while in an on state and 0 while turned off so the box can be sized to fit other boxes use amp.box width to resize

Posted by member 45783 on 2004-07-16 03:34:48 link

Of course, if there is some distinction between box files and rc files, you could use xlabel as your box provider.