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
Miotke
Newbie


Joined: 04 Apr 2012
Posts: 2
Location: Portland, OR

PostPosted: Wed Apr 04, 2012 3:23 pm   

Help changing variables in another session with an alias...
 
Sorry if this is super simple, but I'm still learning CMUD, and having trouble doing this simple task. I searched around and found a lot of examples of more difficult operations, but for some reason I can't get this to work. I had a whole story here of why I need to do this, but you don't care, so I'm chopping it down.

Basically I am on a MUD that allows multiplaying, so I have 4 sessions going simultaneously but I spend most of my time in one particular session.

All 4 sessions have a variable with the same name, @autoheal, and I want to quickly and easily change the value assigned to that variable in any particular session at any time.

So I tried creating 4 variables in the main session that basically just do this:

#ALIAS {fheal} {:F:#VARIABLE autoheal %1}
#ALIAS {mheal} {:M:#VARIABLE autoheal %1}
etc.

However, when I enter 'mheal 400' on the command line in the 'F' session, it assigns 400 to the F session @autoheal, not the M session's.

Help!

Preemptive thank you.

PS - On a related note, does anyone know why I'm able to set variables in another session like this from a trigger, but not within an alias?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Wed Apr 04, 2012 11:40 pm   
 
Try #EXECWIN?
_________________
Discord: Shalimarwildcat
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Apr 05, 2012 4:40 am   
 
Nah, don't use #EXECWIN. #EXEC ad #EXECWIN are slow, and in most cases where one might think to try using them there are alternatives:

#alias mheal {//windowname/class/.../autoheal = %1}

Can use #VARIABLE with the // stuff, too, but I've always preferred using a=b syntax. When you use the // pathing, CMud doesn't bother to go looking for variables in other locations. If the variable doesn't exist/cannot be accessed at that location, you'll end up with a variable in the root level of the window with a name of the explicit path you used, and if CMud actually IS populating a variable located somewhere else then it's a clear indication of data corruption.
_________________
EDIT: I didn't like my old signature
Reply with quote
Miotke
Newbie


Joined: 04 Apr 2012
Posts: 2
Location: Portland, OR

PostPosted: Mon Apr 09, 2012 8:04 am   
 
Thank you Matt, exactly what I needed.
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