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 reacting to itself / looping

Trigger reacting to itself / looping

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


Posted by Natasha   (3 posts)  Bio
Date Thu 31 Jan 2019 12:16 AM (UTC)

Amended on Thu 31 Jan 2019 12:22 AM (UTC) by Natasha

Message
I have a problem with my trigger.
Basically, when I try to cast a spell, it has a chance to fail (resulting in "You lost your concentration!" message in output). I want the trigger to re-cast the spell until it succeeds.
Currently, it reacts to the message and also casts the spell without a problem.
The problem is that it doesn`t react to the message once it has been fired (or rather the message this trigger caused).
Here is the trigger:

<triggers>
  <trigger
   enabled="y"
   group="Casting"
   keep_evaluating="y"
   match="You lost your concentration!"
   name="spellAutoRetry"
   send_to="12"
   sequence="100"
  >
    <send>
       activeSpell = GetVariable('activeSpell')
       Send("cast '" .. activeSpell .. "'")   
    </send>
  </trigger>
</triggers>

EDIT:
I have "activeSpell" variable declared in MUSHClient, it holds the name of the spell I want to re-cast
Top

Posted by Fiendish   USA  (2,541 posts)  Bio   Global Moderator
Date Reply #1 on Thu 31 Jan 2019 05:08 PM (UTC)

Amended on Thu 31 Jan 2019 05:09 PM (UTC) by Fiendish

Message
The trigger doesn't cause messages. The trigger sends a command to the server. Whatever happens after that is a whole new sequence of events. If your trigger isn't matching what comes back, then either the pattern has changed or the trigger or trigger group has been disabled by something else. Can you show a full copy-paste from the game of you casting a spell, the trigger catching the concentration failure, recasting, and then failing to catch the next concentration failure? That would help rule out whether the pattern needs to be changed.

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

Posted by Natasha   (3 posts)  Bio
Date Reply #2 on Thu 31 Jan 2019 07:32 PM (UTC)

Amended on Thu 31 Jan 2019 07:34 PM (UTC) by Natasha

Message
Thanks for your swift reply.
I also disabled all timers, alliases and triggers to rule out the "interference" problem.

Here is the output:

[AFK] 741H 3010M 1083V (100) 0TNL>
cast 'create food'
You lost your concentration!
cast 'create food'

[AFK] 741H 3007M 1083V (100) 0TNL>You lost your concentration!

[AFK] 741H 3004M 1083V (100) 0TNL>
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 31 Jan 2019 08:07 PM (UTC)

Amended on Thu 31 Jan 2019 08:08 PM (UTC) by Nick Gammon

Message
You are matching on "You lost your concentration!"

This won't match on:


[AFK] 741H 3007M 1083V (100) 0TNL>You lost your concentration!


There is stuff in front of "You".

You could change the trigger to match on:


*You lost your concentration!

- Nick Gammon

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

Posted by Fiendish   USA  (2,541 posts)  Bio   Global Moderator
Date Reply #4 on Thu 31 Jan 2019 08:45 PM (UTC)

Amended on Thu 31 Jan 2019 08:49 PM (UTC) by Fiendish

Message
IMO instead of changing the match pattern you should change your prompt line to end in a carriage return. Triggers are much safer when you can reliably choose to only match at the start of a line. It makes misfires much less likely. If you change your match pattern to start with * then anyone can screw with your trigger just by talking.

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

Posted by Natasha   (3 posts)  Bio
Date Reply #5 on Thu 31 Jan 2019 09:38 PM (UTC)
Message
Thanks a lot - it works (It was the prompt).
Sorry for bothering you with such a thing.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 31 Jan 2019 11:04 PM (UTC)
Message
Fiendish has an excellent point. If the MUD lets people emote things, someone could emote. "You lost your concentration!" which would make your trigger fire.

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


17,720 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.