mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2015
Posts: 40
J
jimieo Offline OP
Ameglian cow
OP Offline
Ameglian cow
J
Joined: Jan 2015
Posts: 40
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 { }
}


Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
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.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
The com will close when specifying the -d switch with /JSONOpen, assuming you are using my latest version, even if there is an error

Last edited by FroggieDaFrog; 27/01/15 10:14 PM.

I am SReject
My Stuff
Joined: Mar 2015
Posts: 19
B
Pikka bird
Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
I added this to my script and everything beyond it does not work... but the giveaway does work

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
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.

Joined: Mar 2015
Posts: 19
B
Pikka bird
Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
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?


Link Copied to Clipboard