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 ➜ Trigger wildcards having trouble

Trigger wildcards having trouble

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


Posted by Mudgaming4life   (2 posts)  Bio
Date Sat 30 Jan 2016 05:53 PM (UTC)
Message
I'm having trouble with using wild cards in this specific instance of entering a room with 1 mobile vs entering with 2+. A coma gets added if there is more than 1 and it messes up my script.


This is with 1 mobile in it.

Also here: a beastly fido

So my trigger is just:

Quote:
<triggers>
<trigger
enabled="y"
match="Also here: *"
sequence="100"
>
<send>steal %1</send>
</trigger>
</triggers>


But it won't work if there are more than 1 mobile in the room it will send steal <all mobiles listed after Also here:>

So when I make a new trigger to deal with this issue it only works if there are multiple mobiles in the room.

Quote:
<triggers>
<trigger
enabled="y"
match="Also here: *, *"
sequence="100"
>
<send>steal %1</send>
</trigger>
</triggers>


I've been trying to learn more like making variables and using if statements but I'm just not grasping it completely.

also turning groups of triggers on/off is hanging me up so I usually just copy the group manually then delete it when I don't use those triggers and then later to repaste them in my trigger folder when I'm ready to use them again. How do I check to see if a group of triggers is on/off manually?


I've got a ton of questions but I'll stop right here so I won't get confused with answers! Thanks in advance for your time!
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 30 Jan 2016 08:50 PM (UTC)
Message
To handle multiple mob names, you can do some post-processing in Lua, like this:


<triggers>
  <trigger
   enabled="y"
   match="Also here: *"
   send_to="12"
   sequence="100"
  >
  <send>

for mobname in string.gmatch ("%1", "%a+") do
  Send ("steal ", mobname)
end -- for loop</send>

  </trigger>
</triggers>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.





Quote:

How do I check to see if a group of triggers is on/off manually?


You loop through the group and see if they are on or off. It sounds bad, but is only a couple of lines of code. I'm sure this has been asked before, try searching for it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


9,118 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.