mIRC Home    About    Download    Register    News    Help

Print Thread
#167179 21/12/06 12:04 AM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Greetings
If am using a while loop to cycle through all nicknames in a channel how would i do it if i want to check if a variable applies to a certain nicks? I am currently using this but its not working.

if $($+(%,varcheck,.,$1($nick,%i)),2)

Thanks


Newbie
HaleyJ #167180 21/12/06 12:13 AM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
can you show what the variable looks like? maybe?


-Kurdish_Assass1n
HaleyJ #167197 21/12/06 05:05 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Please post your while loop. Looking quickly at your if statement, I have to wonder about the usage of $1 in that location, also I don't think your usage of $nick is correct either.

I should be able to verify my hunches by reviewing your while loop, and then be able to assist you, including showing what you're doing wrong.

RusselB #167205 21/12/06 09:38 AM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
This is the format of the script and $1 refers to the channel.


Code:
alias rnicks {
  var %i = 0
  while (%i < $nick($1,0)) {
    inc %i
    if $($+(%,varcheck,.,$1($nick,%i)),2) { 
      echo -a $nick($1,%i) yes
    }
    else echo -a $nick($1,%i) no
  }
}


Newbie
HaleyJ #167229 21/12/06 04:48 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
Shouldn't that be

Code:
if $($+(%,varcheck,.,$nick($1,%i)),2) {
?

I assume you want %varcheck.nickname

Since you are using $nick($1,%i) several times in the while loop, I'd be tempted to make it a var:

Code:
while () {
var %nick = $nick($1,%i)
...
}


and then use %nick anywhere you have that $nick() construct. Makes it slightly more self-documenting, too laugh

Last edited by Sais; 21/12/06 04:54 PM.

Sais
Sais #167448 24/12/06 02:36 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Code:
/rnicks {
  var %i = 0
  while (%i < $nick($1,0)) {
    inc %i
    var %nick = $nick($1,%i)
    if  $($+(%,varcheck,.,%nick,$1),2) { 
      echo -a $nick($1,%i) yes
    }
    else echo -a $nick($1,%i) no
  }
}


thats in my aliases section and it does not work, i have the right variables set and used echo to try and debug but i dont know what my mistake is frown

this sets the variable
Code:
ON @!*:JOIN:#: {
  set -u30 $+(%,varcheck,.,$nick,$chan),2)
}




merry christmas

Last edited by HaleyJ; 24/12/06 02:37 PM.

Newbie
HaleyJ #167451 24/12/06 02:50 PM
Joined: Oct 2003
Posts: 313
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Oct 2003
Posts: 313
It's setting it to $null, so when you eveluate it, it's false.

Code:
if ($null) { 
 ;; nothing here executes
}


Either set it to something (e.g. $true) or use $var() to see if it's been set.

Code:
 
if ($var(<variable>)) { 
  ;; This executes if the variable has been set.
}

Last edited by Sais; 24/12/06 05:05 PM.

Sais
Sais #167455 24/12/06 05:52 PM
Joined: Jul 2006
Posts: 242
H
HaleyJ Offline OP
Fjord artisan
OP Offline
Fjord artisan
H
Joined: Jul 2006
Posts: 242
Thanks sais i set the variable to 1 and it now works
MerrY Christmas :P


Newbie

Link Copied to Clipboard