mIRC Home    About    Download    Register    News    Help

Print Thread
Socket Problem #190027 15/11/07 03:21 AM
Joined: Dec 2006
Posts: 39
S
skovicniq Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2006
Posts: 39
Code:
 
alias s { .sockopen s2 %serv 6667 } 
on *:sockopen:s2: { 
  if ($sockerr > 0) { return } 
  .sockwrite -n s2 NICK Duke2
  .sockwrite -n s2 USER Duke3 * * :Duke4
} 
on *:sockread:s2: { 
  if ($sockerr > 0) { return }
  if (!$window(@socket)) .window -en @socket
  .sockread %data 
  .tokenize 32 %data
  .echo @socket %data
  if ($2 == 376) { .echo -a successfully connected }
} 



need some help with this. I need when some kick my socket, then rejoin back and deop that person. Then, when my socket get an op, it will thanked that person on channel. Moreover, when bot owner join it will say hye!. Lastly, reconnect when my socket disconnected. is it on *:sockclose:nn*: $s ?

1. rejoin when kicked and deop the kicker
2. greet bot owner
3. Thanked when being +o
4. Reconnect when disconnected

thx smile

Last edited by skovicniq; 15/11/07 03:26 AM.
Re: Socket Problem [Re: skovicniq] #190043 15/11/07 08:53 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Um not sure about socket bots so im just gonna post the raw equavilants to some (not all) of your questions

if ($2 == MODE) && ($4-5 == +o Duke2) { msg #yourchannel Thanks for ops }
if ($2 == JOIN) && (BotOwnerNick isin $1-) { msg #yourchannel Hello master $nick }
if ($2-3 == KICK duke2) { join #yourchannel }

the thanks for ops
BotOwnerJoin
and when your kicked to join channel


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Socket Problem [Re: Lpfix5] #190046 15/11/07 11:09 AM
Joined: May 2007
Posts: 89
T
TropNul Offline
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
I think you must use /sockwrite commands to control the socket rather.
Here's what I mean:
Code:
if ($2 == MODE) && ($4-5 == +o Duke2) { sockwrite $sockname PRIVMSG #yourchannel :Thanks for ops }
elseif ($2 == JOIN) && (BotOwnerNick isin $1-) { sockwrite $sockname PRIVMSG #yourchannel :Hello master $nick }
elseif ($2-3 == KICK duke2) { sockwrite $sockname JOIN #yourchannel }

the code becoming
Code:
alias s {
  sockopen s2 %serv 6667
  if (!$window(@socket)) .window -en @socket
}
on *:sockopen:s2: { 
  if ($sockerr > 0) { return } 
  sockwrite -n s2 NICK Duke2
  sockwrite -n s2 USER Duke3 * * :Duke4
} 
on *:sockread:s2: { 
  if ($sockerr > 0) { return }
  var %data
  sockread %data 
  tokenize 32 %data
  echo @socket $1-
  var %z = sockwrite $sockname
  if ($2 == 376) { .echo -a successfully connected }
  elseif ($2 == MODE) && ($4-5 == +o Duke2) { %z PRIVMSG #yourchannel :Thanks for ops }
  elseif ($2 == JOIN) && (BotOwnerNick isin $1-) { %z PRIVMSG #yourchannel :Hello master $nick }
  elseif ($2-3 == KICK duke2) { %z JOIN #yourchannel }
}

For the disconnect issue, i'm not sure about the RAWmsg but the code will be in the same type of those posted.
Code:
elseif ($n == RAWmsgForDisconnect) { .Timer -o 1 5 s }


Cordialement


tropnul
Re: Socket Problem [Re: TropNul] #190061 15/11/07 03:15 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Sockwrite is not needed


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Socket Problem [Re: Lpfix5] #190063 15/11/07 03:21 PM
Joined: May 2007
Posts: 89
T
TropNul Offline
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
I always used sockwrite in my socket bots whenever I had to send something or a command through the latter. I don't understand how it may function without sockwriting to the socket. I'll have to test that in my free time smile.


tropnul
Re: Socket Problem [Re: TropNul] #190111 16/11/07 12:48 AM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I'm almost positive that the only way to send data through a socket is to use the /sockwrite command. The /msg command would try to send the message through one of mIRC's normal server connections rather than the socket.

-genius_at_work

Re: Socket Problem [Re: genius_at_work] #190128 16/11/07 08:49 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Ok your right sorry about that, I was testing the socket via, the client i use and its the client giving the message rather then the socket bot sorry


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }