Triggers...

Posted by Jquon on Wed 12 Jan 2011 01:26 AM — 11 posts, 37,126 views.

#0
. I am trying to set up a trigger so that whenever someone pokes me, my trigger will send a heal to them. Is this possible? Like it will says "so and so pokes you in ribs" and I want it to send back "treat serrious so and so"
Australia Forum Administrator #1
Certainly it's possible.

Try reading this post:

http://www.gammon.com.au/forum/?id=8086

That's all about making simple triggers like that. Just change the words and you'll have it.

Also try browsing some of the other "getting started" posts.
Australia Forum Administrator #2
Can we please stick to one thread? You have now started three threads on this subject.

To match:


so and so pokes you in ribs


You need to match on:


* pokes you in ribs


To use that name in your response you would send:


treat serious %1


This is because %1 is replaced by whatever matches the first wildcard.

http://www.gammon.com.au/mushclient/funwithtriggers.htm
#3
Would a multi line trigger run off of; You have recovered balance, and below it your health bar?
Australia Forum Administrator #4
It should, although multi-line triggers are slightly fiddly to get working. For one thing they have to be regular expressions.

Depending on how confident you are, it might be simpler to have the trigger "You have recovered balance" just set a flag, eg.


balance = true


And then have your prompt (health) trigger check that variable.

eg.


if balance then
  Send ("sip wine")
end


Of course you need a third trigger to notice when you have lost balance, eg.


balance = false

#5

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="*/*h */*m 0e 0w *x e-pp&gt; bd&gt;&gt;"
   send_to="12"
   sequence="100"
  >
  <send>balance = false</send>
  </trigger>
</triggers>

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="*/*h */*m 0e 0w *x ebpp&gt; bd&gt;&gt;"
   send_to="12"
   sequence="100"
  >
  <send>balance = true</send>
  </trigger>
</triggers>


<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="*/*h */*m 0e 0w *x ebpp&gt; bd&gt;&gt;"
   send_to="12"
   sequence="100"
  >
  <send>local_health = %1
max_health = %2
local_mana = %3
max_mana = %4

if health / max_health &lt;= 0.15
then
  Send ("touch crystal")
end -- if</send>
  </trigger>
</triggers>




I can't get this to work, what's the issue?
Amended on Tue 25 Jan 2011 08:42 PM by Nick Gammon
Australia Forum Administrator #6
We can't help you debug your triggers if you don't post the MUD output that you are trying to trigger on. Saying "I can't get this to work" doesn't tell us much. For example, is one trigger firing but not another one? You can edit each trigger individually to see if it has fired or not. You can also use the Summary plugin to see a summary of what you are doing and then "drill down" to the individual triggers to see how many times each one fired.

Template:summary

Please provide a summary of your world configuration:

  • Either use the scripting Immediate window (Ctrl+I) to execute: Debug ("summary")

    or

  • Install the Summary plugin (see "Summary" feature) and type "summary"

Then copy the resulting information from the output window, and paste into a Forum message.

You need version 4.55 onwards of MUSHclient to do this.

#7
easier to set it up on a macro so I did. However if I want something sent based on several true or false statements what would it looke like this;

if balance
if equilibrium
if prone
Send ("impale " .. target)
end


Or is that totally off?
Australia Forum Administrator #8
In Lua it would be:


if balance and equilibrium and prone then
  Send ("impale " .. target)
end  -- if


#9
Are all the true/ false sent to script along with the main trigger? I ask because that is what I have set up and it isn't firing.
Australia Forum Administrator #10
Yes they are. The script part looks OK as far as I can see, but if the triggers aren't firing it doesn't really matter what the script does.

As I said before, you need to post your MUD output before I can comment on why the trigger may or may not be firing. Otherwise it is just pure guesswork.