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
➜ Trouble with SetTriggerOption
|
Trouble with SetTriggerOption
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Whininguser
Canada (30 posts) Bio
|
| Date
| Wed 03 Nov 2010 03:30 PM (UTC) Amended on Wed 03 Nov 2010 03:38 PM (UTC) by Whininguser
|
| Message
| Suppose...
function name()
AddTrigger("monster", "match text", "", trigger_flag.Enabled, custom_colour.Custom15, 0, "", "")
SetTriggerOption ("monster", "ignore_case", "y")
end
After the function was called, the ignore_case box remained unchecked, so I went on to play around and here's the result:
SetTriggerOption ("monster", "ignore_case", "y") (failed)
SetTriggerOption ("monster", "ignore_case", "Y") (failed)
SetTriggerOption ("monster", "ignore_case", "1") (failed)
I had the same problem in almost every other case involving the y/n argument (didn't test them all), but the function worked fine in cases without the y/n argument. For example:
SetTriggerOption ("monster", "group", "name") (worked)
What did I do wrong? Thanks :)
Environment:
Mushclient 4.33
Lua 5.1
Windows XP SP3
| | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #1 on Wed 03 Nov 2010 03:45 PM (UTC) |
| Message
| If I run that code and put check() around the SetTriggerOption function (to check the return code), I get:
Run-time error
World: Lusternia
Immediate execution
Plugin is not allowed to set this option
stack traceback:
[C]: in function 'error'
[string "Check function"]:1: in function <[string "Check function"]:1>
(tail call): ?
[string "Alias: lua_eval"]:1: in main chunk
Which is utter nonsense, as it wasn't executed from a plugin. That error code (30032) isn't even in the list of returns from SetTriggerOption. Sounds fishy. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Wed 03 Nov 2010 08:21 PM (UTC) |
| Message
| |
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Wed 03 Nov 2010 08:31 PM (UTC) |
| Message
| Ah, and also you can't set a couple of options, that being one of them.
Both "ignore_case" and "regexp" are marked as non-writable. Probably because they would cause the regular expression to need to be recompiled.
And the return code 30032 is shared for both "plugin cannot write" and "cannot write". I'll update the documentation.
In your case, why not just add the trigger with the options set in the first place? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Whininguser
Canada (30 posts) Bio
|
| Date
| Reply #4 on Thu 04 Nov 2010 01:38 AM (UTC) |
| Message
| Thanks for the clarification, guys :)
Nick Gammon said:
In your case, why not just add the trigger with the options set in the first place?
It's because I don't know how :D
So how can I do it? Suppose below is my trigger, and I want regexp and ignore_case enabled once it's added.
AddTriggerEx ("name", ".* attacks", "You are under attack!", trigger_flag.Enabled, custom_colour.Custom15, 0, "", "", 2, 50)
| | Top |
|
| Posted by
| Twisol
USA (2,257 posts) Bio
|
| Date
| Reply #5 on Thu 04 Nov 2010 01:39 AM (UTC) |
| Message
|
Whininguser said: AddTriggerEx ("name", ".* attacks", "You are under attack!", trigger_flag.Enabled + trigger_flag.IgnoreCase + trigger_flag.RegularExpression, custom_colour.Custom15, 0, "", "", 2, 50)
Added in bold. :) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | | Top |
|
| Posted by
| Whininguser
Canada (30 posts) Bio
|
| Date
| Reply #6 on Thu 04 Nov 2010 01:42 AM (UTC) Amended on Thu 04 Nov 2010 01:45 AM (UTC) by Whininguser
|
| Message
|
Twisol said:
Added in bold. :)
Thanks! :) | | 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,377 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top