Lottery System!

By Trav on Jan 02, 2008

I haven't written a script for a few months since my bot broke down, and I was really mad, but I'm starting it again and by vote my users chose the newest command to be a lottery one.

Now I'm still not very good at scripting, but this is a really good one for me, even though it doesn't really use any advance scripts.

Also, thanks to Shadowmajestic, admin of http://www.revpermin.com/ for helping me with the if statement in the !joinlottery part.

Anyways, this is how it works!!!

Here are user commands...

!lottery
Gives info about the lottery
!startlottery
Pms the owner to start it
!joinlottery
Once the lottery has started, to 'submit a ballot with your name on it'
!admin
If they've won, can choose this to be admin for the day
*!box
If they've won, can choose the mystery box (filled with 6 different things, 3 of which are nothing)

Bot's Commands

Right click anywhere in channel and choose Lottery>On. This will start it.
Right click anywhere in channel and choose Lottery>Off. This will end it.

FEATURES
Pretty lame preset mystery box choices etc.
Security so someone can't submit their name twice, or when it's off.
Security so you don't get a "mystery box" or "Admin" message from non-winners
Everything already done for you, for the FULLY AUTOMATED system to work, all you have to do is Right Click>Lottery>On, and everything will be doen for you.
No changes in the code, either;this means you don't have to edit the code AT ALL unless you choose to edit something.

Hope you enjoy :D

on *:LOAD:{
remove box.txt | write box.txt You have won the $me Administrator for a week! | write box.txt You have won Infinite $me V.I.P Spot-This means your suggestions will be highly valued and I'll try my best to listen to your commands. | write box.txt You have won the Admin for a Day | write box.txt You have won Nothing, sorry. | write box.txt You have won Nothing, sorry. | write box.txt You have won Nothing, sorry. }

menu channel {
  Lottery
  .On:set %lottery on | echo 7LOTTERY IS ON | amsg 3-4[ $me ]3-12The lottery has started!!! You have 5 minutes to join! To join, just type 3!joinlottery4 and to learn more about the lottery type 3!lottery | timer 1 10 set %winner $read(lottery.txt) | timer 1 300 amsg 3-4[ $me ]3-12The lottery has ended! The winner is.......4 %winner | timer 1 305 msg %winner Congratulations, %winner -you have won the lottery! Now, you can either choose to be a $me admin for a day, or choose the Mystery Box!(It's filled with good and bad things, the one chosen is completly random!) To be admin, type 3!admin4 and to choose the Mystery Box  type 3!box | timer 1 301 set %lottery off | timer 1 310 remove lottery.txt
  .Off:set %lottery off | echo 7LOTTERY IS OFF
}

on *:TEXT:!joinlottery:#:{
  if ($read(lottery.txt,w,$nick)) { halt } 
  if (%lottery == on) { write lottery.txt $nick | notice $nick You have been added to the list }
} 

on *:TEXT:!startlottery:#:{ msg $me 3-4[ $me ]3-12 $nick from $chan has requested that you start the lottery!
}

on *:TEXT:!lottery:#:{
  msg $nick 3-4[ $me ]3-12The Lottery is a fun, simple, and interactive command on $me
  msg $nick 3-4[ $me ]3-12To begin the lottery, I must activate it. If you feel like having a lotter, type 3!startlottery4 This will not automatically start it, but it will tell me that you have said this.
  msg $nick 3-4[ $me ]3-12If I choose to start it, every channel I'm on will be alerted of such. You have 5 minutes to type 3!joinlottery4 and to join it, there's no cost. You can't submit your name twice, I've made precautions against this.
  msg $nick 3-4[ $me ]3-12After 5 minutes, a name will be randomly selected from those submitted, and all the channels will be alerted of the winner. The winner will get a message, offering either admtxtstrationship for a day, or a mystery box. They can type 3!admin4 or 3!box
}

on *:TEXT:!admin:#:{
  if ($nick == %winner) { msg $me 3-4[ $me ]3-12 $nick from $chan was the winner from the lottery, and chose the !admin command. | msg $nick You're request has been sent. }

  on *:TEXT:!box:#:{
    if ($nick == %winner) {
      set %box $read(box.txt) | msg $me 3-4[ $me ]3-12 $nick from $chan has won %box | msg $nick %bot

  } }

Comments

Sign in to comment.
jaystew   -  Sep 05, 2009

I sort of like this script but to me its nothing like the lottery as no numbers are picked etc. I rhink the 5 minute wait abit long too lol. Nice work though 0 yes i know th elast post was nov 19 2008 lol

 Respond  
pylens   -  Nov 19, 2008

can you finish this script ?

 Respond  
Kirby   -  Oct 02, 2008

Also, you're missing a bracket on !admin and for !box, something's wrong there.

 Respond  
Kirby   -  Oct 02, 2008

Hey there, I like your script. xD

However, it messages to the user 'Congratulations' and not the %winner.

So instead of:

timer 1 305 msg %winner Congratulations, %winner -you have won the lottery!
use:
timer 1 305 //msg %winner Congratulations, %winner - you have won the lottery!

Two slashes recognizes $'s and vars.

 Respond  
Trav   -  May 11, 2008

If set % never works change set to var

 Respond  
Mitchell   -  May 10, 2008

I myself wanted to write a lottery script. I had never seen one on here before, so I was intending on writing my own, but I decided to check for a lottery script, and up came yours. I must say, it is pretty nice, especially your choice of prizes. My idea of a lottery script probably not as good. So good work, it looks nice. I tried it out on my bot, but it doesn\'t seem to want to set %winner. Any ideas if there is something wrong that would not set %winner? I too am a beginner with scripts, but I will try to fool around with it.

 Respond  
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.