mIRC Home    About    Download    Register    News    Help

Print Thread
#226344 28/09/10 05:37 AM
Joined: Nov 2009
Posts: 81
V
Voglea Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Nov 2009
Posts: 81
I detecting many errors by on ERROR, on CONNECTFAIL etc. events.

When I type any /command when mIRC not connected to server and if mIRC dont know about this /command, outputs: * Not connected to server

How to detect this? Nothing in /debug, nothing by other events...

Voglea #226345 28/09/10 05:57 AM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
It seems to me you should be checking whether you are connected to the server instead of trying to catch that error.

Voglea #226347 28/09/10 08:21 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
5618 has a good point, especially for usage in scripts, but if you really want to detect commands typed into the editbox when offline you can use the following method:

Code:
on *:input:*:{
  if ($status == disconnected) {
    if (/* iswm $1) && (!$ctrlenter) {
      scon -r $1-
    }
    else {
    
       ; handle 'You are not on a channel' errors here
       
    }
    halt
  }
  return
  :error
  if ($(& & not connected to server*) iswm $error) {
    reseterror
    
    ; handle 'not connected to server' errors here
    
    halt
  }
}


note that this doesn't detect commands input using the '!' command prefix; those will bypass the event.

some things to think about for a general purpose solution that i didn't include for the sake of providing a simple example:

  • alternative command prefix (read from $mircini)
  • $inpaste for pastes into a single line editbox
  • custom aliases or identifiers called that themselves execute commands that cannot be used offline


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #226384 29/09/10 07:16 AM
Joined: Sep 2010
Posts: 1
A
Mostly harmless
Offline
Mostly harmless
A
Joined: Sep 2010
Posts: 1
on *:input:*:{
if ($status == disconnected) {
if (/* iswm $1) && (!$ctrlenter) {
scon -r $1-
}
else {

; handle 'You are not on a channel' errors here

}
halt
}
return
:error
if ($(& & not connected to server*) iswm $error) {
reseterror

; handle 'not connected to server' errors here

halt

aldlmany #226385 29/09/10 07:22 AM
Joined: Aug 2010
Posts: 69
N
Babel fish
Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
*gives aldlmany some [ code ] tags, and fixes the bracket mismatches in the code* laugh

Code:
on *:input:*:{
  if ($status == disconnected) {
    if (/* iswm $1) && (!$ctrlenter) {
      scon -r $1-
    }
    else {

      ; handle 'You are not on a channel' errors here

    }
    halt
  }
  return
  :error
  if ($(& & not connected to server*) iswm $error) {
    reseterror

    ; handle 'not connected to server' errors here

    halt
  }
}


Okay, now what?


"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."
N3M3S1S #226386 29/09/10 07:35 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
o_O did anything change?


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #226387 29/09/10 07:41 AM
Joined: Aug 2010
Posts: 69
N
Babel fish
Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
lol no. I saw that aldlmany had forgotten their code tags and forgot the proper closing brackets on their snippet, so I helped them ^.^

<.<


"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."

Link Copied to Clipboard