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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
RasmusKL
Newbie


Joined: 05 Sep 2004
Posts: 3

PostPosted: Sun Sep 05, 2004 12:09 am   

Funny variable thingy...
 
I have stuff for setting vars on and off.. Toggles for things like rescuing and such..

Have an alias "toggle":
#if (@%1) {#var %-1 0;#show %proper( %-1) off.} {#var %-1 1;#show %proper( %-1) on.}

Now, I have a var named "guild", which represents the guild of the current char I'm playing, in this example it'll just have the value "sorc".

Now, I wanted to have guild-specific toggles, so I made an alias "guildtoggle":
toggle %concat(@guild, %1)

However this doesn't work.. For some reason.. I get:

Cmd: guildtoggle targeting
Sorctargeting off.
Cmd: guildtoggle targeting
Sorctargeting off.
Cmd: guildtoggle targeting
Sorctargeting off.
Cmd: guildtoggle targeting
Sorctargeting off.

However, if I use the normal toggle, with the "sorctargeting" argument I get:
Cmd: toggle targeting
Sorctargeting off.
Cmd: toggle targeting
Sorctargeting on.
Cmd: toggle targeting
Sorctargeting off.
Cmd: toggle targeting
Sorctargeting on.

Hm.. Seems very odd to me :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 05, 2004 5:23 am   
 
Don't use %-1 as a variable name. %-1 can include multiple words which isn't desirable. Use %1.

Your problem has to do with variable expansion/evaluation. Do it the "easy" way: Instead of calling the 'toggle' alias, write 'guildtoggle' as a standalone script.
#AL guildtoggle {#IF (@{@{guild}%1}) {#VAR {@{guild}%1} 0;#SAY @{guild}%1 off} {#VAR {@{guild}%1} 1;#SAY @{guild}%1 on}}
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
RasmusKL
Newbie


Joined: 05 Sep 2004
Posts: 3

PostPosted: Sun Sep 05, 2004 11:55 am   
 
Tried to make that alias you wrote there, I get the same result as calling toggle :)

cmd: guildtoggle targeting
sorctargeting on
cmd: guildtoggle targeting
sorctargeting on
cmd: guildtoggle targeting
sorctargeting on

...
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 05, 2004 7:50 pm   
 
That's too bad. It works for me, I tested it before I posted it. I also just tested it again and it still works.

It's not hard to "make that alias". All you have to do is use your mouse to copy the entire alias and then paste it into your command line. Press the ENTER key and the alias is made. You can then use the Settings Editor to change its name or make any other changes you might want.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
RasmusKL
Newbie


Joined: 05 Sep 2004
Posts: 3

PostPosted: Sun Sep 05, 2004 10:18 pm   
 
Which was exactly what I did, hmm, well, if it works with you, it must be something else conflicing.. Guess I'll try and figure it out.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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