hi all, I have next trouble,
that is, i have in my script:
var %chansOn $numtok($hget(onchans,$2),2)
while (%chansOn > 0) {
echo -s cur channel number: %chansOn
echo -s channels user are on: $hget(onchans,$2)
echo -s current chan: $gettok($hget(onchans,$2),%chansOn,2)
var %cur_chan $gettok($hget(onchans,$2),%chansOn,2)
var %usersONchan $numtok($hget(chanusers,%cur_chan),58)
while (%usersONchan > 0) {
if ($gettok($hget(chanusers,%cur_chan),%usersONchan,58) != $2) { sockwrite -n $gettok($hget(chanusers,%cur_chan),%usersONchan,58) : $+ $1 NICK : $+ $2 }
dec %usersONchan 1
}
dec %chansOn 1
}
it is piece of a code from my irc server based on mirc script, i think it`s difficult to understand so i`ll explain what means each row:
;this performs the operation of nickchange (announces to all channels which user are on of nickchange)
;$1 nickname
;$2 new_nickname
var %chansOn $numtok($hget(onchans,$2),2)
;sets variable to a number of channels user are on
while (%chansOn > 0) {
;;;;;;;;this doesn`t return any error;;;;;;;;;;;
echo -s cur channel number: %chansOn
echo -s channels user are on: $hget(onchans,$2) ;full list of a channels in format #chan1<$chr(2)>#chan2<$chr(2)>...
echo -s current chan: $gettok($hget(onchans,$2),%chansOn,2) ;current channel name
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
var %cur_chan $gettok($hget(onchans,$2),%chansOn,2)
;;;;;must set the channel name but returns error.;;;;;;
var %usersONchan $numtok($hget(chanusers,%cur_chan),58)
;number of total users in a channel
while (%usersONchan > 0) {
if ($gettok($hget(chanusers,%cur_chan),%usersONchan,58) != $2)
;if that isn`t same user who change nick
{ sockwrite -n $gettok($hget(chanusers,%cur_chan),%usersONchan,58) : $+ $1 NICK : $+ $2
;tell him about nickchange
}
dec %usersONchan 1
;set next user`s number to tell about n\c
}
dec %chansOn 1
;switches to the next channel
}
problem is that the
var %cur_chan $gettok($hget(onchans,$2),%chansOn,2)
;;;;;must set the channel name but returns error.;;;;;;
but one row higher 'echo' with the same code works properly.
Any ideas?