mIRC Home    About    Download    Register    News    Help

Print Thread
#165715 29/11/06 08:31 PM
Joined: Oct 2003
Posts: 214
S
Fjord artisan
OP Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 214
/queryrn doesn't work correctly if the old nick is similar to the new nick for example:

/queryrn cow Cow
It replys with * /queryrn: invalid window

i wonder why this wasn't reported before smile


one step closer to world domination
#165716 30/11/06 06:20 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
That wouldn't work because the two names are the same. Window names for queries and channels are not case sensitive, so cow and Cow are identical, not similar.

#165717 30/11/06 10:05 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
That makes it even odder. Why would it be an "invalid window"?


Sais
#165718 30/11/06 11:09 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I see your point about the message. The only time I got that response in my testing was when the two names were identical (based upon my earlier observations). When I used the command with two different names (example: Bob and Pete) it worked properly.

My best guess is that it's simply a badly worded error message.

#165719 30/11/06 11:28 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
It should be possible to reformat the capitalisation, though. Simple workaround:

Code:
alias queryrn {
  if ($$1 != $$2) { !queryrn $1- }
  else {
    var %temp = $+($1,$ticks)
    !queryrn $$1 %temp
    !queryrn %temp $$2
  }
}


Sais
#165720 30/11/06 08:29 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
omg, do u know what using $$n does?

Code:
alias queryrn {
  if (!$isid) {
    if ($len($1) && ($1 != $2) { queryrn $1- }
    else {
      var %temp = $+($1,$ticks)
      queryrn $1 %temp
      queryrn %temp $2
    }
  }
  :error
}

#165721 30/11/06 09:32 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Do you know what :error does? You keep using it places where it does nothing.

Also you're missing a parenthesis in the first if condition and there's no point checking $len($1) anyway.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#165722 01/12/06 05:10 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
yeah i do know what it does, for some reason my edit didnt come through, i made my changes to the script and hit submit by error and went back straight away and edited it but it didnt come through frown

pre edit i forgot to write the rest of the line ":error | reseterror" got side tracked remebering it shouldnt run on $identifier use,

re: the error trap while this doesnt completely make a customized command exactly the same as an orginal one, i feel its better than the chance some other part of the code might error, out side of the original command. This was also what disturbed me about his use of $$n.

As for the missing bracket its actually ment to be at the end of the 2nd if, i corrected that in the edit as well frown

and as for the $len, your wrong $len($1) becomes true on $1 being $false or simple numeric representaion of 0 such as 0, 000.0, 0000.000, etc, I often check for these possabilities, be it needed or not in the particular instance.

Code:
alias queryrn {
  if (!$isid) {
    if ($len($1) && ($1 != $2)) { queryrn $1- }
    else {
      var %temp = $+($1,$ticks)
      queryrn $1 %temp
      queryrn %temp $2
    }
  }
  :error | reseterror
}

#165723 01/12/06 09:35 AM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Err, yes, I believe I do. You seem to be implying that it does more than it says in the helpfile:

Code:
The double $$ means that this command will only be executed if a parameter is specified.


Or were you just commenting on the fact that I overused it a bit? (That's cos I cba to remove the two that I'd already used)


Sais
#165724 01/12/06 09:47 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
$$ stops not only the current routine but the entire call chain (kind of like an "if ($1 == $null) halt"). I doubt it matters much in this case though.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#165725 01/12/06 10:00 AM
Joined: Apr 2004
Posts: 759
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 759
if ($len($1) && ($1 != $2)) { queryrn $1- }
why check for the length of $1 to begin with in this case ? If $len($1) (or $len($2) or both for that matter ) returns 0 it can never be the same as $2 anyway ?

//tokenize 32 0 0 | if ($1 != $2) echo -a $1 *No trigger
//tokenize 32 0 1 | if ($1 != $2) echo -a $1 *Trigger
//tokenize 32 0 | if ($1 != $2) echo -a $1 *No trigger
//tokenize 32 0 | if ($1 != $2) echo -a $1 *No trigger
//tokenize 32 | if ($1 != $2) echo -a $1 *No trigger

work as expected checking for $len($1) is unneeded.
Only case it would be needed is if you want to check if it excists
if ($len($1)) and you want to allow 0 and $false being passed.


$maybe
#165726 01/12/06 12:29 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Did you miss this bit "I often check for these possabilities, be it needed or not in the particular instance" ?


Link Copied to Clipboard