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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Scripting through triggers? - Newbie Question.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Scripting through triggers? - Newbie Question.

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


Posted by Mick   (3 posts)  [Biography] bio
Date Mon 29 Mar 2010 09:00 AM (UTC)
Message
Being totally newb, I'd like a simple way of enabling and disabling triggers.

I have a trigger that functions upon npc death (label is deathtrig) and works. I have a second trigger that can proc upon low hp (label is bleeding). I would like to disable deathtrig upon bleeding proc.

Could this be achieved by adding

EnableTrigger("deathtrig", false)

to the trigger "send" box under send to 'script' or am I totally off base?

Cheers in advance.
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 30 Mar 2010 12:13 AM (UTC)
Message
Yes that's the way to do it. Try it and see anyway, no harm will come of it.

- Nick Gammon

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

Posted by Mick   (3 posts)  [Biography] bio
Date Reply #2 on Tue 30 Mar 2010 09:53 AM (UTC)
Message
Nick Gammon said:

Yes that's the way to do it. Try it and see anyway, no harm will come of it.


[string "Trigger: deathtrig"]:1: unexpected symbol near '<'

Made a script file (blank), scripting enabled. The ctrl+shift+8 trigger box doesn't like -

<triggers>
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
match="^(.*?)the nearby scrap\!$"
name="deathtrig"
regexp="y"
sequence="100"
>
<send>k junk</send>
</trigger>
</triggers>

- put in its box. Also have other errors relating to missing functions and subroutines.

[string "Trigger: deathtrig"]:1: '=' expected near 'junk'

I did play around with it before asking here :(
[Go to top] top

Posted by Nick Gammon   Australia  (21,323 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Wed 31 Mar 2010 04:09 AM (UTC)
Message
Huh? Read this:

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

- Nick Gammon

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

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #4 on Wed 31 Mar 2010 05:47 AM (UTC)
Message
As a side question to this, is it possible to use a method similar to this that disable triggers by their group name?
[Go to top] top

Posted by Mick   (3 posts)  [Biography] bio
Date Reply #5 on Wed 31 Mar 2010 06:14 AM (UTC)
Message
AaronM86 said:

As a side question to this, is it possible to use a method similar to this that disable triggers by their group name?


http://www.gammon.com.au/scripts/function.php?name=EnableGroup

Lua example:
EnableGroup ("groupname", true) -- enable the group
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #6 on Wed 31 Mar 2010 07:07 AM (UTC)
Message
Is it possible to put a trigger inside a Lua script file and have it fire or call a function as if I were Clicking Add and making a trigger through world configuration. Like if I put this into my script file:

<triggers>
<trigger
enabled="y"
group="Channels"
match="* shouts '*'"
omit_from_output="y"
script="redirect"
sequence="100"
>
</trigger>
</triggers>

Is this doable? I tried it but my methods seem to keep giving me errors... I load and re-load trigger files alot, but wanted to ALWAYS have my channels logged, I used to use a plugin but was having too much hassle with it, so I put everything back into triggers in the trigger tab of world configuration. I was wondering if I could do the similar thing I used to have with plugins, but put it in a script file instead. Now that I have it stopping the double send with this current method at least lol.
[Go to top] top

Posted by AaronM86   (42 posts)  [Biography] bio
Date Reply #7 on Wed 31 Mar 2010 07:27 AM (UTC)
Message
Well, I'm too tired to tinker anymore. I've decided what I'm going to do is just put ALL my triggers into one trigger file and organize them all by group name and set up alias commands for a toggle on/off feature, by disabling entire group names at a time. ie. disable crafting, disable combat. Toggling will be so I don't have trigger conflictions, it'll be nice to be able to enable and disable by group name and finally stop loading separate trigger files for each different thing I wanted to do without having conflicting triggers. Thank you, Mick and Nick for helping me again tonight. Learned plenty more from reading/tinkering and taking your advice.
[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.


4,916 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 FutureQuest]