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 Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Mon 28 Jul 2008 02:03 AM (UTC)
Message
Is there a way to conveniently temporarily disable all script processing including plugins? Like, say, from the input line? And going into the plugin pane and selecting them all and clicking Disable is not what I'm asking for. That doesn't instantly stop the script engine. It fires the "OnPluginDisable()" lines first.

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

Posted by Larkin   (278 posts)  Bio
Date Reply #1 on Mon 28 Jul 2008 11:53 AM (UTC)
Message
SetOption("enable_scripts", 0)

...maybe.

This will likely give you lots of warnings trying to execute scripts, unless you disable the warnings, too. Also, you can't script the turning on of scripts, for what should be an obvious reason.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #2 on Mon 28 Jul 2008 11:08 PM (UTC)
Message
Quote:
This will likely give you lots of warnings trying to execute scripts, unless you disable the warnings, too. Also, you can't script the turning on of scripts, for what should be an obvious reason.
Then this is not what I'm looking for. I need something similar to #IGNORE in zMUD. And it needs to affect plugins as well.

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Mon 28 Jul 2008 11:42 PM (UTC)
Message
You're being vague about what you want precisely. That doesn't help when people are trying to help you. :)

First you asked about something to stop all script processing, including stuff executed through aliases. Larkin's reply is the proper solution for that.

Now you say you need something like #IGNORE, which according to the manual I found online, only affects TRIGGERS from being fired. In other words:

world.SetOption ('enable_triggers', 0) -- disable all triggers


Maybe you just want aliases you have not to be considered anymore. In that case...

world.SetOption ('enable_aliases', 0) -- disable all aliases


... should be able to help you out. Or maybe a combination of the stuff above. Maybe also do the same to disable timers since they could also fire script actions.

If none of this is what you are looking for: please be more precise about the functionality you are looking for.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 29 Jul 2008 07:00 AM (UTC)
Message
He wants to disable plugins, without firing the OnPluginDisable. I don't think there is a quick way of doing it right now.

- Nick Gammon

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #5 on Tue 29 Jul 2008 10:31 AM (UTC)
Message
If he wants to do that, I think he should have a good look at the plugins or their writer. If plugins need such forceful prodding to prevent them from messing up your gaming experience, it should be delt with at the source (which is available!) and not be kludged around to reach the desired effect. That's just my thoughts, tho.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #6 on Tue 29 Jul 2008 09:28 PM (UTC)

Amended on Tue 29 Jul 2008 09:32 PM (UTC) by Fiendish

Message
Well, Nick already knows of my plight, but just because I'm chatty...

Quote:
You're being vague about what you want precisely.
I'm sorry, I don't see what's vague at all about "I need something similar to #IGNORE in zMUD. And it needs to affect plugins as well." combined with "clicking Disable is not what I'm asking for. That doesn't instantly stop the script engine. It fires the "OnPluginDisable()" lines first."

Quote:
If he wants to do that, I think he should have a good look at the plugins or their writer. If plugins need such forceful prodding to prevent them from messing up your gaming experience, it should be delt with at the source (which is available!) and not be kludged around to reach the desired effect.
There are very good reasons for having OnDisable in a plugin for when you actually want to shut a plugin down without leaving spam on the screen from mud-side options enabled for that plugin. However, there are also very good reasons for wanting MUSHclient to suddenly become a dumb terminal without running those routines first. Especially when the user may have dozens of plugins installed, and the desired effect is to halt everything and then reactivate them mere seconds later. A user of a script shouldn't be forced to re-write every plugin or lose the valuable functionality of OnDisable just because they need to, for a few seconds, see exactly what the MUD is sending. As a script-writer myself, this is a toggle that I use very often in zMUD, I and would like to see something similar in MUSHclient so that I can fully transition.

I just figured that I would ask about it here before suggesting it as an addition.

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #7 on Tue 29 Jul 2008 10:37 PM (UTC)

Amended on Tue 29 Jul 2008 11:02 PM (UTC) by Worstje

Message
Well, please bear in mind I have virtually no zmud experience, and that I had to go by the manual description of #IGNORE which pretty much says "turns off all triggers" in my interpretation of it. Combine that with your first post which discusses the command line, and on the other hand that disabling plugins is not what you want, and I think I have the right to be pretty damn confused here. :P

But if I understand you correctly now, you just want to stop all forms of processing: aliases, timers, triggers and plugin callbacks, whether those things happen to reside within a plugin or not. Well, I'm with Nick on this one then. :)

However, I remain with my statement that there is no reason to try and block a plugin from getting the disable event. If the plugin wants to act on it, it either has a good reason or it is crap that needs to be rewritten. None of my 20+ plugins uses OnPluginDisable, and I know of no other scripts that use it either. And while you may feel you shouldn't need to rewrite your own plugins or someone elses, I am of the opinion that stealing -any- callback from a plugin would throw it into an undefined state (depending on its logic, it might miss the next part of a sequence of triggers, start omitting everything in sight from output, loop a certain command, etc.) Once you have one way to avoid one callback, someone else will want a way to dodge another callback because it is bugged/unwanted but the rest of the plugin is of their liking. Callbacks I can imagine getting treated like that would be: OnPluginPacketReceived, OnPluginLineReceived, OnPluginSen[dt], OnPluginSaveState and OnPlugin(Dis)?Connect. Plugins are useful because they can interact dependably. Once you start taking away that certainty, it will only give more people more ways to break your scripts, and have you wonder in complete amazement why that one thing isn't working.

Sorry if it comes over as a bit of a rant, but MUSHclient has a very clean and dependable scripting interface. I'd hate to see it get poked full of holes because some scripts are bugged or not refined enough for a users liking.

For as far seeing the exact output goes (since I think that is your goal here)... have you ever looked at Edit>Debug packets? There's no better way to see what you're getting from the mud than through that command, and combined with Game>Trace you have all the tools you need to see what goes wrong where.

Edit: and of course, I have to look through miniwindow scripts and actually see a good use for the OnPluginDisable event. (Incidentally, it is also my first time to see it used :D)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 30 Jul 2008 05:26 AM (UTC)
Message
What I was trying to do with the OnPluginDisable (and enable) was to send telnet codes to the MUD, to tell it to stop sending special stuff (eg. {stats}<a whole heap of numbers) - if you decided you didn't want the stats plugin.

Then if you wanted it again, it sent another lot of codes to enable sending those numbers again.

I am not totally sure that giving the users a tool that would "conveniently temporarily disable all script processing including plugins" would be like giving them a tool to conveniently power off the PC without going through the normal shutdown procedure. They put those power buttons at the back for a reason, or make you hold them down for 5 seconds. It isn't supposed to be convenient to work around the safeguards.

Worstje is correct, packet debug would be one way. A cleaner way, if you just want to view MUD output (say, to see all those tags) is to make a simple plugin that intercepts incoming packets and displays them in another window.

The plugin below does a reasonable job of showing what is actually arriving:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Show_Incoming_Packets"
   author="Nick Gammon"
   id="163939389a0d3798faf61598"
   language="Lua"
   purpose="Shows incoming text in a notepad window"
   date_written="2008-07-30"
   requires="4.06"
   version="1.0"
   >

</plugin>

<!--  Script  -->
<script>
<![CDATA[

function OnPluginPacketReceived (s)
  s = string.gsub (s, "\r", "")    -- no carriage returns
  s = string.gsub (s, "\n", "\r\n")  -- make linefeed cr/lf
  s = string.gsub (s, "\027.-m", "")  -- get rid of ANSI codes
  AppendToNotepad ("packets", s)
  return s
end -- function OnPluginPacketReceived

]]>
</script>

</muclient>

- Nick Gammon

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

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #9 on Wed 30 Jul 2008 07:34 PM (UTC)

Amended on Wed 30 Jul 2008 07:49 PM (UTC) by Fiendish

Message
Nick, that plugin snippet is sort of close to what I'd like, thanks for the suggestion. I made some slight modification to better serve my purposes by adding an accelerator toggle. But still, while it effectively does what I want, it does it in another window which isn't very nice from a usability standpoint, because it means diverting my attention, reading uncolorized text that I'm used to being colored, closing the window, being prompted if I want to save before closing, and clicking "No" before I can get back to where I want to be. Maybe the part about closing and not saving can be automated, I don't know, but the whole notepad window thing is not ideal. Is there any way to make just the missing lines go inline with the rest of the text? Like...I don't know...some sort of catch for when a line gets hidden from display?

[Edit: Actually, I just had a thought. I'm going to see if I can make it go into a mini window (assuming I can get it to scroll). I'd still like to know if the above is possible though.]

You can stop reading here if the answer to the above question is yes.

Quote:
have you ever looked at Edit>Debug packets? There's no better way to see what you're getting from the mud than through that command
I can think of a dozen better ways for the user to see what's going on than the output from Debug packets. Have you ever tried actually reading it? Yikes.

Tell me, which do you think is significantly easier for a human to parse?

This?

Quote:
..<MAPSTART>...[   0a 0d 3c 4d 41 50 53 54 41 52 54 3e 0a 0d 1b 5b
1;32mEntrance..    31 3b 33 32 6d 45 6e 74 72 61 6e 63 65 0a 0d 20
...[0;37m ...[0;   0a 0d 1b 5b 30 3b 33 37 6d 20 0a 0d 1b 5b 30 3b
37m.[1;34m         33 37 6d 1b 5b 31 3b 33 34 6d 20 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
      ...[1;34m    20 20 20 20 20 20 0a 0d 1b 5b 31 3b 33 34 6d 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
         ...[1;3   20 20 20 20 20 20 20 20 20 0a 0d 1b 5b 31 3b 33
4m                 34 6d 20 20 20 20 20 20 20 20 20 20 20 20 20 20
               .   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0a
..[1;34m           0d 1b 5b 31 3b 33 34 6d 20 20 20 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
  ...[1;34m        20 20 0a 0d 1b 5b 31 3b 33 34 6d 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
        ...[1;34   20 20 20 20 20 20 20 20 0a 0d 1b 5b 31 3b 33 34
m                  6d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
           ...[1   20 20 20 20 20 20 20 20 20 20 20 0a 0d 1b 5b 31
;34m               3b 33 34 6d 20 20 20 20 20 20 20 20 20 20 20 20
 -------           20 2d 2d 2d 2d 2d 2d 2d 20 20 20 20 20 20 20 20
 ...[1;34m         20 0a 0d 1b 5b 31 3b 33 34 6d 20 20 20 20 20 20
      .[1;34m|.[   20 20 20 20 20 20 1b 5b 31 3b 33 34 6d 7c 1b 5b
0;37m[.[1;35m#.[   30 3b 33 37 6d 5b 1b 5b 31 3b 33 35 6d 23 1b 5b
0;37m].[1;34m .[   30 3b 33 37 6d 5d 1b 5b 31 3b 33 34 6d 20 1b 5b
0;37m[.[1;32m!.[   30 3b 33 37 6d 5b 1b 5b 31 3b 33 32 6d 21 1b 5b
0;37m].[1;34m|     30 3b 33 37 6d 5d 1b 5b 31 3b 33 34 6d 7c 20 20
   ...[1;34m       20 20 20 0a 0d 1b 5b 31 3b 33 34 6d 20 20 20 20
         -------   20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d
         ...[1;3   20 20 20 20 20 20 20 20 20 0a 0d 1b 5b 31 3b 33
4m                 34 6d 20 20 20 20 20 20 20 20 20 20 20 20 20 20
            ...[   20 20 20 20 20 20 20 20 20 20 20 20 0a 0d 1b 5b
1;34m              31 3b 33 34 6d 20 20 20 20 20 20 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
  ...[1;34m        20 20 0a 0d 1b 5b 31 3b 33 34 6d 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
     ...[1;34m     20 20 20 20 20 0a 0d 1b 5b 31 3b 33 34 6d 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
           ...[1   20 20 20 20 20 20 20 20 20 20 20 0a 0d 1b 5b 31
;34m               3b 33 34 6d 20 20 20 20 20 20 20 20 20 20 20 20
              ..   20 20 20 20 20 20 20 20 20 20 20 20 20 20 0a 0d
.[1;34m            1b 5b 31 3b 33 34 6d 20 20 20 20 20 20 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
    ...[0;37m.[0   20 20 20 20 0a 0d 1b 5b 30 3b 33 37 6d 1b 5b 30
;37m ...[0;32m[.   3b 33 37 6d 20 0a 0d 1b 5b 30 3b 33 32 6d 5b 1b
[1;37m Exits.[0;   5b 31 3b 33 37 6d 20 45 78 69 74 73 1b 5b 30 3b
32m: E ].[0;37m.   33 32 6d 3a 20 45 20 5d 1b 5b 30 3b 33 37 6d 1b
[0;37m..<MAPEND>   5b 30 3b 33 37 6d 0a 0d 3c 4d 41 50 45 4e 44 3e
(because hex values are way more important than the text, right?)

Or this?
Quote:
<MAPSTART>
Entrance
 
 
                            
                          
                             
                          
                             
                          
             -------         
            |[#] [!]|     
             -------         
                          
                             
                          
                             
                          
                             
 
[ Exits: E ]
<MAPEND>


Now, you may say "Clearly the first is better!" And I'd call you a liar and a scoundrel, and then I'd hit you with a metal chair.


Quote:
I am not totally sure that giving the users a tool that would "conveniently temporarily disable all script processing including plugins" would(n't) be like giving them a tool to conveniently power off the PC without going through the normal shutdown procedure. They put those power buttons at the back for a reason.
And yet, the button is there. Consider it along these lines...
It's a feature that exists in other clients that people find extremely convenient whether you think they should or not. ;)

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

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #10 on Wed 30 Jul 2008 07:57 PM (UTC)
Message
Quote:
It's a feature that exists in other clients that people find extremely convenient whether you think they should or not. ;)

While I see your point, consider also that many of zMUD's bugs and other undesirables (e.g. poor conformance to standards like MXP -- ironic, innit) are due to implementing shortcuts and "conveniences". There is clearly a fine line here, but I think it is a very good idea to be cautious about giving people "red buttons" for the sake of small conveniences.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #11 on Wed 30 Jul 2008 08:58 PM (UTC)
Message
Quote:

Is there any way to make just the missing lines go inline with the rest of the text?


You mean, if a trigger omits a line from output, don't omit it? :P

Hey, here's an idea. Instead of fighting the system, work with it. You want to see the Aardwolf tags, right? For debugging?

Write a small plugin (or even probably a single trigger would do it). When a tag line comes along (probably "{*" might do it), simply display it in the output window. Use a special colour to make it obvious this is one of your debugging lines. You might need to use "send to script - after omit" otherwise your debug line might be omitted to. Then when you need to debug, just enable this trigger or plugin.

Quote:

It's a feature that exists in other clients that people find extremely convenient whether you think they should or not.


The problem here is that you are trying to debug your scripts. Here I am supporting the client, including a whole lot of users who haven't used it before, and get frustrated when things don't work. I know this might be hard to believe, but some don't even read the FAQ!

Now if there was a little button that, if you click it, it disables most of the client features, I bet a whole lot of people will click it, and when nothing "seems" to happen, leave it activated. Then next day I will get a heap of forum postings about how plugins don't work, triggers don't work, aliases don't work, and this client isn't as good as the one they used to use.

- Nick Gammon

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

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #12 on Wed 30 Jul 2008 09:41 PM (UTC)

Amended on Wed 30 Jul 2008 10:08 PM (UTC) by Fiendish

Message
Quote:
Now if there was a little button that, if you click it, it disables most of the client features
Ok, then let me amend my request by saying I'd be happy if I could at least disable gags, and it doesn't have to be a shiny button that people want to press. Don't get stuck on gui design issues, because it doesn't need one.

Quote:
You mean, if a trigger omits a line from output, don't omit it? :P
That's exactly what I mean. Maybe it's just that you've never had it available so you've never considered that it might be useful (when your only tool is a hammer...), but I'm actually extremely surprised that none of you have ever wanted to do this. Or maybe I'm not that surprised. Before I started using a tabbed web browser, I couldn't imagine wanting to use tabs. And now I won't use any browser that doesn't support tabs.

Quote:
The problem here is that you are trying to debug your scripts.
Not accurate. The problem here is that I'm trying to see output from the mud. Debugging doesn't really come into it. This might aid debugging, but that's secondary.

Quote:
You want to see the Aardwolf tags, right? For debugging?
Nope. I want to see anything that might be gagged regardless of what gagged it or why. And for various analytical reasons where I need to temporarily see what the mud is sending, not necessarily just for debugging.

Quote:
Now if there was a little button that, if you click it, it disables most of the client features, I bet a whole lot of people will click it
And if it were a script command like "/omgFiendishIsSuchAJerkWhoWouldEverWantACommandLikeThis!?" I highly doubt that any player would accidentally toggle it.

Quote:
I know this might be hard to believe, but some don't even read the FAQ!
Har har. Ok, you got me. But really, if they don't read the documentation then they wouldn't know about the command and would thus never activate it. No harm no foul.

And it'd be significantly more elegant to put an "if (do_gags)" on whatever line of code deals with eating the lines marked with "Omit from output" than it would to make this work in a plugin that will very likely never be able to do something like this.

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

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #13 on Wed 30 Jul 2008 10:26 PM (UTC)
Message
Quote:
The problem here is that I'm trying to see output from the mud. And for various analytical reasons where I need to temporarily see what the mud is sending, not necessarily just for debugging.

I can't help but think that if you are trying to prevent triggers/scripts from doing something that they really want to do, something is broken either in the triggers/scripts or in your usage of them. Presumably, the trigger is omitting output that is judged to be not useful, or it is displaying it some other way. If useful information is being lost in this process, and turning off the script/whatever causes undesirable things to happen, something is wrong (though not necessarily by any fault of the user's).

Why have I not wanted to do this in MUSHclient? Simple: I have never found myself in a situation where desired information was being thrown away...

Let me ask this question: can you provide a precise use case where information is being thrown away, that you wanted to see, and then justify why the plug-in as-is is properly behaved -- and why the situation cannot be fixed by simply disabling or flipping a flag for that plug-in? (i.e. what undesirable consequences does that have?)

I appreciate that some scripts might be misbehaved and you don't want to have to futz around with fixing them. I've been in the same situation myself in other environments. But if the nail is bent, do you really want to fix the hammer to work with bent nails? There comes a point where supporting misbehaved things becomes more trouble than it's worth. There's a reason why there's an expression "feature creep". :-)

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 #14 on Wed 30 Jul 2008 11:33 PM (UTC)
Message
Fiendish, it should be really simple to write the functionality you are looking (showing stuff marked to gag instead) for yourself inside a plugin. Maybe I'll go write it after I've had breakfast. ^^
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.


85,044 views.

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

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.