My First mIRC Socket Script - RCD Radio Now Playing Posting in to Channel

By Lozo on Dec 24, 2014

This is my first Socket Script, so please be nice...

When Loaded, type /rcdradionp and what's currently playing on RCD Radio will post in the channel under a /msg $chan command, feel free to load and change to your own preferences.

Please remember this is my first Socket Script, so its dead simple, some help goes to GrimReaper.

alias RCDRadioNP {
  sockclose rcdradio
  unset %rcdradionp.output
  sockopen rcdradionp bots.rcdradio.com 80
}

on *:SOCKOPEN:rcdradionp: {
  sockwrite -nt $sockname GET /data/nowplaying-raw.php HTTP/1.0
  sockwrite -nt $sockname Host: bots.rcdradio.com
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:rcdradionp: {
  var %sockread
  sockread -f %sockread
  if (!%sockread) { set -e %rcdradionp.output $true }
  if (%rcdradionp.output) {
    %sockread = $regsubex(%sockread,/<[^>]+>/g,)
    if (%sockread) && ($len(%sockread) > 0) {
      %rcdradionp.command %sockread
    }
  }
}
on *:SOCKREAD:rcdradionp: {
  unset %rcdradionp.output
  unset %rcdradionp.command
}

Comments

Sign in to comment.
WilliamHerndon   -  Jan 18, 2017

Not bad as for the first time. Really, I like it. Very convenient to have a song playing on RCD Radio posted simultaneously in the channel under a /msg $chan command. However cam you clarify what this part means
if (!%sockread) { set -e %rcdradionp.output $true }
if (%rcdradionp.output) {
%sockread = $regsubex(%sockread,/<[^>]+>/g,)
if (%sockread) && ($len(%sockread) > 0) { // especially here, do not understand completely, your explanations would be a great essay helper for me.
%rcdradionp.command %sockread

 Respond  
Yawhatnever   -  Dec 26, 2014

Is that last event on line 23 where variables are cleaned up meant to be on *:sockclose: instead of sockread?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.