Socket question - 08/01/07 02:34 PM
Not too hot with sockets, got one up and running now problem though, what i have done is when the socket joins a channel, it'll open up an @window named after the channel, then i echo all the rest of the events and raws there, But i wanted to be able to make the socket talk by typing in the editbox (Just like you normally would in channels) But from the @windows and so the text goes to that correct channel, hope you understand what i mean.
This is PART of what i have got for the bot and the @windows
This is PART of what i have got for the bot and the @windows
Code:
on 1:sockread:np*:{ .sockread %pb ;;for the debug .window @bot | .aline -p @bot $timestamp %pb .tokenize 32 %pb .var %rn $remove($gettok($1,1,33),:) .var %rm *!*@ $+ $gettok($1,2,64) .var %cm $2 .var %rc $3 .var %sk $4 .var %sm $5 if ($2 == PRIVMSG) { if ($left($3,1) == $chr(35)) { if ($4 == :ACTION) { .window -ekL +p @ $+ $3 .echo -tm @ [ $+ [ $3 ] ] 6 $+ * $mid($1,2,$calc($pos($1,!,1) - 2)) $remove($5-,$chr(1)) .goto nextread } .window -ekL +p @ $+ $3 .echo -tm @ [ $+ [ $3 ] ] $chr(171) $+ $mid($1,2,$calc($pos($1,!,1) - 2)) $+ $chr(187) $mid($4,2,$len($4)) $5- } if ($2 == JOIN) { if ($mid($1,2,$calc($pos($1,!,1) - 2)) == $sock($sockname).mark) { .window -ekL +p @ $+ $remove($3,:) | .echo @ $+ $remove($3,:) $timestamp $str($chr(187),3) Now talking in $remove($3,:) $+ .. | .return } else { .echo @ $+ $remove($3,:) 3 $+ $timestamp $mid($1,2,$calc($pos($1,!,1) - 2)) ( $+ $mid($1,$calc($pos($1,!,1) + 1),$len($1)) $+ ) has joined $remove($3,:) } }