mIRC Homepage
Posted By: EviL_SmUrF question about local variables - 04/01/05 05:50 AM
I am having a problem with a variable named %sendpass not getting passed to a on *:sockopen event

Code:
    echo -s Sending sign on announcement...
    socklisten announcelisten 22488
    var %numlines = $lines(" $+ $mircdir $+ \mfriends\friendsdat.dat $+ ")
    var %count = 0
    var %announce = $read(" $+ $mircdir $+ \mfriends\friendsdat.dat ",%count)
    echo -s announce: %announce
    var %sendpass = $gettok($hget(friends,%announce),1,32)
    echo -s sendpass: %sendpass
    var %sendip = $gettok($hget(friends,%announce),3,32)
    echo -s sendip %sendip
    sockopen announce %sendip 22488
    inc %count


and

Code:
on *:sockopen:announce: {
  echo -s online gettok1: $gettok($hget(friends,system),1,32) sendpass: %sendpass gettok2: $gettok($hget(friends,system),3,32) 
  sockwrite announce online $gettok($hget(friends,system),1,32) %sendpass $gettok($hget(friends,system),3,32) $ip
  sockclose announce
}


output:

Code:

Sending sign on announcement...
announce: 1
sendpass: addme
sendip 192.168.1.100
online gettok1: 2 sendpass: gettok2: EviL_SmUrF



as you can see, for some reason sendpass isn't even being passed to that event. I thought local variables can be seen throughout the script, but not in other scripts?

Thanks again for your help laugh
Posted By: Danthemandoo Re: question about local variables - 04/01/05 06:16 AM
Quote:
I thought local variables can be seen throughout the script, but not in other scripts


local variables can only be used by the event/alias they were used in.
© mIRC Discussion Forums