|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
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
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 400 |
can you show what the variable looks like? maybe?
-Kurdish_Assass1n
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
This is the format of the script and $1 refers to the channel. 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
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
Shouldn't that be 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:
while () {
var %nick = $nick($1,%i)
...
}
and then use %nick anywhere you have that $nick() construct. Makes it slightly more self-documenting, too
Last edited by Sais; 21/12/06 04:54 PM.
Sais
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
/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 this sets the variable ON @!*:JOIN:#: {
set -u30 $+(%,varcheck,.,$nick,$chan),2)
} merry christmas
Last edited by HaleyJ; 24/12/06 02:37 PM.
Newbie
|
|
|
|
Joined: Oct 2003
Posts: 313
Fjord artisan
|
Fjord artisan
Joined: Oct 2003
Posts: 313 |
It's setting it to $null, so when you eveluate it, it's false.
if ($null) {
;; nothing here executes
}
Either set it to something (e.g. $true) or use $var() to see if it's been set.
if ($var(<variable>)) {
;; This executes if the variable has been set.
}
Last edited by Sais; 24/12/06 05:05 PM.
Sais
|
|
|
|
Joined: Jul 2006
Posts: 242
Fjord artisan
|
OP
Fjord artisan
Joined: Jul 2006
Posts: 242 |
Thanks sais i set the variable to 1 and it now works MerrY Christmas :P
Newbie
|
|
|
|
|