Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
elucid8
Newbie


Joined: 25 Apr 2008
Posts: 6

PostPosted: 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?
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net