mIRC Home    About    Download    Register    News    Help

Print Thread
$iif causes /reseterror #163724 03/11/06 11:56 PM
Joined: Nov 2006
Posts: 6
R
RPGGamer Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
R
Joined: Nov 2006
Posts: 6
when mIRC 6.2 jumps to the :error goto point, using an $iif causes a /reseterror as seen with this code:

ON 1500:TEXT:.*:*: {
$eval($2-,2)
:error
echo -a $error
msg $iif(#,#,$nick) $error ERROR FAILED
echo -a $error ALSO FAILED
}

the first error will echo just fine but the second error will not evaluate unless evaluation brackets are used and even then any subsequent $error will not contain anything.

Re: $iif causes /reseterror #163725 04/11/06 11:55 AM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Well $error wont catch "<command> Unknown command" and evaluating $2- as a command is very dangerous even if it is for a ulevel of 1500.
However you seem to be right smile
Code:
alias testerror {
  echo -a $or()
  :error
  echo -a this: $error  FAILED
  echo $iif(1,1,2) $error ERROR FAILED
  echo -a $error ALSO FAILED
}

as suppose to
Code:
alias testerror {
  echo -a $or()
  :error
  echo -a $error FAILED
  ;echo $iif(1,1,2) $error ERROR FAILED
  echo -a $error ALSO FAILED
}


I have no clue why it would do such a thing because no error in the :error section seems to retrigger the :error handling.

You could save $error into a %error variable prior to using $error. However this wont stop from /reseterror to be triggered and therefor not propagate backwards to any calling aliases which might be the behaviour you want.


$maybe
Re: $iif causes /reseterror #163726 04/11/06 01:13 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'd only add that this isn't particular to $iif(), any alias called after mirc jumps to :error causes /reseterror:

/alias test noop

//return $or( | :error | echo -a 1: $error | test | echo -a 2: $error

The reason $iif() does this too is that it's one of those "internal" aliases: each time you call it,

/!if (%s) { /!return 1 } | /!else { /!return 0 }

is executed behind the scenes.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: $iif causes /reseterror #163727 04/11/06 01:49 PM
Joined: Apr 2004
Posts: 759
M
Mpdreamz Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
Code:
alias testerror {
  cool
  echo -a yay
  :error
  echo -a this: $error  testerror FAILED
  reseterror
}
alias cool { 
  echo -a $or()
  :error
  echo -a this: $error  cool FAILED
  reseterror
}

will output
this: * /echo: insufficient parameters (line 9, script9.mrc) cool FAILED
yay
this: testerror FAILED

It seems odd behaviour though to me since cool reset the error testerror shouldn't trigger an error since /reseterror indicates don't propegate to the calling alias's error smirk.


Wheter these 2 are related or not i don't know


$maybe
Re: $iif causes /reseterror #163728 04/11/06 02:03 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This one is normal, you just forgot a /return after "echo -a yay" wink


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: $iif causes /reseterror #163729 06/11/06 02:38 PM
Joined: Dec 2002
Posts: 4,655
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,655
Thanks this has been fixed for the next version.