Alternatively, you could add another switch which would need to be consciously turned on by the user, maybe as part of the allowed plugins stuff you have in the Lua sandbox. Or maybe make it a special feature that would only work in global plugins.
With the advent of miniwindows, I can imagine a number of helper plugins being written, not unlike the Ungagger I started writing. Things like changing the 'Omit from Log' for certain triggers in certain plugins because it could be beneficial for certain plugins (for example you want to log a fight in a roleplay, but because of it being a roleplay you want it to actually end up in the log), or maybe to set the 'Keep evaluating' flag because it prevents the matching of a trigger you made dynamically in your plugin as a part of some debugging process.
Maybe some kind of helper plugin that would try to help resolve incompatibility between different plugins without executing a dozen traces and back-and-forth communication between the user and a helpful person or the actual writer of one of those plugins. Something that would automatically figure out 'trigger A in plugin X prevents the execution of trigger B in plugin Y' by trying to test such stuff by removing/adding certain flags to triggers.
Honestly, I am thinking quite much in the direction of adding features to MUSHclient that might not be fit for the actual client, but that certain people could get a lot of use from. Maybe in time it will actually end up producing some really worthwhile plugins.
Sorry I missed the question amongst all the chatter about "not X and 1 or 0" and so on.
My attitude so far has been that a plugin author ought to be able to write a plugin, secure in the knowledge that its internal state, or variables, won't be changed by other plugins, or the main world script.
Indeed if they could do so, you could get into a race condition, where sometimes it works if plugin A disables plugin B, but other times plugin B disables plugin A first.
I would need to see a more compelling case made than the one so far, which was solved by simply making a fairly simple accelerator.
Amended on Thu 31 Jul 2008 07:00 PM (UTC) by Fiendish
Message
"not" creates a boolean. The problem was that somehow I didn't realize it was always creating a bad one because I'm not used to languages that don't make int and bool equivalent. Though I'm fairly certain that I tried it at one point and I thought I saw that it was working, I must have been mistaken. So my suggestion that I should have used 1-X was to replace not the X and 1 or 0, but rather to replace "not X and 1 or 0" in a way that actually works for integer X.
It wasn't exactly obvious to me that you had switched from booleans to integers, given that you were talking about booleans immediately before that. (Yes, I know that the MUSHclient function returns an integer. And yes, I am "moderately" familiar with Lua.) Anyhow, it's unclear to me what you're doing with these, and where these booleans are coming from in the first place, so... :shrug:
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
I and my big mouth about writing that plugin quickly. I got it all whipped out, and upon testing I found out there is no such function as SetPluginTriggerOption()... which rather messes it all up if I am also to disable the outputting for other plugins. I got it all working (including spiffy miniwindow to denote an ON state) except for the actual restoring.
Nick, any chance such a function (and mirrors of other GetPlugin* functions) can be added? >_>
Amended on Thu 31 Jul 2008 03:25 AM (UTC) by Fiendish
Message
Quote: /print (GetOption("enable_triggers") ) --> either prints 0 or 1
Yeah, I got that far. On the first one, I guess I'm just too used to the C/C++ equivalence of bools and ints.
What about the second one, though?
/Note (not GetOption("enable_triggers") and 1 or 0) shows 1 or 0
It seems like the "(not GetOption("enable_triggers") and 1 or 0)" part of
/AcceleratorTo ("Ctrl+T", 'SetOption("enable_triggers", (not GetOption("enable_triggers") and 1 or 0))', sendto.script)
is getting processed as I create the accelerator instead of when I use it. I don't understand why, since obviously the "SetOption" part doesn't happen until it's used. Is there a way around that?
/print (GetOption("enable_triggers") ) --> either prints 0 or 1
Now in Lua, "if 0 then ..." will evaluate to true. This is basic Lua coding. The only things that are false in Lua are nil and the boolean value false.
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.