Simple Trigger

Posted by Toast on Thu 15 Dec 2016 03:48 PM — 9 posts, 33,865 views.

#0
Good morning (or afternoon/evening)!

I have checked out the "Getting started" section with MUSHClient and have been able to make some pretty decent triggers, aliases, and I really like some of the plugins.

However, I found myself stuck trying to create an assisting trigger and I am a bit lost as to what I am doing wrong.

I have set a trigger to find the following string:

Brawl attacks %1.

and I have the trigger command set to do:

kill %2

Am I doing that wrong? I am merely wanting the trigger to attack the same object that Brawl there is attacking. When I try to set this trigger up, it only pushes out the command "kill" with a blank space.

I have checked the forums via search and tried a few different things I've found, but it still isn't working. I'm sure this is something rather simple that I'm just not wrapping my pea brain around, but I thought I'd ask the experts.

Thanks in advance for any assistance.
USA Global Moderator #1
Brawl attacks *.

kill %1
Amended on Thu 15 Dec 2016 05:49 PM by Fiendish
#2
Thanks for the reply Fiendish. I had originally tried that but it fires off a "kill what?" message. It's almost as if it doesn't know what %1 is.

Please see the screenshot - http://imgur.com/a/njP9I

I have also tried this with regular expression unchecked, but that results in no trigger action fired at all.

Thanks again for the assistance.
USA Global Moderator #3
The pattern is not a regular expression and will not work with the regular expression box checked. If it doesn't fire otherwise, then it's not matching because the line doesn't match that pattern.

I just tested

<triggers>
  <trigger
   enabled="y"
   match="Zod attacks *."
   sequence="100"
  >
  <send>kill %1</send>
  </trigger>
</triggers>


with Aardwolf's "echo" test command.

echo Zod attacks potato.
Zod attacks potato.
kill potato


Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
Amended on Thu 15 Dec 2016 09:07 PM by Fiendish
#4
Thanks again, I just tried it and it worked great. I believe it was the regular expression that I had checked (although I thought I had earlier unchecked).

I do have one final question regarding this trigger. Is it possible to have the trigger fire in lower case? If it sees that "Bob attacks Bill", it will fire off the trigger "kill Bill" instead of "kill bill". Oddly, even though I can capitalize the name, the mud doesn't recognize the capitalization.

Thank you again!
USA Global Moderator #5
If you send to Script instead of to World, set your script language to Lua, and then do


Send("kill "..string.lower("%1"))
Amended on Thu 15 Dec 2016 10:41 PM by Fiendish
Australia Forum Administrator #6
Ah yes, that old MUD game feature:


Naga attacks you!

> kill Naga

I see no Naga here.


You can make it lower-case with a bit of scripting:


<triggers>
  <trigger
   enabled="y"
   match="Brawl attacks *."
   send_to="12"
   sequence="100"
  >
  <send>
mobname = "%1"

Send ("kill " .. string.lower (mobname))

</send>
  </trigger>
</triggers>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
#7
I appreciate all of the help guys. Is there any place I can go to learn some scripting and such? I'd be very interested in knowing how to use MUSHClient to its full capacity through scripting.
USA Global Moderator #8
Toast said:

I appreciate all of the help guys. Is there any place I can go to learn some scripting and such? I'd be very interested in knowing how to use MUSHClient to its full capacity through scripting.


You mean besides this forum?

Our preferred scripting language is Lua.
When you tell MUSHclient to send something to script, it hands that over to the Lua language interpreter.

Documentation for the Lua language may be found at https://www.lua.org/pil/contents.html

Though you might also go look at something like http://luatut.com/crash_course.html

MUSHclient also adds a bunch of interaction functions to the Lua language so that you can control MUSHclient from inside your Lua scripts.
Those special functions are listed at https://mushclient.com/scripts/doc.php?general=function_list

I've also compiled lists of links from this forum that I think are particularly helpful in getting familiar with aliases, triggers, variables, and macros in mushclient:

https://github.com/fiendish/aardwolfclientpackage/wiki/Writing-Aliases
https://github.com/fiendish/aardwolfclientpackage/wiki/Writing-Triggers
https://github.com/fiendish/aardwolfclientpackage/wiki/Using-Variables
https://github.com/fiendish/aardwolfclientpackage/wiki/Writing-Macros