mIRC Homepage
Posted By: NaquadaServ Should Ctrl-Break clear queued signals? - 14/05/07 08:40 PM
This is part "bug" and part feature suggestion...

Consider this situation...
Code:
alias test {
  var %count 0
  while ($true) { inc %count | .signal test %count }
}
on *:signal:test:{ echo -a $signal $+ : $1 }

Run test for 30 seconds or so, and press ctrl-break to stop /test. Then the signals start coming, control-break will not clear the queue of pending signals. It would be nice if the queue would be cleared on ctrl-break. Anyone disagree?
Posted By: hixxy Re: Should Ctrl-Break clear queued signals? - 14/05/07 08:45 PM
I think it should clear signals, stop timers, the lot. Anything capable of triggering a script should be stopped. Maybe a new key shortcut would be needed though.
Quote:
Maybe a new key shortcut would be needed though.


I think ctrl-break is treated special by the PC hardware, I think it has to do with interupts.
Posted By: hixxy Re: Should Ctrl-Break clear queued signals? - 14/05/07 09:38 PM
A small section in the options dialog could work too I suppose..

Code:
Actions to be performed when Ctrl+Break is hit:

+------------------+
| [ ] /timers off  |
| [ ] /remote off  |
| [ ] Stop signals |
+------------------+
Posted By: Sat Re: Should Ctrl-Break clear queued signals? - 14/05/07 10:22 PM
A good idea!

Implementation-wise though, I'd personally rather have ctrl+scrolllock do all that. In fact, ctrl+scrolllock could serve as an on/off switch for the script engine at all, something which I once heard it did but apparently doesn't. I'm not sure what it currently does in fact, but I am sure its behaviour can be extended.. smile I would hate to kill all timers in all my mIRC copies just because I press ctrl+break to break out of a loop in one of them, though.

Having to go to the options to specify what mIRC should do is not the best idea IMO. After all, you can only not change it when you need to.. smirk
Posted By: Riamus2 Re: Should Ctrl-Break clear queued signals? - 14/05/07 11:05 PM
I think this should be something other than Ctrl-Break. Ctrl-Break can be used outside of mIRC and it can still affect mIRC. This is useful when mIRC is minimized or in the tray and freezes in a broken loop. If you had to open mIRC before using Ctrl-Break, you'd have to kill the process to stop it. Because Ctrl-Break is global in nature, it works even though mIRC isn't the active application. If you set Ctrl-Break to stop timers and signals and whatever else, then no one could "safely" use Ctrl-Break for other purposes outside of mIRC because it would still be global and would remove things that you don't want removed in mIRC (such as timers and signals). As long as it's another combination, preferably one that isn't used by other apps or is set to only work when mIRC's the active application, it would be helpful.
How about a [ ] Ask me option? That way you could choose what action to take each time you hit the key combo.

-genius_at_work
Posted By: Riamus2 Re: Should Ctrl-Break clear queued signals? - 15/05/07 02:43 AM
How will that work when mIRC's minimized or in the tray? Do you want mIRC's "Ask me" dialog popping up just because you use Ctrl-Break for some other reason? I think that's just going to cause headaches. Another key combination would be better, imo.
Posted By: qwerty Re: Should Ctrl-Break clear queued signals? - 15/05/07 10:02 AM
Agreed, I like the idea of Ctrl+ScrollLock.
Ctrl+Break can continue to work as before, but the new ctrl+whatever should have the checkbox options that were mentioned above. Personally, I wouldn't necessarily want all my timers being stopped everytime.

-genius_at_work
I agree, I only want to break out of wahtever is hanging at that time, usually my own stupidly coded loop!

btk
Posted By: Riamus2 Re: Should Ctrl-Break clear queued signals? - 15/05/07 10:01 PM
Ok, that makes sense. It appeared that you were saying Ctrl-Break should have the Ask option.

There is just one issue with that. Unless you're using this alternate break method for anything EXCEPT breaking out of broken loops and other things that freeze mIRC, this ask option will not work. If mIRC's frozen from a loop, then it can't show and act on an Ask dialog. Of course, if you just are using it for other reasons and actually breaking out of loops is left to Ctrl-Break, then it's not an issue.
Posted By: FaiNT Re: Should Ctrl-Break clear queued signals? - 03/06/07 10:10 PM
if we do scrlk, how about pausing the timers, and un-pausing when u hit it again, any timers left over after the user looks thou the list and stops the one causing issues. i also noticed that control + break doesn't stop any $ident (like $findfile/$finddir or $dll) calls that where triggered with tab or //echo -a/-s so fixing that would also be nice
Posted By: Doqnach Re: Should Ctrl-Break clear queued signals? - 07/06/07 10:02 AM
not all keyboards these days still have scrolllock... laptops for isntance don't. so it won't be a good shortcut to use. (and yes I feel the key should be there, I sometimes miss it when working under linux console).
Posted By: The_JD Re: Should Ctrl-Break clear queued signals? - 16/06/07 06:14 AM
Originally Posted By: Doqnach
not all keyboards these days still have scrolllock... laptops for isntance don't. so it won't be a good shortcut to use. (and yes I feel the key should be there, I sometimes miss it when working under linux console).


My laptop does (function + home)
Posted By: sparta Re: Should Ctrl-Break clear queued signals? - 16/06/07 06:27 AM
Originally Posted By: hixxy
A small section in the options dialog could work too I suppose..

Code:
Actions to be performed when Ctrl+Break is hit:

+------------------+
| [ ] /timers off  |
| [ ] /remote off  |
| [ ] Stop signals |
+------------------+


Why set remote off? i think it would be enough if ctrl-break should stop the running script, if it turn's remote off, then that mean all other scripts you running would be halted. Enough if the script cosing problem halts, so bether if it was a good error check instead.
If the problem script is triggered by an event (onTEXT for example), the buggy code would be continuously called as people chat in your channel. In many channels, the chatter happens so fast that you would never have a chance to manually disable remotes or change the code.

-genius_at_work
Posted By: sparta Re: Should Ctrl-Break clear queued signals? - 18/06/07 07:40 AM
Originally Posted By: genius_at_work
If the problem script is triggered by an event (onTEXT for example), the buggy code would be continuously called as people chat in your channel. In many channels, the chatter happens so fast that you would never have a chance to manually disable remotes or change the code.
-genius_at_work


I dont know how you use the CTRL break, i use it to halt the script, then i leav the server and try fix the problem, then i reconnect, no need to stay on a server with a faulty script, and if it's in a on text even, then you often flood your self off befor you pressed CTRL break, atlest i do smile
Posted By: Riamus2 Re: Should Ctrl-Break clear queued signals? - 18/06/07 12:19 PM
I have to agree that turning remotes off with Ctrl-Break is a bad idea. If it's another combination, that's okay. I hate when remotes get turned off because half of the time, just turning them back on isn't enough... I have to restart mIRC to reinitialize them again or various things seem to stop working properly. Ctrl-Break should be left as it is and any additional break options should be keyed to another key combination, such as Ctrl-Scroll Lock or something. Besides, Ctrl-Break is a global break command and I'd hate to see it work differently depending on the program I am in. I'd rather see it stay constant from program to program.
The point is that if you are in a very active channel with an on TEXT script with an infinite loop in it, you may never get the chance to disconnect or do anything else because the script would constantly go into the infinite loop everytime someone spoke in the channel.

Obviously, the "disable remotes" option would be part of the alternate key-combo that was discussed above, rather than the current ctrl+break.

-genius_at_work
Posted By: sparta Re: Should Ctrl-Break clear queued signals? - 18/06/07 07:19 PM
Originally Posted By: genius_at_work
The point is that if you are in a very active channel with an on TEXT script with an infinite loop in it, you may never get the chance to disconnect or do anything else because the script would constantly go into the infinite loop everytime someone spoke in the channel.

Obviously, the "disable remotes" option would be part of the alternate key-combo that was discussed above, rather than the current ctrl+break.

-genius_at_work


and you dont think you flood out ? smile thats what happens to me, atlest if it's a on text thingie that cosing a problem. and then CTRL break make the problem stop and i can solve it befor i reconnect again, that way all my timers and other things still runing smile
Code:

on *:TEXT:*:*: while (1) { echo -a Endless Loop }



That code won't flood you off the server.

Besides, relying on the server to disconnect you in the case of a runaway script is not a good plan. If I saw you repeatedly flooding off a network where I'm an oper, I'd likely ban you for suspicious behaviour.

-genius_at_work
Posted By: sparta Re: Should Ctrl-Break clear queued signals? - 19/06/07 07:46 AM
Often if i get a loop that wont stop i flood out, if i dont, then i just can rewrite the code and go on with my life? it's not so nice to restart mirc after you enabled remote cos you want all your timers to start.
Posted By: Mpdreamz Re: Should Ctrl-Break clear queued signals? - 19/06/07 10:41 AM
Originally Posted By: genius_at_work
The point is that if you are in a very active channel with an on TEXT script with an infinite loop in it, you may never get the chance to disconnect or do anything else because the script would constantly go into the infinite loop everytime someone spoke in the channel.

Obviously, the "disable remotes" option would be part of the alternate key-combo that was discussed above, rather than the current ctrl+break.

-genius_at_work


It could just simply unload the script that triggered it as suppose to /remote off. As long as mIRC outputs something like / * C:\myscript.mrc unloaded due to breakage.
Posted By: hixxy Re: Should Ctrl-Break clear queued signals? - 19/06/07 11:31 AM
Then write better scripts. If you have to restart mIRC each time then it is poorly written. What you should do is something like this:

Code:
alias inittimers {
  ; Initialise timers here.
}
on *:start:{ inittimers }


Now when you want to start the timers, you can just type /inittimers without restarting mIRC.

My suggestion was that there should be an option to turn remote off when Ctrl+Break was hit, and genius_at_work gave one good reason why you might want to disable remotes (events being triggered with buggy scripts in them), so it can't possibly be a bad idea. If you don't want remotes disabled, then simply don't turn on the option.
© mIRC Discussion Forums