mIRC Home    About    Download    Register    News    Help

Print Thread
Twitch bot- raffle and point system help? #252792 11/05/15 11:40 PM
Joined: Dec 2014
Posts: 18
D
dailyproblem Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Does anyone have a working raffle and point system they can link me to?
I would like
It to add one point per minute.
!bal- tells player balance
!bal (name)- checks other players balance if mod
!bal add (name) (amount) -adds points to someones balance
!bal remove (name) (amount) -takes points
!top {number) -shows the highest points and who has them (max 25)

!buy (amount) -It takes 50 points per ticket
!winner (if streamer) -randomly chooses the winner of the raffle
!raffle start(if streamer)- starts the raffle
!raffle end(if streamer)- ends the raffle

Re: Twitch bot- raffle and point system help? [Re: dailyproblem] #252806 12/05/15 09:09 PM
Joined: Dec 2014
Posts: 18
D
dailyproblem Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Oops, this is what I have so far.
Code:

======POINTS======



on *:TEXT:!top10:#:{
  { top10 # } 

}

alias -l top10 {
  window -h @. | var %i 1
  while $gettok($remove($read(points.ini,w,$+(*,$1,*),%i),[,]),2,46) {
    var %n $v1, %p $gettok($read(points.ini,$calc($readn + 1)),2,61)
    aline @. %n %p
    var %i $calc($readn + 1)
  }
  filter -cetuww 2 32 @. @.
  var %i 1 | while %i <= 10 {
    var %list $addtok(%list,$line(@.,%i),44)
    inc %i
  }
  msg $1 Top 10 point are: $replace(%list,$chr(44),$+($chr(44),$chr(32)))
  window -c @.

}



alias -l addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
  var %topic $+($chan,.,$nick)
  var %points $calc($readini(Points.ini,%topic,Points) + $1)
  writeini -n Points.ini %topic Points %points
  return %points
}

alias -l lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,%topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points %points
  echo -a Added points for %topic
}

alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}

on *:text:!bal:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}

on $*:text:/!bal (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points.
  }
  else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 60 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}



========RAFFLE========


on *:TEXT:!ticket &:#:{
  if (%open == 1) {
    if ($2 > 50) {
      msg $chan $nick $+ , you cannot buy that many tickets!
    }
    if ($2 < 51) {
      var %i = 0
      var %count = $2
      var %topic = $+(#,.,$nick)
      var %user = $readini(Points.ini,%topic,Points)
      var %final = 50 * %count
      var %remove = %user - %final
      if (%remove > 0) {
        writeini -n Points.ini %topic Points %remove
        while (%i < %count) {
          write Raffle.txt $nick
          %i = %i + 1
        }
        msg $chan $nick $+ , has bought %count tickets spending %final points!
      }
      if (%remove < 0) {
        msg $chan Sorry $nick but you don't have enough points to buy %count tickets!
      }
    }
  }
}
on *:TEXT:*:#:{
  if ($nick == dailyproblem)  {
    if ($1 == !raffle) {
      if ($2 == start) {
        msg $chan /me [RAFFLE STARTED]
        set %open 1
        write -c Raffle.txt
        echo -a Raffle Started
      }
      if ($2 == end) {
        msg $chan /me [RAFFLE CLOSED]
        set %open 0
        write -c Raffle.txt
        echo -a Raffle Closed
      }
    }
    if ($1 == !winner) {

      if (%open == 1) {

        var %user = $read(Raffle.txt,n)
        write -c Raffle.txt
        set %open 0
        msg $chan /me And the winner is... %user $+ !!! Well Done!
        echo -a Raffle Closed
      }
    }
  }
  if ($1 == !Entries) {
    if (%open == 1) {
      msg $chan There are currently $lines(Raffle.txt) tickets entered into the raffle!
    }
  }
}




Re: Twitch bot- raffle and point system help? [Re: dailyproblem] #252807 12/05/15 09:19 PM
Joined: May 2015
Posts: 4
J
james_jimjam Offline
Self-satisified door
Offline
Self-satisified door
J
Joined: May 2015
Posts: 4
I was about to ask a similar question!! i grabbed the code from this thread .

It works and counts the user's points fine but i just cannot get it to run ANY of the commands at all! I have only changed one thing which is changing the !points to !cookies as this is the name i wish to use.

You have actually helped me anyway as i need the raffle system next!!
I will be interested in any replies you get!

Thanks

james_jimjam

p.s. my bot is already active in my channel on twitch so i can test it

Last edited by james_jimjam; 12/05/15 09:20 PM.
Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252808 12/05/15 10:45 PM
Joined: May 2015
Posts: 11
S
scdudedark Offline
Pikka bird
Offline
Pikka bird
S
Joined: May 2015
Posts: 11
Code:
[script]
n0=on *:TEXT:Hello:#: {
n1=  if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return }
n2=  set -u10 %floodhello On
n3=  set -u30 %floodhello. $+ $nick On
n4=  msg $chan Welcome $nick to the SCDudeDark Show! 
n5=}
n6=on *:TEXT:Hi:#: {
n7=  if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return }
n8=  set -u10 %floodhi On
n9=  set -u30 %floodhi. $+ $nick On
n10=  msg $chan Welcome $nick to the SCDudeDark Show! 
n11=}
n12=on *:TEXT:Sup:#: {
n13=  if ((%floodcommands) || ($($+(%,floodcommands.,$nick),2))) { return }
n14=  set -u10 %floodsup On
n15=  set -u30 %floodsup. $+ $nick On
n16=  msg $chan Welcome $nick to the SCDudeDark Show! 
n17=}
n18=
n19=alias -1 addPoints {
n20=  if ($1 !isnum) (echo 2 -st $1 is not a number. It needs to be a number. | halt )
n21=  var %topic $+($chan,.,$nick)
n22=  var %points $calc($readini(Points.ini,%topic,Points) + $1)
n23=  writeini -n Points.ini %topic Points %points
n24=  return %points
n25=}
n26=alias -1 lookUpPoints {
n27=  var %topic $+($chan,.,$nick)
n28=  var %points $readini(Points.ini,%topic,Points)
n29=  return %points
n30=}
n31=alias doaddpoints {
n32=  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
n33=  var %topic $+($1,.,$2)
n34=  var %points $calc($readini(Points.ini,%topic,Points) + $3)
n35=  writeini -n Points.ini %topic Points %points
n36=  echo -a Added points for %topic
n37=}
n38=alias dorempoints {
n39=  var %topic $+($1,.,$2)
n40=  remini -n Points.ini %topic Points
n41=  echo -a Removed points for %topic
n42=}
n43=on *:text:!Scars cut*:#: {
n44=  if ($0 != 4) || ($4 !isnum) {
n45=    msg $chan Insufficient or incorrect parameters: use !Scars cut [user] [number]
n46=    Halt
n47=  }
n48=  if ($4 <= 0) {
n49=    msg $chan $nick you cannot give someone less than 1 Scar.
n50=    halt
n51=  }
n52=  if ($readini(Points.ini,$+(#,.,$3),Points) = $null) {
n53=    msg $chan $nick That person isn't registered to The SCDudeDark Show, please check your spelling or that you have the correct name and try again.
n54=    Halt
n55=  }
n56=  else {
n57=    if ($readini(Points.ini,$+(#,.,$nick),Points) >= $4) {
n58=      writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) + $4)
n59=      writeini -n Points.ini $+(#,.,$nick) Points $calc($readini(Points.ini,$+(#,.,$nick),Points) - $4)
n60=      msg $chan $nick has given $4 of their Scars to $3, $3 now has $readini(Points.ini,$+(#,.,$3),Points) Scars and $nick now has $readini(Points.ini,$+(#,.,$nick),Points).
n61=      halt
n62=    }
n63=    elseif ($readini(Points.ini,$+(#,.,$nick),Points) < $4) {
n64=      msg $chan $nick you do not have that many Scars to give.
n65=      halt
n66=    }
n67=  }
n68=}
n69=on *:text: !scars:#:{ msg # $nick the chicks really dig your $readini(Points.ini,$+(#,.,$nick),Points) Scars!
n70=}
n71=on $*:TEXT:/!Scars (add|remove)/Si:#:{
n72=  if ($nick = SCDudeDark) {
n73=    if ($0 < 3) { msg # Insufficient parameters: Use !Scars <add|remove> <user> [number] | return }
n74=    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
n75=    { msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total Scars. }
n76=  }
n77=  else { msg $chan /me Only SCDudeDark can give you more Scars! Punches $nick }
n78=}
n79=ON !*:join:#:{
n80=  $+(.timerpoints.,#,.,$nick) 0 600 add.pts $+(#,.,$nick)
n81=  add.pts $+(#,.,$nick)
n82=  if ((%floodjoin) || ($($+(%,floodjoin.,$nick),2))) { return }
n83=  set -u10 %floodjoin On
n84=  set -u30 %floodjoin. $+ $nick On
n85=}
n86=ON !*:part:#:$+(.timerpoints.,#,.,$nick) off 
n87=alias -l add.pts {
n88=  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
n89=}

Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252809 12/05/15 10:52 PM
Joined: May 2015
Posts: 11
S
scdudedark Offline
Pikka bird
Offline
Pikka bird
S
Joined: May 2015
Posts: 11
Code:
[script]
n0=on *:TEXT:!getskull &:#:{
n1=  if (%open == 1) {
n2=    if ($2 > 10) {
n3=      msg $chan $nick $+ , you can't hold that many Skulls!
n4=    }
n5=    if ($2 < 11) {
n6=      var %i = 0
n7=      var %count = $2
n8=      var %topic = $+(#,.,$nick)
n9=      var %user = $readini(Points.ini,%topic,Points)
n10=      var %final = 10 * %count
n11=      var %remove = %user - %final
n12=      if (%remove > 0) {
n13=        writeini -n Points.ini %topic Points %remove
n14=        while (%i < %count) {
n15=          write Raffle.txt $nick
n16=          %i = %i + 1
n17=        }
n18=        msg $chan $nick $+ , has grabbed %count skulls spending %final Scars!
n19=      }
n20=      if (%remove < 0) {
n21=        msg $chan Sorry $nick but you don't have enough Scars to grab %count Skulls!
n22=      }
n23=    }
n24=  }
n25=}
n26=on *:TEXT:*:#:{
n27=  if ($nick isop #) {
n28=    if ($1 == !Bag) {
n29=      if ($2 == open) {
n30=        msg $chan /me Pulls out a big bag of Skulls and dumps them on the ground! Type !getSkull and a number 1-10 to grab a chance at winning
n31=        set %open 1
n32=        write -c Raffle.txt
n33=        echo -a Raffle Started
n34=      }
n35=      if ($2 == close) {
n36=        msg $chan /me Closes the bag!
n37=        set %open 0
n38=        write -c Raffle.txt
n39=        echo -a Raffle Closed
n40=      }
n41=    }
n42=    if ($1 == !draw) {
n43=      if (%open == 1) {
n44=        var %user = $read(Raffle.txt,n)
n45=        write -c Raffle.txt
n46=        set %open 0
n47=        msg $chan /me grabs a skull from the bag! %user $+ !!! Your Skull wins!
n48=        echo -a Raffle Closed
n49=      }
n50=    }
n51=  }
n52=  if ($1 == !Skulls) {
n53=    if (%open == 1) {
n54=      msg $chan There are currently $lines(Raffle.txt) Skulls in my bag!
n55=    }
n56=  }
n57=}

and thats my raffle code first was my point code you just need to change point names to whatever you like and the commands to your preference

Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252831 13/05/15 04:00 AM
Joined: Dec 2014
Posts: 18
D
dailyproblem Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2014
Posts: 18
Make sure to change where it say dailyproblem to your name(all undercase) so that way only you can start the raffle

Re: Twitch bot- raffle and point system help? [Re: scdudedark] #252906 16/05/15 04:42 PM
Joined: May 2015
Posts: 4
J
james_jimjam Offline
Self-satisified door
Offline
Self-satisified door
J
Joined: May 2015
Posts: 4
I copied and pasted your code and changed the names, commands etc and the messages it displays. the command to check points is !cookies but when i type it from either the streamer account, the bot account or my test account it doesn't work. Literally no output whatsoever?! Any ideas anyone?!

Thanks in advance

james_jimjam

Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252907 16/05/15 04:56 PM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Not sure about "test account", but probably there is some restrictions about nick=bot\streamer. And may be your test account have no points cos never watched your stream or about..


Dont give a fish - teach to fish!
Re: Twitch bot- raffle and point system help? [Re: splinny] #252908 16/05/15 05:05 PM
Joined: May 2015
Posts: 4
J
james_jimjam Offline
Self-satisified door
Offline
Self-satisified door
J
Joined: May 2015
Posts: 4
my test account is a normal twitch account but with _test appended to the username. in the points file it displays about 50 points for all of the accounts but as i said, it just doesnt reply with anything?!

Thanks

Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252909 16/05/15 07:56 PM
Joined: May 2015
Posts: 11
S
scdudedark Offline
Pikka bird
Offline
Pikka bird
S
Joined: May 2015
Posts: 11
did you try my previous command? !scars if it activate for my command you need to go back and find the command line and just double check it has been changed its a common error the command line is kinda small and easy to overlook if that doesn't work let me know I can visit your channel see if I can help more [edit] pretty sure its line 69 or so

Last edited by scdudedark; 16/05/15 07:57 PM.
Re: Twitch bot- raffle and point system help? [Re: scdudedark] #252914 17/05/15 09:50 AM
Joined: May 2015
Posts: 4
J
james_jimjam Offline
Self-satisified door
Offline
Self-satisified door
J
Joined: May 2015
Posts: 4
Hi,
I managed to work it out. I had a caps lock protection script which looks at all text therefore it got to that section of the script and as !cookies would match on :TEXT:* that meant it would run that code then stop. I moved the caps lock protection to the bottom, edited the raffle code a bit and it worked perfectly! Thanks for your help.

james_jimjam

Re: Twitch bot- raffle and point system help? [Re: james_jimjam] #252926 17/05/15 05:34 PM
Joined: May 2015
Posts: 11
S
scdudedark Offline
Pikka bird
Offline
Pikka bird
S
Joined: May 2015
Posts: 11
Your welcome glad I could help