mIRC Home    About    Download    Register    News    Help

Print Thread
#7049 17/01/03 06:27 PM
Joined: Jan 2003
Posts: 5
G
Grynch Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2003
Posts: 5
Im trying to creat a socket to join another server and be able to msg someone.. can someone help me with this?

#7050 17/01/03 07:37 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
/server -m servername port -i PNick ANick EMail Fullname

Msg them as soon as it connects smile


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#7051 17/01/03 09:13 PM
Joined: Jan 2003
Posts: 5
G
Grynch Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2003
Posts: 5
Im not wanting to open a new server connection.

what this is for is.. I run a shoutcast server and i want people on my script to be able to be on a diff network and still be able to request songs with out having to join the network i use for my shoutcast server.

#7052 17/01/03 09:19 PM
Joined: Dec 2002
Posts: 395
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
You can do /debug @debug to see what mIRC sends to the server upon connecting, and just make your script to /sockwrite it. wink

#7053 17/01/03 09:38 PM
Joined: Jan 2003
Posts: 5
G
Grynch Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2003
Posts: 5
this is what I got

alias testingreq: {
/sockopen testreq radio.shoutcastserver.net 6667 }
}

on *:sockopen:testreq: {
if ($sockerr) return
else sockwrite -n $sockname Nick SocketClone $+ $crlf $+ User Testreg $ip radio.shoutcastserver.net :mIRC Socket testreq
msg CurrentDJ Will you play Song/Artist
sockclose testreq
}


but like i said it aint working and its probally cause Its not right at all.. but this will give a idea of what im wanting to do.

PS
radio.shoutcastserver.net is not a real server i dont believe
I removed the real server as not to seem like i was sending Ads for it.

#7054 17/01/03 10:27 PM
Joined: Dec 2002
Posts: 395
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
Your 'msg' has to be put trough the socket:

Code:
/sockwrite -n testreq PRIVMSG CurrentDJ :Will you play Song/Artist


and:

Code:

alias testingreq: {
/sockopen testreq radio.shoutcastserver.net 6667 [color:red]}[/color]
}



} is not needed wink

And you should make some delay between sending that info and MSG.

#7055 17/01/03 10:35 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Not to mention that he hasn't really connected yet on SOCKOPEN. smile He hasn't done anything with USER NICK (possibly PASS) nor PING? PONG! much less waited till the MOTD is finished before attempting to send anything to anyone at all. As far as the server is concerned, he's not been added to the client's list, so he can't use such commands as PRIVMSG.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#7056 17/01/03 11:12 PM
Joined: Jan 2003
Posts: 5
G
Grynch Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Jan 2003
Posts: 5
well hammer can you help me with this please

#7057 18/01/03 03:36 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

on *:SOCKOPEN:SongReq:{
  [color:#006600];
  ;  NICK <nickname>
  ;[/color]
  sockwrite -n $sockname NICK $mnick
  [color:#006600];
  ;  USER <userid> <email host> <servername> <:full name/GCOS>
  ;[/color]
  sockwrite -n $sockname USER $&
    $+(",$readini($mircini,ident,userid),") $&
    $+(",$gettok($emailaddr,2,64),") $&
    $+(",%SongRequest.server,") $&
    $+(:,$fullname)
  [color:#006600];
  ;  Let yourself know the socket was opened (server found).
  ;[/color]
  echo $color(info2) -abflirt * Song Request: connected
}
on *:SOCKCLOSE:SongReq:{
  [color:#006600];
  ;  Report that the socket was closed by remote host.
  ;[/color]
  echo $color(ctcp) -abflirt * Song Request: terminated by the server
  [color:#006600];
  ;  Request a retry.
  ;[/color]
  SongRequest.Retry
}
alias SongRequest.Retry {
  [color:#006600];
  ;  Increment the retry counter
  ;[/color]
  inc %SongRequest.retries
  [color:#006600];
  ;  Check to make sure we haven't gone over the maximum retries limit.
  ;[/color]
  if (%SongRequest.retries <= SongRequest.maxretries) .timer 1 10 sockopen $sockname %SockRequest.server 6667
  [color:#006600];
  ;  Terminate the process if maximum retries is reached.
  ;[/color]
  else echo $color(ctcp) -abflirt * Song Request: All ( $+ %SongRequest.maxretries $+ ) retries failed.
  [color:#006600];
  ;  Stop the script.
  ;[/color]
  halt
}  
on *:SOCKREAD:SongReq:{
  [color:#006600];
  ;  Check for a socket error, such as Connection reset by peer.
  ;[/color]
  if ($sockerr > 0) {
    [color:#006600];
    ;  Report the error condition.
    ;[/color]
    echo $color(info) -abflirt * Song Request: $+([,$sock($sockname).wserr,]) $sock($sockname).wsmsg
  [color:#006600];
  ;  Request a retry.
  ;[/color]
    SongRequest.Retry
  }
  [color:#006600];
  ;  Otherwise, prepare to read the data sent from the server.
  ;[/color]
  var %1-
  [color:#006600];
  ;  Read the data sent by the server.
  ;[/color]
  sockread %1-
  [color:#006600];
  ;  If there was data, process it.
  ;[/color]
  while ($sockbr > 0) {
    [color:#006600];
    ;  Tokenize it so you can use $1, $2, etc.
    ;[/color]
    tokenize 32 %1-
    [color:#006600];
    ;  Respond to the initial PING :from the server.
    ;[/color]
    if (PING == $1) sockwrite -n $sockname PONG $remove($2,:)
    [color:#006600];
    ;  Respond correctly to VERSION requests.
    ;[/color]
    elseif ($4 == :VERSION) {
      sockwrite -n $sockname NOTICE $right($gettok($1,1,33),-1) :VERSION mIRC v6.03 Khaled Mardam-Bey
    }
    [color:#006600];
    ;  Make sure you try at least 3 nicks in case your primary nick is taken.
    ;[/color]
    elseif ($2 == 433) {
      [color:#006600];
      ;  If the primary nick was taken, try the alternate nick.
      ;[/color]
      if ($4 == $mnick) sockwrite -n $sockname NICK $anick
      [color:#006600];
      ;  Or if the alternate nick was taken, try a modified primary nick.
      ;[/color]
      elseif ($4 == $anick) sockwrite -n $sockname NICK $mnick $+ ``
      [color:#006600];
      ;  If all 3 nicks tries were unsuccessful, halt the script.
      ;[/color]
      else {
        [color:#006600];
        ;  Report nicks in use and halt.
        ;[/color]
        echo $color(ctcp) -abflirt * Song Request: all nicks in use
        [color:#006600];
        ;  Close the socket.
        ;[/color]
        sockclose $sockname
        [color:#006600];
        ;  Halt the script.
        ;[/color]
        halt
      }
    }
    [color:#006600];
    ;  Wait for the End of /MOTD command. Send the message, then close the socket.
    ;[/color]
    elseif ($2 == 376) {
      [color:#006600];
      ;  Ask for the song.
      ;[/color]
      sockwrite -n $sockname PRIVMSG CurrentDJ :Will you play Song/Artist %SongRequest.song
      [color:#006600];
      ;  Let yourself know the song was requested and the script got this far.
      ;[/color]
      echo $color(info2) -abflirt * Song request sent: %SongRequest.song
      [color:#006600];
      ;  Get rid of the variables used by the script.
      ;[/color]
      unset %SongRequest.*
      [color:#006600];
      ;  Close the socket.
      ;[/color]
      sockclose $sockname
      [color:#006600];
      ;  Halt the script.
      ;[/color]
      halt
    }
    sockread %1-
  }
}
alias SongReq {
  [color:#006600];
  ;  Check for input.
  ;[/color]
  if (!$1) {
    [color:#006600];
    ;  Report that no song was requested.
    ;[/color]
    echo $color(ctcp) -abflirt * Song Request: No song requested
    [color:#006600];
    ;  Halt the script.
    ;[/color]
    halt
  }
  [color:#006600];
  ;  Here is where you set in the real server name you wish to connect to.
  ;[/color]
  set -u600 %SongRequest.server [color:red]radio.shoutcastserver.com[/color]
  [color:#006600];
  ;  Here is where you set the maximum times you wish to retry the connection.
  ;[/color]
  set -u600 %SongRequest.maxretries [color:red]5[/color]
  [color:#006600];
  ;  Save the song that is to be requested for use later.
  ;[/color]
  set -u600 %SongRequest.song $1-
  [color:#006600];
  ;  Open the socket to the ShoutCast server
  ;[/color]
  sockopen SongReq %SongRequest.server 6667
}

/SongReq Josh Groban - To Where You Are

This is untested since I have no idea where you are connecting to, but it should work, I think. If it doesn't quite work like you think it should, you should be able to follow the script by reading the comments to see what it should be doing at each step, and correct any errors you might find.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C

Link Copied to Clipboard