Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Simple Trigger

Simple Trigger

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Toast   (4 posts)  Bio
Date Thu 15 Dec 2016 03:48 PM (UTC)
Message
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.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Thu 15 Dec 2016 05:48 PM (UTC)

Amended on Thu 15 Dec 2016 05:49 PM (UTC) by Fiendish

Message
Brawl attacks *.

kill %1

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Toast   (4 posts)  Bio
Date Reply #2 on Thu 15 Dec 2016 06:09 PM (UTC)
Message
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.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #3 on Thu 15 Dec 2016 09:03 PM (UTC)

Amended on Thu 15 Dec 2016 09:07 PM (UTC) by Fiendish

Message
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.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Toast   (4 posts)  Bio
Date Reply #4 on Thu 15 Dec 2016 09:53 PM (UTC)
Message
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!
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #5 on Thu 15 Dec 2016 10:32 PM (UTC)

Amended on Thu 15 Dec 2016 10:41 PM (UTC) by Fiendish

Message
If you send to Script instead of to World, set your script language to Lua, and then do


Send("kill "..string.lower("%1"))

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 15 Dec 2016 10:35 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Toast   (4 posts)  Bio
Date Reply #7 on Thu 15 Dec 2016 11:23 PM (UTC)
Message
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.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #8 on Fri 16 Dec 2016 01:26 AM (UTC)

Amended on Fri 16 Dec 2016 10:54 AM (UTC) by Fiendish

Message
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

https://github.com/fiendish/aardwolfclientpackage
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


23,959 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.