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
Mephistopholies
Newbie


Joined: 03 Jun 2006
Posts: 5

PostPosted: Sat Jun 03, 2006 12:06 am   

Sorry I have to ask this, but
 
Hello,

I read through help files and searched the forums, but I don't seem to get the basics :/

Please explain exactly, step by step I should do to get the following:

Playerx says 'pheal' //Pheal would be a trigger for my cleric!
cast 'power heal' playerx //Playerx is the variable!


IE, if playerz or playerxya said 'pheal', it would trigger my cleric to cast 'power heal' on whomever said it.


Thanks!
-Meph
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jun 03, 2006 1:23 am   
 
You would do this with a trigger. The trigger would need to match the line from the MUD that shows some player saying to you "pheal". Now, since you need this to work with different player names and you need it to remember which player asked you for the power heal, you would use a pattern like this one:

^(%w) says 'pheal'$

Let's look at the different parts of this pattern. First, the ^ tells zMUD that the text from the MUD that will make this trigger fire must appear at the start of a line. Next we have the (%w). %w is a wildcard that tells zMUD to match any word (i.e. one o more alphabetic characters with no spaces between them). The %w is surrounded in parenthesis so that whatever word is matched by it will be available to the commands of that trigger. Finally, the $ tells zMUD that the text from the MUD that will make this trigger fire must be the last text in the line, nothing else can come after it. The ^ and $ are used for added protection, so that someone is not able to trick zMUD into executing the trigger by sending you a tell, for example.

Now that we have the pattern, we need the commands that will be executed when the trigger fires. For this part you would use the following:

cast 'power heal' %1

The %1 refers to the text matched by the first thing surrounded by parenthesis in the pattern. In this case, this would be the %w which matches the name of the player requesting the power heal.

Try this out and see how it works. Then read the topic in the help file introducing triggers. With this example perhaps you'll be able to understand triggers a bit better.
_________________
Kjata
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Sat Jun 03, 2006 1:25 am   
 
#TRIGGER {(%w) says 'pheal'} {cast 'power heal' %1}

Edit: Kjata beat me by 2 mins, with a better explanation
Reply with quote
Mephistopholies
Newbie


Joined: 03 Jun 2006
Posts: 5

PostPosted: Sat Jun 03, 2006 5:15 am   
 
Ah, I understand now!

Thanks very much! Cool

-Meph
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