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.
 Entire forum ➜ MUDs ➜ General ➜ Help with trigger

Help with trigger

Posting of new messages is disabled at present.

Refresh page


Posted by Xandler   (52 posts)  Bio
Date Sun 04 Jul 2021 03:16 AM (UTC)

Amended on Sun 04 Jul 2021 08:31 PM (UTC) by Fiendish

Message
I am trying to work on this trigger so it happens before I move onto the next room and not get hit by the NPCs, but I can't seem to quite figure it out. Currently it stands as such

<triggers>
<trigger
   enabled="y"
   expand_variables="y"
   group="mobstomove"
   match="You let everyone know that you're ready."
   regexp="y"
   send_to="12"
   sequence="100"
>
<send>

   if @ppl &lt;= 60 then
      Execute ("tranquil")
      Send ("power up")
      Send ("power up")
      Send ("power up")
      Send ("power up")
      Send ("power up")
      Send ("sense @target")
   else
      Send ("sense @target")
   end

   if @pki &lt;= 15 then
      Execute ("tranquil")
      Send ("Swallow senzu")
      Send ("sense @target")
   else
      Send ("sense @target")
   end

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


This is causing it to double send the sense line on the match trigger (which I don't want, I want it to fire once regardless). If one variable is less than or equal to 60, it executes the alias then sends power up 4 times, then senses the target, else if pki is less than or equal to 15 it executes the alias, then swallows the bean and then sense the target variable, otherwise it just senses the target variable if neither are true. Do I have this written out backwards? I have it written out on a different trigger and it works well (I want it on a different trigger because sometimes I get hit and it doesn't work properly).

The working trigger is:


<triggers>
<trigger
   back_colour="8"
   enabled="y"
   expand_variables="y"
   group="mobstomove"
   match="Visible Exits:"
   match_back_colour="y"
   send_to="12"
   sequence="100"
>
<send>

   if @ppl &lt;= 60 then
      Execute ("tranquil")
      Send ("power up")
      Send ("power up")
      Send ("power up")
      Send ("power up")
      Send ("power up")
   else
      EnableTriggerGroup ("mobstokill", true)
      EnableTrigger ("moveto", true)
   end

   if @pki &lt;= 15 then
      Execute ("tranquil")
      Send ("swallow senzu")
      EnableTriggerGroup ("mobstokill", true)
      EnableTrigger ("moveto", true)
   else
      EnableTriggerGroup ("mobstokill", true)
      EnableTrigger ("moveto", true)
   end

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


I imagine this is double firing as well, but it's just turning on groups so I don't see it. How do I do about fixing the first trigger? Am I missing something simple?
Top

Posted by Fiendish   USA  (2,533 posts)  Bio   Global Moderator
Date Reply #1 on Sun 04 Jul 2021 06:20 PM (UTC)

Amended on Sun 04 Jul 2021 08:33 PM (UTC) by Fiendish

Message
Quote:
If one variable is less than or equal to 60, it executes the alias then sends power up 4 times, then senses the target, else if pki is less than or equal to 15 it executes the alias, then swallows the bean and then sense the target variable, otherwise it just senses the target variable if neither are true.

This is not what you've done, though. There's no "else" between your two variable conditions. Look at the placement of your ifs elses and ends. It will help following the logic if you use proper indentation and blank lines between sections.

[EDIT] I've edited your post to include sensible indentation and line breaks for you. Hopefully now you can see how your description does not match the code you wrote.

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

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 04 Jul 2021 07:47 PM (UTC)
Message
You can do a "return" in your logic if you don't want it to do anything after a particular point.

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


8,995 views.

Posting of new messages is disabled at present.

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.