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
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Mon Jul 19, 2004 10:52 pm   

Help with ismember and trigger reductions
 
Alright, I play achaea, and I color the names of those who are my enemies... As of now I have a bunch of individual triggers set to color each name, what I want to do is put those names in a list variable and make a single trigger to work to color the names ANY time they appear... can this be done? One instance would be on the WHO list:

Nephcir, Tolaria, Kottke, Fulcrum, Constinence, Halia, Mavik, Siaran, Ariadne,Torn, Cenadrak, Istavan, Zythe, Aragor, Meiros, Rontar, Bainz, Miric, Keltarrn, Mendar, Nihltas, Larkin, Rystal, Wolfacill, Aneila, Alynnia, Lepida, Maeko, Caz, Vieral, Tael, Vymos, Jinga, Belafon, Ixthkin, Hylonomus, Soahar, Eirefal, Agrias, Ydachikachishiroul, Dethea, Janiv, Mayaserenia, Hrael, Laorir, Jamethiel, Kazekaoru, Gerohold, Rumius, Delliah, Laze, Maybelle, Gulnic, Greyda, Sunter, Aydlithian, Coptimus,


Which looks much like that, other times would be in passing such as if they enter the room or are even spoken about...


HELP! If it can be done please tell me how!
Reply with quote
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Tue Jul 20, 2004 12:28 am   
 
This particular forum is about features/bugs/questions about the new forum system.

If a moderator can bump this to the appropriate group or you could repost in the zMUD General Discussion Forum that'd be great.
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Jul 21, 2004 1:30 am   
 
Combining multiple triggers into one with a string list is useful for certain scenarios, but not something like the QWHO list. That one trigger will only fire once per line, so if you have two or more names to match on any given line, you'll only get one of them. I know. I used to do a buddy list using a string list and it often missed names. Switching to individual triggers for the names solved this problem, and I just keep the folders disabled until I execute QWHO.
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Wed Jul 21, 2004 3:24 pm   
 
While Larkin is right that combining may not always work, your question is valid, and the answer may be something you want to use elsewhere. Here's the solution you're looking for:

Begin with a string list (or 2 or 3) of names you want to highlight, using the pipe delineater:
Quote:
Friends = Bob|Jane|John


Then create a trigger to fire on the list, using {} to tell zMUD that the variable contained is a list (the double {{}} is intentional):
Quote:
#TR {{@Friends}} {#CW white}


When you run across someone that you want to add to the list of highlights, use the #ADDITEM command:
Quote:
#ADDITEM Friends Joe


Personally, I have several different highlight lists, for different guilds and/or races, that color differently. I have a simple alias for adding new names:
Quote:
namechoices = {Bard|Cleric|Ranger|Empath|MM|Barb|Thief|Trader|Gnome|GM|Paladin|WM|Kaldar}
#ALIAS add {
#IF (%ismember( %2, @namechoices)) {#ADDITEM %2 %1} {
#SH Syntax~: ADD (Name) (group)
#SH Name groups~: @namechoices
}}


I hope this helps!
_________________
.geniusclown
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Thu Jul 22, 2004 5:40 am   
 
thanks GC, helped alot, I have one more question though, one of the skills I have allows me to see people who enter my area of attacking range. It shows their names and titles as well so it makes triggering certain events based on who enters a little difficult. The line could look like this:

Joe has entered the area.

OR this:

Genius Joe Schmoe has entered the area.

Both of these meaning the same person but that person has changed his title. Is there anyway to isolate 'Joe' and make it say.. change a variable (my targetting variable) based on that name?
Reply with quote
Apollyon
Wanderer


Joined: 02 Oct 2001
Posts: 76
Location: USA

PostPosted: Thu Jul 22, 2004 5:48 am   
 
try

#trigger {^Joe (*)has entered the area.} {DoNaughtyThingsTo Joe) {KillPeopleClass}

or

#trigger {(*)Joe (*)has entered the area.} {DoNaughtyThingsTo Joe) {KillPeopleClass}

i think that if there is a name before Joe like Genius that you have to use the second one, no first name the first. i think that the second one my be universal though... give it a shot, i know it will set off your trigger tho
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 6:14 am   
 
Thanks Apollyon, but I was actually looking to do it with the string list variable created and used via GC's method...

Anyone have any idea??
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 8:05 am   
 
Alright I got the trigger line to work off the string list variable, however my next question is how do I isolate WHICH item on the list was the one that set off the trigger and make it tell me that? here is the pattern:

(*){@enemies}(*)has entered the area.

the commands on that are to highlight the line and then i need it to do something like this:

say (whoever the enemy is) in the area!
((and then set my target variable to that name))


any idea?
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Fri Jul 23, 2004 9:09 am   
 
#trigger {({@enemies})*has entered the area.} {#say %1 is in the area!;#var Target %1}
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 9:13 am   
 
tried that, doesn't register @enemies as a %1 variable...
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Fri Jul 23, 2004 9:22 am   
 
It isn't the same trigger as the one you posted. I added a pair of brackets around the {@enemies}. This will set the matching value of @enemies to the %1 variable.
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 9:26 am   
 
the brackets were already there in my trigger and i tried your way as well, not working
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Fri Jul 23, 2004 10:04 am   
 
I'll show you how it works, then. Put all this in the command line:

#var Enemies {Danlo}
#trigger {({@enemies})*has entered the area.} {#col Red;#say %1 is in the area!;#var Target %1}
#say Danlo has entered the area.
Reply with quote
quicksilver85
Beginner


Joined: 16 Jan 2004
Posts: 15
Location: USA

PostPosted: Fri Jul 23, 2004 10:30 am   
 
I don't know why, but now it works. The only thing I changed was the * at the beginning... thanks Danlo
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 23, 2004 4:59 pm   
 
quicksilver85 wrote:
{@enemies}

Danlo wrote:
({@enemies})

Danlo's pattern has () around the stringlist. As explained in the help topic Pattern Matching, () are used in trigger patterns to designate which portions of a matched pattern should be used for %1-%99. Since Danlo included the stringlist inside a set of ()'s, the match from that variable is available as a numbered parameter.
_________________
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
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