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
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 04, 2008 8:07 pm   

dynamic variables
 
Is there a way to make a variable that can hold content, but only expand when needed?

Here's an example of what I want to do...

in my MUD, there's a command called "where", when you type "where" with no argument, it gives you a list of the visible players in the area. I want to make a trigger that gives me an alert whenever a certain player is in my "where" (which will be fire off as a timed trigger).

Here's the problem... the players I'm watching out for may be different all the time.

So I want to make it so I can have an alias where I enter information into the variable depending on what I need, so something like:

Warning: <player name>

but, because there may be more than one...

Warning: <player name>, <player name>, <player name>, ...

Then I can make a trigger to capture "where" which also needs to be expandable, then make an expression that compares each value against each value.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Apr 04, 2008 8:22 pm   
 
Yes, there is a way. All variables do exactly what you want, a string list would likely be the easiest way to do it. See the help for #ADDITEM and check out the related commands and functions.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
shalimar
GURU


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

PostPosted: Fri Apr 04, 2008 8:26 pm   
 
assuming you have a list made with who all is in your where.. manually change your warning list as needed like:

$warningList="name1|name2|ect"
#FORALL $whereList {#IF (%ismember(%i, $warningList)) {#ECHO {<color tomato>Warning!: </color>%i}}}
_________________
Discord: Shalimarwildcat
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Fri Apr 04, 2008 8:45 pm   
 
Code:
#VAR watch_out_for_these_guys {Bob|Tom|Joe}
#SHOW %ansi(red, white)"Warning: "%expandlist(@watch_out_for_these_guys, ", ")
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Fri Apr 04, 2008 9:02 pm   
 
Thanks, I assumed it might be that way. I'll look into it when I have some time.
_________________
Listen to my Guitar - If you like it, listen to more
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