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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Overriding a trigger
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Overriding a trigger

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Gore   (207 posts)  [Biography] bio
Date Wed 04 Apr 2007 04:29 AM (UTC)  quote  ]
Message
<triggers>
  <trigger
   group="skills-tarot-creator"
   match="^(.*?)$"
   name="ignore_creator"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   send_to="14"
   sequence="2"
  >
  <send>ColourNote ('dimgray', 'white', 'Creator:%1')</send>
  </trigger>
  <trigger
   group="skills-tarot-creator"
   match="(.*?)h\, (.*?)m"
   name="ignore_off"
   regexp="y"
   send_to="14"
   sequence="1"
  >
  <send>EnableTriggerGroup ('skills-tarot-creator', false)</send>
  </trigger>
</triggers>


Can anyone tell me why when ignore_creator is enabled, the omitted lines still fire triggers from a plugin of mine?
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #1 on Wed 04 Apr 2007 05:02 AM (UTC)  quote  ]
Message
I'm not quite sure what you're asking about here. Could you post an example of the output from the mud that you expect triggers to fire on correctly, but they don't?

If what I'm thinking you're asking about is correct though, omitting output does not interfere with a trigger from firing. I have several triggers in various plugins that fire from the same omitted line.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #2 on Wed 04 Apr 2007 05:10 AM (UTC)  quote  ]
Message
Correct, is there anyway to prevent them from firing without actually affecting them at all?
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #3 on Wed 04 Apr 2007 05:48 AM (UTC)  quote  ]
Message
Turning them off is the only way I can think of. And you seem to be doing that with the EnableTriggerGroup call. The only thing i can suggest is to make sure that the script ends up disabling the triggers.

Another question I thought of though... Are the triggers that are tripped in the plugin in the same plugin as the triggers you posted here? If they are not in the same plugin, they will not be able to affect each other, since it's in effect a different system. You might have to shut them off with a CallPlugin call.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Gore   (207 posts)  [Biography] bio
Date Reply #4 on Wed 04 Apr 2007 06:18 AM (UTC)  quote  ]
Message
No, the triggers that I don't want firing are every affliction trigger in my healing system. The trigger that I had hoped would override it was the (.*?) trigger heh.
[Go to top] top

Posted by Nick Gammon   Australia  (19,599 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Wed 04 Apr 2007 06:36 AM (UTC)  quote  ]
Message
The simplest thing might be to disable the plugin, see:

http://www.gammon.com.au/scripts/doc.php?function=EnablePlugin

Then, no triggers in it will fire.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #6 on Wed 04 Apr 2007 06:59 AM (UTC)  quote  ]
Message
Or if it's in the same plugin (or just part of a bigger plugin), just set up a quick script function to disable them one at a time or as a group if they can be clumped together. I've had plenty of weird looking scripts that just turn various triggers on and off.

function init()
  EnableTrigger("qcompletecatcher", false)
  EnableTrigger("notQuesting", false)
  EnableTrigger("tierqpcatcher", false)
  EnableTrigger("luckyqpcatcher", false)
  EnableTrigger("tpcatcher", false)
  EnableTrigger("mccpqpcatcher", false)
  EnableTrigger("anyLine", false)
  EnableTrigger("traincatcher", false)
  EnableTrigger("praccatcher", false)
  gains = {
    ["qp"] = 0,
    ["tp"] = 0,
    ["train"] = 0,
    ["prac"] = 0
  }
end -- init

That just runs through making sure that nothing is triggered to start with aside from the initial trigger, which never gets turned off within the plugin. The whole set of triggers can with a quick command if I decide I don't want my quests tracked at all for a while.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Nick Gammon   Australia  (19,599 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Wed 04 Apr 2007 07:29 AM (UTC)  quote  ]
Message
You could probably save a bit of repetition by making a table of things you want to disable. Then the same table could be used to enable them later.


for _, name in ipairs {
 "qcompletecatcher",
 "notQuesting", 
 "tierqpcatcher", 
 "luckyqpcatcher", 
 "tpcatcher", 
 "mccpqpcatcher", 
 "anyLine",
 "traincatcher", 
 "praccatcher",
} do EnableTrigger (name, false) end


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Reply #8 on Wed 04 Apr 2007 05:29 PM (UTC)  quote  ]
Message
I converted that from Jscript to Lua on the first day that I was learning Lua, so I didn't know about Lua's weird little tricks about applying a whole table to a function. Also, these functions are turned on one by one laster in the script, so it's not terribly efficient to keep them clumped together.

It is much easier to fight for one's ideals than to live up to them.
[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.


3,415 views.

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [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.

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]