|
elucid8 Newbie
Joined: 25 Apr 2008 Posts: 6
|
Posted: Tue May 27, 2008 7:49 pm
Local Variable Problem |
I am trying to make an alias to switch out a shield that has the same name but different properties so that every time I type the alias, lets call it shield, it will switch back and forth between them. Now this can be done pretty easily like this:
#var isOn;
#al Shield {#if (isOn==1) {get thisShield bag;wear thisShield;put otherShield Bag;isOn=0} {get otherShield Bag;wear otherShield;put thisShield bag;isOn=1} }
Now that works fine. What I don't know is how a local variable could be used to accomplish the same task. I don't know how one would go about this - can anyone help? |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Tue May 27, 2008 8:39 pm |
If you are thinking about using a local variable in the place of isOn it will not work sorry.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed May 28, 2008 3:13 am |
Arminas is right. Local variables are only valid for the current script. They're useful for times when, in the past, you'd use a variable called @temp or something.
In this case, you want a value to be stored once the script's finished running, so the script can test it next time. And local variables are lost once the script stops running. |
|
|
|
|
|