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
Ruderion
Novice


Joined: 12 Jan 2003
Posts: 33
Location: Netherlands

PostPosted: Mon Mar 21, 2005 3:12 pm   

text replace trigger
 
i want to expand the who-list of the mud with some additional information like the temple/clan the character is in. I could make a trigger for every single person i know but i was looking for a way to do it all in one trigger if that is possible. (by storing data in string-lists or whatever)

This is a single trigger that i have right now and that works:
#TRIGGER {(PK) ~]*Tommy} {#psub {"Mischief"} %x1}

This is a sample of part of the who list
[ M Human PK ] Baron Xyan
[ M Hlfln PK ] Citizen Tommy Longbottom, The Lucky Halfling
[ M Durgr PK ] Termas
[ F Drow ] Sarzz
[ M Human PK ] Coran, rugged Hunter of the Conclave

What i want to do is trigger on the name and replace the 'PK' with the clan the person is in. I don't mind putting names and clans in variables manually. If anyone can point me in the right direction to accomplish this i would appreciate it very much.
_________________
Ruderion
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Mar 21, 2005 4:23 pm   
 
Code:
#CLASS {Test}
#VAR membersClans {}
#ADDKEY membersClans {Tommy=HoT|Rick=M_N|Steve=SR}
#VAR members {Tommy|Rick|Steve}
#REGEX {^\[ \a{1} \a+ (PK) \] (?:.*?)(\b@members\b)} {#psub {%db(@membersClans,%2)} %x1}
#CLASS 0


This should do the trick.
The membersClans variable is a record variable whos keys are the people you're interested in and whos values are the corresponding clans.
The members variables is a list variable containing all the people you're interested in.

Based on the code above if we recieved this from the mud:
[ M Hlfln PK ] Citizen Tommy Longbottom, The Lucky Halfling
it would be changed to this:
[ M Hlfln HoT ] Citizen Tommy Longbottom, The Lucky Halfling

p.s. the reason I use #ADDKEY to construct the membersClans variable
is that the ascii characters that is used to delineate record variables arent visible, so the addkey is just an easy way to allow you to copy and paste the code without losing any information.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Ruderion
Novice


Joined: 12 Jan 2003
Posts: 33
Location: Netherlands

PostPosted: Mon Mar 21, 2005 6:38 pm   
 
Thanks with a little tweaking of the regular expression i got it to work. Razz
_________________
Ruderion
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