Posted by member 37809 on 2004-07-18 21:12:04 link
Using spaces in (newer) mzscript vars is asking for trouble.
But I don't want to follow your method because it has the exception of handling the "end". pika told me the cool way to cycle through a list, taking advantage of this data structure--mzscript doesn't yet have arrays :/
Let the user set your drives, separated by colons
...and you
Now, if you want to cycle through the drives, simply
The above assumes you have more than one list item in your list however. If you wanted to check if the user only had one drive you could try something like this:
Anyhow, I guess you're using two labels to animate in transition or something.
Suppose your two labels are LabelA and LabelB
On startup, I guess you want to just
...and keep a boolean variable to tell which label is 'active':
Then try a bang such as this:
Of course, set all the label texts appropriately and instead of moving them do your transition.
It could get complicated if you wanted to remember the last 'view'. It's because of the setting of the mzscript var to the evar... So replace that *script start !varset drives $drives$ with a call to something (untested) like:
and have the var drives in a varfile.
But I don't want to follow your method because it has the exception of handling the "end". pika told me the cool way to cycle through a list, taking advantage of this data structure--mzscript doesn't yet have arrays :/
Let the user set your drives, separated by colons
drives c:d:e:f:z
...and you
*script start !varset drives $drives$
.Now, if you want to cycle through the drives, simply
!varset drives %{drives:_}:%{drives:}
; ^this will grab the first of the list and stick it at the end of the list
; ^this will grab the first of the list and stick it at the end of the list
The above assumes you have more than one list item in your list however. If you wanted to check if the user only had one drive you could try something like this:
*script gotoif ("%{drives:_}" = "") handleOnlyOneDrive
; user has set it to more than one drive
*script exit ; or jump elsewhere
*script label handleOnlyOneDrive
; user has set it to more than one drive
*script exit ; or jump elsewhere
*script label handleOnlyOneDrive
Anyhow, I guess you're using two labels to animate in transition or something.
Suppose your two labels are LabelA and LabelB
On startup, I guess you want to just
*script start !exec |LabelSetText LabelA "%{drives:}"
*script start !varset drives %{drives:_}:%{drives:}
*script start !exec |LabelSetText LabelB "%{drives:}"
*script start !varset drives %{drives:_}:%{drives:}
*script start !exec |LabelSetText LabelB "%{drives:}"
...and keep a boolean variable to tell which label is 'active':
*script start !varset is_a_active 1
Then try a bang such as this:
*script bang !DriveCycle
*script gotoif ("%{is_a_active}" = "1") make_b_active
; make a active
*script exec !varset is_a_active 1
*script exec !LabelMove LabelA 0 0
*script exec !LabelMove LabelB 200 200
*script exec !varset drives %{drives:_}:%{drives:}
*script exec !LabelSetText LabelB "%{drives:}"
*script goto rest
*script label make_b_active
*script exec !varset is_a_active 0
*script exec !LabelMove LabelB 0 0
*script exec !LabelMove LabelA 200 200
*script exec !varset drives %{drives:_}:%{drives:}
*script exec !LabelSetText LabelA "%{drives:}"
*script label rest
*script ~bang
*script gotoif ("%{is_a_active}" = "1") make_b_active
; make a active
*script exec !varset is_a_active 1
*script exec !LabelMove LabelA 0 0
*script exec !LabelMove LabelB 200 200
*script exec !varset drives %{drives:_}:%{drives:}
*script exec !LabelSetText LabelB "%{drives:}"
*script goto rest
*script label make_b_active
*script exec !varset is_a_active 0
*script exec !LabelMove LabelB 0 0
*script exec !LabelMove LabelA 200 200
*script exec !varset drives %{drives:_}:%{drives:}
*script exec !LabelSetText LabelA "%{drives:}"
*script label rest
*script ~bang
Of course, set all the label texts appropriately and instead of moving them do your transition.
It could get complicated if you wanted to remember the last 'view'. It's because of the setting of the mzscript var to the evar... So replace that *script start !varset drives $drives$ with a call to something (untested) like:
*script bang !DrivesCheck
*script exec !varset temp "%{drives}"
*script exec !varset seen "%{drives:}"
*script label loop
*script gotoif ("%{temp}" = "$drives$") old
*script exec !varset temp %{temp:_}:%{temp:}
*script gotoif ("%{temp:}" = "%{seen}") new
*script goto loop
*script label new
*script exec !varset drives $drives$
*script label old
*script ~bang
*script exec !varset temp "%{drives}"
*script exec !varset seen "%{drives:}"
*script label loop
*script gotoif ("%{temp}" = "$drives$") old
*script exec !varset temp %{temp:_}:%{temp:}
*script gotoif ("%{temp:}" = "%{seen}") new
*script goto loop
*script label new
*script exec !varset drives $drives$
*script label old
*script ~bang
and have the var drives in a varfile.