mIRC Homepage
Posted By: skovicniq Socket Problem - 15/11/07 03:21 AM
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
Posted By: Lpfix5 Re: Socket Problem - 15/11/07 08:53 AM
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
Posted By: TropNul Re: Socket Problem - 15/11/07 11:09 AM
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
Posted By: Lpfix5 Re: Socket Problem - 15/11/07 03:15 PM
Sockwrite is not needed
Posted By: TropNul Re: Socket Problem - 15/11/07 03:21 PM
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.
Posted By: genius_at_work Re: Socket Problem - 16/11/07 12:48 AM
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
Posted By: Lpfix5 Re: Socket Problem - 16/11/07 08:49 AM
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
© mIRC Discussion Forums