mIRC Home    About    Download    Register    News    Help

Print Thread
#252927 17/05/15 07:07 PM
Joined: May 2015
Posts: 249
splinny Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2015
Posts: 249
Ok, i got a site, to check twitch channel viewers - twitchviewerlist.com, and modified simple socket-tutorial.
But how can i specify a channel name with this script?

alias test {
if ($sock(test)) { sockclose test }
sockopen test twitchviewerlist.com 80
}

on *:sockopen:test:{
sockwrite -n $sockname GET / HTTP/1.1
sockwrite -n $sockname Host: twitchviewerlist.com
sockwrite -n $sockname user-agent: Mozilla/??
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}

on *:sockread:test:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
echo -ag %temp
goto nextread
}


Dont give a fish - teach to fish!
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Try use this code:

Usage: /test twitch-channel
Example: /test starladder5

Code:
alias test {
  if (!$1) { echo 4 -a Error: Please specify a channel! | return }
  if ($sock(test)) { sockclose test }
  sockopen test twitchviewerlist.com 80
  sockmark test $1
}

on *:sockopen:test:{
  sockwrite -n $sockname GET / $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname user-agent: Mozilla/*
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname $crlf
}

on *:sockread:test:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  echo -ag %temp
  goto nextread
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: May 2015
Posts: 249
splinny Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2015
Posts: 249
Nice, tnx.


Dont give a fish - teach to fish!

Link Copied to Clipboard