mIRC Twitch Bot Script Help

By TheBrohman on Dec 11, 2014

Hello! I need help with finding out why this code isn't working. My points system is working but I dont know why the commands for the raffle isnt working as they should. I can type them in but they return the msg saying it is not open/closed. Please help! :)

on *:text:!raffleopen:#: {
  if ($nick isop #) {
    if (%raffle == 0) {
      msg $chan RAFFLE IS NOW OPEN! You now have 2 minutes to enter!
      set %raffle 1
      write -c Raffle.txt
      .timerClose 1 120 set %raffle = 2
      } else {
      msg $chan $nick the raffle is not closed!
    }
  }
}

on *:text:!raffleclose:#: {
  if ($nick isop #) {
    if (%raffle == 1) {
      msg $chan RAFFLE IS NOW CLOSED!
      set %raffle 2
      } else {
      msg $chan $nick raffle is not open!
    }
  }
}

on *:text:!raffleroll:#:{
  if ($nick isop #) {
    if (%raffle == 2) {
      var %user = $read(Raffle.txt, n)
      msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK TO THOSE WHO PARTICIPATED!
      .timerOne 1 1 msg $chan /me 5!
      .timerTwo 1 1 msg $chan /me 4!
      .timerThree 1 1 msg $chan /me 3!
      .timerFour 1 1 msg $chan /me 2!
      .timerFive 1 1 msg $chan /me 1!
      .timerSix 1 6 msg $chan AND THE WINNER IS:
      .timerSeven 1 7 msg $chan Congratulations %user !!!!
      set %raffle = 0
      write -c Raffle.txt
    }
  }
}

on *:text:!ticket &:#: {
  if (%raffle == 1) {
    if ($2 > 10) {
      msg $chan Sorry $nick! You can only buy up to 10 tickets!
    }
    if ($2 <= 10) {
      var %i = 0
      var %ticket = $2
      var %topic = $+(#,.,$nick)
      var %user = $readini(Points.ini,%topic,Points)
      var %end = 20 * %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 have bought %ticket tickets with %end BrohPoints!
      }
    }
  }
  if (%raffle == 2) {
    msg $chan $nick you can not buy tickets now, since the raffle is closed!
    } elseif (%raffle == 0) {
    msg $chan $nick you can not buy tickets now, since the raffle is closed!
  }
}

Comments

Sign in to comment.
TheBrohman   -  Dec 17, 2014

Noone who can help me? :S

Paper0rPlastic  -  Dec 18, 2014

Try this

on *:text:!raffleopen:#: {
  if ($nick isop #) {
    if (!%raffle) {
      msg $chan RAFFLE IS NOW OPEN! You now have 2 minutes to enter!
      set %raffle 1
      write -c Raffle.txt
      .timerClose 1 120 set %raffle = 2
      } 
    else {
      msg $chan $nick the raffle is not closed!
    }
  }
}

on *:text:!raffleclose:#: {
  if ($nick isop #) {
    if (%raffle == 1) {
      msg $chan RAFFLE IS NOW CLOSED!
      set %raffle 2
      } 
    else {
      msg $chan $nick raffle is not open!
    }
  }
}

on *:text:!raffleroll:#:{
  if ($nick isop #) {
    if (%raffle == 2) {
      var %user = $read(Raffle.txt, n)
      msg $chan RAFFLE IS NOW BEING ROLLED, GOOD LUCK TO THOSE WHO PARTICIPATED!
      .timerOne 1 1 msg $chan /me 5!
      .timerTwo 1 1 msg $chan /me 4!
      .timerThree 1 1 msg $chan /me 3!
      .timerFour 1 1 msg $chan /me 2!
      .timerFive 1 1 msg $chan /me 1!
      .timerSix 1 6 msg $chan AND THE WINNER IS:
      .timerSeven 1 7 msg $chan Congratulations %user !!!!
      unset %raffle
      write -c Raffle.txt
    }
  }
}

on *:text:!ticket &:#: {
  if (%raffle == 1) {
    if ($2 > 10) {
      msg $chan Sorry $nick! You can only buy up to 10 tickets!
    }
    if ($2 <= 10) {
      var %i = 0
      var %ticket = $2
      var %topic = $+(#,.,$nick)
      var %user = $readini(Points.ini,%topic,Points)
      var %end = 20 * %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 have bought %ticket tickets with %end BrohPoints!
      }
    }
  }
  elseif (%raffle == 2) {
    msg $chan $nick you can not buy tickets now, since the raffle is closed!
    }
  elseif (!%raffle) {
    msg $chan $nick you can not buy tickets now, since the raffle is closed!
  }
}
Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.