need help with a twitch bot - 30/08/14 03:38 AM
I am working on an mIRC bot with a point system and a raffle give away feature where people can enter. I have everything working but the raffle part of it. I followed a youtube series for the code but it doesnt seem to be working. here is a copy of the code:
Code:
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:!points:#:{ 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:/!points (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 300 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) } on *:TEXT:!buyticket &:#:{ if (%raffle == 1) { if ($2 > 10) { msg $chan Sorry $nick but you can only up to 10 tickets } if ($2 < 11) { var %i = 0 var %ticket = $2 var %topic = $+(#,.,$nick) var %user = $readini(Points.ini,%topic,Points) var %end = 10 * %ticket var %delete = %user - %end if (%delete > 0) { writeini -n Points.ini %topic Points %delete while (%i < %ticket) { write Raffle.txt $nick %i = %i + 1 } msg $chan $nick you have bought %ticket tickets with %end points. } if (%delete < 0) { msg $chan Sorry $nick you don't have enough points to buy %ticket tickets! } } } if (%raffle == 0) { msg $chan Raffle is currently closed! } } on *:TEXT:!raffle open:#:{ if ($nick isop #) { if (%raffle == 0) { msg $chan RAFFLE IS NOW OPEN!! set %raffle 1 write -c Raffle.txt } } } on *:TEXT:!raffle close:#:{ if ($nick isop #) { if (%raffle == 1) { msg $chan RAFFLE IS NOW CLOSED!! set %raffle 0 write -c Raffle.txt } } } on *:TEXT:!roll:#:{ if ($nick isop #) { if (%raffle == 1) { var %user = $read(Raffle.txt, n) msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK!! .timerOne 1 1 msg $chan /me 5! .timerTwo 1 2 msg $chan /me 4! .timerThree 1 3 msg $chan /me 3! .timerFour 1 4 msg $chan /me 2! .timerFive 1 5 msg $chan /me 1! .timerSix 1 6 msg $chan AND THE WINNER IS: .timerSeven 1 7 msg $chan %chat set %raffle 0 write -c Raffle.txt } } }