mIRC Homepage
Posted By: jimieo Twitch - Random Number Giveaway :) - 27/01/15 04:16 AM
I made this earlier for my bot, thought I'd share it here.

Enjoy!
Code:
on *:TEXT:!raffle:#:{
  if ($nick isop #) {
    set %raffle $rand(1,100)
    msg $chan /me First person to guess the number between 1 and 100 wins!
  }
}


on *:text:*:#: {
  if ($1- == %raffle) {
    msg $chan /subscribers  
    msg $chan /me Annnnnd $nick is the winner with the number %raffle $+ !!!!!!
    unset %raffle
    .timerraffle 1 10 msg $chan /subscribersoff
  }
  else { }
}

Posted By: westor Re: Twitch - Random Number Giveaway :) - 27/01/15 09:22 AM
Try use this code: http://hawkee.com/snippet/16203/
Posted By: Belhifet Re: Twitch - Random Number Giveaway :) - 27/01/15 09:42 AM
I noticed this in your script westor,

Code:
alias tw_check_follow {
  if (!$1) { return }
  var %u = https://api.twitch.tv/kraken/users/ $+ $2 $+ /follows/channels/ $+ $1 $+ ?limit=1&nocache= $+ $ticks
  var %v = twc_ $+ $ticks
  JSONOpen -ud %v %u
  if (%JSONError) { var %error = 1 | goto end | return }
  var %fc = $json(%v,error)
  if (%fc) { 
    var %msg = $json(%v,message) 
    if (is not following isin %msg) { var %status = 0 }
  }
  :end
  var %status = $json(%v,created_at)
  if (%error) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is NOT following the channel) | goto end2 }
  if (!%status) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is NOT following the channel) }
  elseif (%status) { msg $3 ( $+ $nick $+ ): Giveaway has ended, the winner is: $2 ( $+ $2 is following the channel) }
  :end2
  JSONClose %v
}

Code:
JSONOpen -ud %v %u
stuff
JSONClose %v

but

Code:
      if (d isin %switches) {
        $+(.timer,%com) 1 0 JSONClose $1

Shouldn't need that JSONClose %v.
Posted By: westor Re: Twitch - Random Number Giveaway :) - 27/01/15 10:33 AM
I have added that because if an error occurred the JSONClose is closing the JSON if i did not add this then the JSON connection will be open. is something like /comclose
Posted By: FroggieDaFrog Re: Twitch - Random Number Giveaway :) - 27/01/15 10:04 PM
The com will close when specifying the -d switch with /JSONOpen, assuming you are using my latest version, even if there is an error
Posted By: Blood_Wolf89 Re: Twitch - Random Number Giveaway :) - 24/03/15 07:28 PM
I added this to my script and everything beyond it does not work... but the giveaway does work
Posted By: Bramzee Re: Twitch - Random Number Giveaway :) - 24/03/15 10:49 PM
That's because of this:

Code:
on *:text:*:#: {
  if ($1- == %raffle) {
    msg $chan /subscribers  
    msg $chan /me Annnnnd $nick is the winner with the number %raffle $+ !!!!!!
    unset %raffle
    .timerraffle 1 10 msg $chan /subscribersoff
  }
  else { }
}


Open your scripts editor and go to file > new.
Put the script in there rather than mix them all together. Also, try remaining organized by renaming each file to whatever it corresponds to (ie: Commands, Filters, Giveaways, etc...) that way when you want to add/remove/edit something you can find it a little easier.
Posted By: Blood_Wolf89 Re: Twitch - Random Number Giveaway :) - 24/03/15 11:49 PM
So should I make a new script for each thing I have? I have things like permit urls, uptime, roulette, rps, bf4stats(with json parse) and if so should I put bf4stats and bfhstats and bf3stats all in the same file?
© mIRC Discussion Forums