|
Ruderion Novice
Joined: 12 Jan 2003 Posts: 33 Location: Netherlands
|
Posted: 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 |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: 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." |
|
|
|
Ruderion Novice
Joined: 12 Jan 2003 Posts: 33 Location: Netherlands
|
Posted: Mon Mar 21, 2005 6:38 pm |
Thanks with a little tweaking of the regular expression i got it to work.
|
|
_________________ Ruderion |
|
|
|
|
|