|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: 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. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: 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, ", ") |
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: 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.
|
|
|
|
|
|