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
sda
Wanderer


Joined: 18 Apr 2001
Posts: 55
Location: United Kingdom

PostPosted: Thu Aug 29, 2002 11:26 pm   

Advanced trigger help please?
 
In one of my previous notes, I was warned about people being able to abuse the (%*) parameter to make me quit etc.

This is a complicated pattern, I was wondering if you can see any ways of abusing it? (it will wrap but it is one pattern)

^(*) {tells you|replies|whispers to you|says|asks|asks you|

snarls|sings|joiks|teases you for}{: | }(*){ |}$


The match on (*) instead of (%w) at the beginning is to catch the intermittent > and [E]: that sometimes appear at the beginning of the line, sometimes only one of them, sometimes both together.

I extract a player name from (*) like this:

#VARIABLE healname %word( %trim( %remove( ">", %remove( "[E]:", %lower( %1)))), 1)


The match of (*) instead of (%w) at the end is because sometimes people say 'heal' sometimes 'heal 15' and sometimes 'heal me please' so I just want to match the first word in the rest of the line, but I also want to match the line end, and also there is sometimes a space beore the line end.

I simply extract healtype from (*) like this:

#VARIABLE healtype %lower( %word( %2, 1))


The reason for the ^ and $ patterns is to stop the match on a multiline tell statement.

Thanks very much,
Steve :)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Aug 30, 2002 12:18 am   
 
There is no way to abuse that, but I do not believe it will match when "[E]:" is in the line. Try this instead:
^{>|[E]:|>[E]:|}(%w) {tells you|replies|whispers to you|says|asks|asks you|snarls|sings|joiks|teases you for}{: | }(*)$

You might have to switch the order for when they both appear. That will also eliminate the need for the removes cluttering the script. I also removed the checking of a spaace at the end since you are only interested in the first word of %2 so capturing the space when it is there will not hurt.
Reply with quote
sda
Wanderer


Joined: 18 Apr 2001
Posts: 55
Location: United Kingdom

PostPosted: Fri Aug 30, 2002 12:30 am   
 
Thankyou very much!

Steve :)
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