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 ➜ disable all scripts temporarily

disable all scripts temporarily

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


Pages: 1  2  3 

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #30 on Thu 31 Jul 2008 12:45 PM (UTC)
Message
(X and 1) or 0 is logically equivalent to just X, anyhow. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #31 on Thu 31 Jul 2008 01:16 PM (UTC)
Message
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? >_>
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #32 on Thu 31 Jul 2008 02:50 PM (UTC)

Amended on Thu 31 Jul 2008 03:08 PM (UTC) by Fiendish

Message
Quote:
(X and 1) or 0 is logically equivalent to just X, anyhow. :-)
X and 1 or 0 is just a convention for converting a boolean into an integer, because lua doesn't treat them the same like some other languages do.

Clearly I would need to use 1-X instead.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #33 on Thu 31 Jul 2008 03:17 PM (UTC)
Message
Since Lua doesn't treat them the same, I think it would be more cautious to not try converting "false" to 0. 0 is not false in Lua, after all.

1-X for boolean X doesn't do anything helpful (in Lua). By that I mean that it is a runtime error. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #34 on Thu 31 Jul 2008 03:23 PM (UTC)

Amended on Thu 31 Jul 2008 03:26 PM (UTC) by Fiendish

Message
Quote:
1-X for boolean X
I meant it for integer X to toggle 1 and 0, which is what GetOption returns.

For boolean X, the and 1 or 0 works fine to convert to an integer. They serve different purposes, you see.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #35 on Thu 31 Jul 2008 03:55 PM (UTC)
Message
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

http://david.the-haleys.org
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #36 on Thu 31 Jul 2008 06:59 PM (UTC)

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.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #37 on Sat 02 Aug 2008 04:04 AM (UTC)
Message
Nick, any chance on an answer to my question above?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #38 on Sat 02 Aug 2008 06:25 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #39 on Sat 02 Aug 2008 07:20 AM (UTC)
Message
Fair enough, the thought crossed my mind too.

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.
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.


84,767 views.

This is page 3, subject is 3 pages long:  [Previous page]  1  2  3 

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.