mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
hello
there is another method from using %var for reading the socket ?
example :
on *:SOCKREAD:*: {
sockread %var
}
to
on *:SOCKREAD:*: {
sockread <anything>
}

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Yes, you can also sockread to a binary variable.

/help binary variables
/help /sockread

Note that in your example, you are not declaring %var as a local variable prior to sockreading, which means the sockread creates a global variable in your variables list which is left trailing after the script finishes.

In conclusion, you can only sockread to either a %variable or a &binvar, nothing else.


Gone.
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
how about /sockread $alias ?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
In conclusion, you can only sockread to either a %variable or a &binvar, nothing else.


Well, you _could_ put anything in the sockread command, as long as it evaluates to the literal representation of a (binary) variable. Though that doesn't make it sockread to an alias, it sockreads to the return value of the alias, which is either a %variable or a &binvar.

alias sockvar return % $+ tmp

on *:sockread:mysocket:{
if ($sockerr) return
sockread $sockvar
echo -s -> %tmp
}

That will work, but what this does is simply first evaluate $sockvar to %tmp, and then do sockread %tmp. So you might as well put:

var %tmp
sockread %tmp
echo -s -> %tmp


Gone.
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
on *:SOCKREAD:*: {
sockread &binvar
echo -a &binvar
}

why it only show &binvar on active window ?

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Because you have not read the section in the help file about binary variables yet. If you would have, you would know you can't just echo a binvar like that.

I don't think you know sockets well enough to be trying out these things, I suggest reading some tutorials. You can do a search on www.mircscripts.org for socket tutorials.

Also this forum has a Search feature, you can search there too for examples using sockets. (don't forget to put the interval at 5 years, and put it on "all forums").

Note that socket scripting is not for the novice scripter, you need to be atleast semi-advanced in regular scripting first.


Gone.
Joined: Dec 2002
Posts: 60
C
coder Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Dec 2002
Posts: 60
why do u care ?
well nvm , thx


Link Copied to Clipboard