mIRC Home    About    Download    Register    News    Help

Print Thread
question about local variables #106806 04/01/05 05:50 AM
Joined: Dec 2002
Posts: 111
E
EviL_SmUrF Offline OP
Vogon poet
OP Offline
Vogon poet
E
Joined: Dec 2002
Posts: 111
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

Re: question about local variables #106807 04/01/05 06:16 AM
Joined: Mar 2004
Posts: 457
D
Danthemandoo Offline
Fjord artisan
Offline
Fjord artisan
D
Joined: Mar 2004
Posts: 457
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.