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
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Sat Jul 30, 2011 1:17 am   

Local vars in multi-state triggers?
 
Is it possible to use local variables in multi-state triggers, preserving them across state changes? I'm not sure about the actual scoping of these persistent but segmented objects, or how to incorporate the variable definitions into the xml.
Reply with quote
shalimar
GURU


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

PostPosted: Sat Jul 30, 2011 1:30 am   
 
well.. yes and no
local variables will need to be redefined in each state they get used in, but with the %t1-%t99 variables, you should be able to access the various patterns from previous states
_________________
Discord: Shalimarwildcat
Reply with quote
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Sat Jul 30, 2011 1:51 am   
 
the %t1-99 variables are what I'm after. Won't they get overwritten by backreferences in each successive state?

For example, pattern1 matches "foo" and saves to %t1.
Then pattern2 matches "bar" - will this be saved to %t2, or overwrite %t1?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Jul 30, 2011 1:53 am   
 
The %t# variables are cumulative. If you have 3 wildcards in the first state, the first wildcard in the second state will be saved to %t4 (and %1, within that state).
Reply with quote
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Sat Jul 30, 2011 1:57 am   
 
Thanks. I read about the %t vars in the helpfile, but didn't understand it right away, and couldn't find the reference again.
Reply with quote
shalimar
GURU


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

PostPosted: Sat Jul 30, 2011 2:14 am   
 
its in the predefined variables section... there is a link to it on #HELP #TRIGGER, or you can search for it
_________________
Discord: Shalimarwildcat
Reply with quote
Hazram
Wanderer


Joined: 24 May 2005
Posts: 71

PostPosted: Sat Jul 30, 2011 2:19 am   
 
found it, thanks again.
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