Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
webwired
Beginner


Joined: 22 Dec 2010
Posts: 18

PostPosted: Wed Dec 22, 2010 7:54 pm   

Healer Trigger
 
Hi everyone... I was wondering if I could get a little help with my healer trigger...

Code:
Pattern:
(%w) says 'heal'

Script Text:
cast 'cure critical' %1


That all works fine and dandy, but what I'd like to have it do is check to see if the person is completely healed and cast the spell again if they are not completely healed...

Something like:
Code:
cast 'cure critical' %1;
glance (%w);
if{??? != "(%w) is in perfect health."} cast 'cure critical' %1


Any ideas? Of course I'll probably end up having to do something about just in case the person ends up dying while I'm healing them and they're just a corpse...
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Dec 22, 2010 8:45 pm   
 
You might be able to do this as a multistate trigger. Execute the glance command in the first state, and have the pattern of the second state be set to match the text returned from the glance command. However, from what little information you have provided, that won't work easily since the text returned from the glance command may have a wide range of texts. A common way to deal with this is to use multiple triggers:
Create a trigger with the pattern "(%w) says 'heal'"
In this trigger, execute the glance command
Also in this trigger, execute "#T+ healclass"
Create a class "healclass"
Within healclass, create a new trigger with pattern "(%w) is in perfect health."
Within this second trigger, execute the cast cure critical
Within healclass, create a trigger for your prompt, or for some text which always concludes the output of glance, which executes "#T- healclass"
Set the class healclass to disabled.
Set the class healclass to default to disabled on startup.

One advantage of this method is that you can add other triggers within healclass to do other things if glance returns other values.
Reply with quote
RadTopHat
Newbie


Joined: 20 Dec 2010
Posts: 3

PostPosted: Wed Dec 22, 2010 8:52 pm   
 
For starters, arn't the target of the spell and the glance the same? Therefore wouldn't you just use %1 for both?

Now I personally would create a second trigger.

You need to find something static in the results of a glance to base the second part of the trigger off, that may or may not be easy.
Lets work with my example here and say your glance results in only 1 line which could be the follow...

Bob is in perfect health.
Bob is not doing so well.
Bob is bleeding from the ears.

Then I would use...

<trigger>
<pattern>(%1) is &amp;VARIABLE</pattern>
<value>#IF (@VARIABLE =~"in perfect health.") {#send Smile %1} {#send cast 'cure critical' %1;glance %1}
</trigger>

So if he is fine, you smile at him, if he is anything else you cast and glance at him again to check if that did the job.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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