[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUDs
. -> [Folder]  General
. . -> [Subject]  Help with trigger

Help with trigger

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


Posted by Xandler   (47 posts)  [Biography] 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?
[Go to top] top

Posted by Fiendish   USA  (2,520 posts)  [Biography] 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
[Go to top] top

Posted by Nick Gammon   Australia  (23,003 posts)  [Biography] 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
[Go to top] 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.


7,739 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]