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 ➜ Scripting through triggers? - Newbie Question.

Scripting through triggers? - Newbie Question.

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


Posted by Mick   (3 posts)  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.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  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
Top

Posted by Mick   (3 posts)  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 :(
Top

Posted by Nick Gammon   Australia  (23,158 posts)  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
Top

Posted by AaronM86   (42 posts)  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?
Top

Posted by Mick   (3 posts)  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
Top

Posted by AaronM86   (42 posts)  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.
Top

Posted by AaronM86   (42 posts)  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.
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.


25,186 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.