[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]  General
. . -> [Subject]  Trouble with SetTriggerOption
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Trouble with SetTriggerOption

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Wed 03 Nov 2010 03:30 PM (UTC)  quote  ]

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

[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #1 on Wed 03 Nov 2010 03:45 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (19,435 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 03 Nov 2010 08:21 PM (UTC)  quote  ]
Message
Whininguser said:

What did I do wrong? Thanks :)

Environment:
Mushclient 4.33


You used an old version of MUSHclient. Don't do that. ;)

http://www.gammon.com.au/scripts/showrelnote.php?version=4.53&productid=0

See point 6 in the release notes.

For older versions you have to use 1 or 0, not "y" or "n".

- Nick Gammon

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

Posted by Nick Gammon   Australia  (19,435 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Wed 03 Nov 2010 08:31 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Reply #4 on Thu 04 Nov 2010 01:38 AM (UTC)  quote  ]
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)


[Go to top] top

Posted by Twisol   USA  (2,230 posts)  [Biography] bio
Date Reply #5 on Thu 04 Nov 2010 01:39 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Whininguser   Canada  (30 posts)  [Biography] bio
Date Reply #6 on Thu 04 Nov 2010 01:42 AM (UTC)  quote  ]

Amended on Thu 04 Nov 2010 01:45 AM (UTC) by Whininguser

Message
Twisol said:

Added in bold. :)


Thanks! :)
[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.


2,128 views.

[Reply to this subject]  Reply to this subject   [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]