mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 4 1 2 3 4
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: powerade661
Weird. It's saying insufficient parameters.


Try change the line of the above code to : $followcount($mid($chan,2))


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Remove the # tag from the #channel. The url would become https://api.twitch.tv/kraken/channels/#channel instead of https://api.twitch.tv/kraken/channels/channel

Changes to the code:
Code:
alias followcount {
  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $1
  return $json(followcount, followers)
}
on *:text:!viewers:#:{
msg # $followcount($mid($chan,2)) people following and w/e you want.
}


type " /help $mid " for further understanding, but essentially it takes the 2nd letter (c) from $chan (#channel) and everything behind it and makes it (channel)


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Posting since no one has linked my JSON parser yet.

(Geez people, if you are going to talk about it, give the link so users don't have to jump all over the board looking for it :P )

Also:
Code:
on *:text:!viewers:#:{
  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
  msg # $json(followcount, followers) people following and w/e you want.
}

Last edited by FroggieDaFrog; 23/05/15 04:36 PM.

I am SReject
My Stuff
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Thank you so much Froggie! Last question, you will see exactly what I am trying to do once you look at the code. Thank you guys for all of your help. I could not have done this without you. Also in this code, is it possible to make it to when the streamer leaves, it is turned off? would you do

on !*:PART:$chan:{
.timer.update off

Code:
on *:text:*:#: {
  if ($strip($1) == !viewerupdate) {
    if ($strip($2) == $null) {
      msg $chan Viewer Update Has Been Started 
      .timer.update 0 10 sayviewers $chan zacbot661 nightbot wizebot
    }
    if ($strip($2) == off) {
      msg $chan Viewer Update has been stopped
      .timer.update off
    }
  }
}

alias sayviewers {
  set %viewers $nick($1,0)
  var %v = 1
  while (%v <= $nick($1,0)) {
    if ($istok($2-,$nick($1,%v),32)) {
      dec %viewers 1
    }
    inc %v
  }

  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
  msg followers -> # $json(followcount, followers) $1 Viewers -> %viewers

}




Last edited by powerade661; 23/05/15 06:58 PM.
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Use json for https://api.twitch.tv/kraken/streams/ $+ %streamer_name - returns error when offline.


Dont give a fish - teach to fish!
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
Yeah you got that right, just add it to the remote.
Although it's not nessecary i would do it this way
Code:
on *:part:#: {
if ($timer(.update)) {
.timer.update off
}
}

Added an if which checks if the timer is active, in order to avoid error messages.

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
So I would put this below the rest of the code? So this just checks if the timer is off? Or does it also check if it's on? I don't really understand what you have done here.
Also I had to exclude my channel otherwise it would count me as a viewer. It's not excluding $chan frown Also is it possible to exclude the # and just put the channel name?

Last edited by powerade661; 23/05/15 07:43 PM.
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
It checks if the timer is on and if it is it does /timer.update off
Yes smile just put it under the rest of the code and yes you can replace # with your channel
Code:
on *:part:#channel: {
if ($timer(.update)) {
.timer.update off
}
}

wink this will only work for #channel ,replace #channel with the channel you want it to work for

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
It won't work for any channel? on*:part $chan ? That doesn't work for all channels? If one channels leave it disables the timer for that channel?

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
The whole script is made so that it sends the msg to the channel where you gave the command !viewerupdate .
Now, do you want the timer to stop when someone parts that channel ?
If so, use this code instead:
Code:
on *:text:*:#: {
  if ($strip($1) == !viewerupdate) {
    if ($strip($2) == $null) {
set %viewerschan $chan
      msg $chan Viewer Update Has Been Started 
      .timer.update 0 10 sayviewers $chan zacbot661 nightbot wizebot
    }
    if ($strip($2) == off) {
      msg $chan Viewer Update has been stopped
      .timer.update off
    }
  }
}

alias sayviewers {
  set %viewers $nick($1,0)
  var %v = 1
  while (%v <= $nick($1,0)) {
    if ($istok($2-,$nick($1,%v),32)) {
      dec %viewers 1
    }
    inc %v
  }
  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
  msg followers -> # $json(followcount, followers) $1 Viewers -> %viewers
}

on *:part:#: {
if ($chan == %viewerschan) {
if ($timer(.update)) {
.timer.update off
}
}
}

Example:
If you start the timer in #test , if someone parts from #test the timer will be stopped.
If someone parts #blabla the timer wont stop smile

Last edited by OrFeAsGr; 23/05/15 08:09 PM.
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I want to make it so that if the streamer leaves the timer stops.

I thought that is what $chan was. Am I missing something? I was able to remove the # by doing $remove(#,$chr(35)) the only issue now is uppercasing the first letter for the channel. So in order to get it for the stream channel I would have to do on *:part:#channel for each individual streamer?

Last edited by powerade661; 23/05/15 08:19 PM.
Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
the last code i gave you will stop the timer if someone parts the channel smile

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
But is that if anyone parts the channel? Or just the streamer, the timer stops? Sorry I am being so meticulous. Wait a second

if ($chan == %viewerschan) { that's how it knows if the streamer parted? Am I wrong or right?

Last edited by powerade661; 23/05/15 08:36 PM.
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Originally Posted By: powerade661
But is that if anyone parts the channel? Or just the streamer, the timer stops? Sorry I am being so meticulous. Wait a second

if ($chan == %viewerschan) { that's how it knows if the streamer parted? Am I wrong or right?


@powerade661, if you pay attention what does @OrFeaSGr saying you will be able to understand..


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I see it now, sorry OrFeAsGr.

Last edited by powerade661; 23/05/15 08:45 PM.
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Do I have to close the JSONopen? It doesn't update the followers in other channels. It worked for one channel and then another, and then it stayed with one channel and it won't update anymore. frown I have no idea what is going on.

Code:
on *:text:*:#: {
  if ($strip($1) == !viewerstatus) {
    if ($strip($2) == $null) {
      sayviewers $chan zacbot661 nightbot wizebot coolkid661

    }
  }
}

alias sayviewers {
  set %viewers $nick($1,0)
  var %v = 1
  while (%v <= $nick($1,0)) {
    if ($istok($2-,$nick($1,%v),32)) {
      dec %viewers 1
    }
    inc %v
  }

  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
  msg # Stream status for $remove(#,$chr(35)) Followers: # $json(followcount, followers) Viewers: %viewers
}

Last edited by powerade661; 24/05/15 12:34 AM.
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Guys I do apologize. The computer I was hosting the bot on was very slow and I just figured out why it wasn't working very well. One core was slower than the other and after making changes, the script works very efficiently. Thanks for your time and patience with me.

Last edited by powerade661; 24/05/15 03:07 AM.
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
It's not putting the message in the chat, only through TMI. Any ideas? It only updates the followers if I restart mIRC. -_- This is so confusing.

Code:
on *:text:*:#: {
  if ($strip($1) == !viewerupdate) {
    if ($strip($2) == $null) {
set %viewerschan $chan
      msg $chan Viewer Update Has Been Started 
      .timer.update 0 60 sayviewers $chan intellibot_v2.0 nightbot wizebot
    }
    if ($strip($2) == off) {
      msg $chan Viewer Update has been stopped
      .timer.update off
    }
  }
}

alias sayviewers {
  set %viewers $nick($1,0)
  var %v = 1
  while (%v <= $nick($1,0)) {
    if ($istok($2-,$nick($1,%v),32)) {
      dec %viewers 1
    }
    inc %v
  }
  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid(#, 2-)
  msg # Stream update, followers: $json(followcount, followers) Viewers: %viewers
}

on *:part:#: {
if ($chan == %viewerschan) {
if ($timer(.update)) {
.timer.update off
}
}
}

Last edited by powerade661; 24/05/15 03:58 AM.
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Does anyone have any idea why this is happening? It's still not placing the message in the chat and it's not updating the follower count unless I restart mIRC. Also I am thinking the timer is stopping if someone leaves the stream, instead of the streamer.

Last edited by powerade661; 24/05/15 07:35 PM.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
change msg # to msg $1 in sayviewers

and because I'm a nice person with a nack for mSL:
Code:
on $*:text:/^!viewerupdate(\s|$)/Si:#: {
  if ($2 == off && $timer(FollowerUpdate $+ $cid $+ #)) {
    $+(.timerFollowerUpdate,$cid,#) off
  }
  elseif ($0 == 1) {
    msg $chan Viewer Update Has Been Started 
    $+(.timerFollowerUpdate,$cid,#) 0 60 sayviewers $chan intellibot_v2.0 nightbot wizebot
  }
}

on *:part:#: {
  if ($mid(#, 2-) == $nick && $timer(FollowerUpdate $+ $cid $+ #)) {
    $+(.timer,$v1) off
  }
}

alias sayviewers {
  var %i = 1, %viewers = 0
  while (%i <= $nick($1, 0)) {
    if (!$istok($2-, $nick($1, %i), 32)) {
      inc %viewers
    }
    inc %v
  }
  JSONOpen -ud followcount https://api.twitch.tv/kraken/channels/ $+ $mid($1, 2-)
  msg $1 Stream update, followers: $json(followcount, followers) Viewers: %viewers
}

Last edited by FroggieDaFrog; 24/05/15 07:44 PM.

I am SReject
My Stuff
Page 2 of 4 1 2 3 4

Link Copied to Clipboard