on *:load:{ echo -a 9,1Thanks for Loading Liths Raffle! :P Pretty easy to use, right click on the chat channel, and select "IRC Raffle" and then "Start Raffle". Answer any questions it might have. You may also change options, report raffle status, and even modify the raffle itself. set %irc_raffle_winner_delay 1 set %irc_raffle_report_delay 10 set %irc_raffle_winner.timelimit 10 } on *:text:gimmie:?:{ irc_raffle_winner.claim } on *:text:!help*:%irc_raffle_chan:{ if ($2 == $null) { msg %irc_raffle_chan 9,1Available Help Topics/Commands: msg %irc_raffle_chan 9,1!raffle, !who, !available, !removeme } elseif ($2 == !raffle) { msg %irc_raffle_chan 9,1Command !raffle: 7,1Simply type !raffle followed by the number you would like to enter for the raffle. Example: "!raffle 42" would enter you into the raffle as number 42. Please note raffles have only so many slots, and only allow entries as high as the max number of slots. Also only one user can be a specific number at any given time. } elseif ($2 == !who) { msg %irc_raffle_chan 9,1Command !who: 7,1Used to see a list of all users in raffle, and what number they are currently. If followed by a number, lists which user has the specified number. } elseif ($2 == !available) { msg %irc_raffle_chan 9,1Command !available: 7,1Command lists all available numbers open in the raffle. } elseif ($2 == !removeme) { msg %irc_raffle_chan 9,1Command !removeme: 7,1Used to remove yourself from a raffle. Once removed, you are allowed to re-enter, but it is advised you dont abuse this right. If you've changed your nickname, you must switch to the name you used when you entered, to remove yourself from the raffle. } } on *:text:!available*:%irc_raffle_chan:{ if (%irc_raffle_on == 0) { halt } irc_raffle_available } on *:text:!whom*:%irc_raffle_chan:{ if (%irc_raffle_on == 0) { halt } set %xyz $1- set %yz $2 if (%yz > %irc_raffle_slots) { msg %irc_raffle_chan 9,1That Value is not valid for this raffle. Only numbers between 1 and %irc_raffle_slots will work. halt } irc_raffle_who } on *:text:!removeme:%irc_raffle_chan:{ irc_raffle_removeme } on *:text:!raffle*:%irc_raffle_chan:{ if (%irc_raffle_on == 0) { halt } set %irc_raffle_slotvariable 1- $+ %irc_raffle_slots if ($2 == $null) { msg %irc_raffle_chan 8,1 $nick $+ , to select a number, you need to go !raffle #, like !raffle 15, for number 15. Simply going !raffle will not work. halt } if ($2 !isnum %irc_raffle_slotvariable) { msg %irc_raffle_chan 9,1Sorry $nick $+ , that entry is outside of the range of this raffle, this raffle will only accept numbers between 1 and %irc_raffle_slots $+ . halt } set %x 1 set %y $lines(slots.txt) while (%x <= %y) { set %irc_raffle_checknum $read(slots.txt,%x) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) if ($nick == %irc_raffle_name) { msg %irc_raffle_chan 4,1 $+ $nick you already have a number, its %irc_raffle_numb halt } else { inc %x } } irc_raffle $1- } alias irc_raffle_create { set %irc_raffle_entries 0 set %irc_raffle_prize $4- set %irc_raffle_on 1 set %irc_raffle_slots $1 set %irc_raffle_time $2 set %irc_raffle_numwinners $3 set %x 1 write -c slots.txt while (%x <= %irc_raffle_slots) { write slots.txt %x $+ . $+ irc_noname inc %x } set %irc_raffle_start $asctime(h:nn) set %irc_raffle_truetime $ctime set %irc_raffle_end $calc(%irc_raffle_truetime + (%irc_raffle_time * 60)) set %irc_raffle_endseconds %irc_raffle_end set %ampmend $asctime(%irc_raffle_end,TT) set %irc_raffle_end_date $asctime(%irc_raffle_end,m/d/yy) set %irc_raffle_end $asctime(%irc_raffle_end,h:nn) set %ampmstart $asctime(TT) set %irc_raffle_start_date $asctime(m/d/yy) msg %irc_raffle_chan 9,1Raffle started! Raffle will be for  $+ %irc_raffle_prize $+ , 9,1and we have %irc_raffle_slots slots open! Start picking your numbers. Pick with !raffle followed by the number you would like. Valid numbers are between 1 and %irc_raffle_slots $+ . msg %irc_raffle_chan 9,1Raffle Started at %irc_raffle_start $+ %ampm on %irc_raffle_start_date and will continue for %irc_raffle_time minute(s). Raffle will end at %irc_raffle_end %ampmend on %irc_raffle_end_date $+ . set %timer $calc($2 * 60) set %timer2 $calc(%irc_raffle_report_delay * 60) timerircraffle 1 %timer irc_raffle_stopraffle timerircrafflereport 0 %timer2 irc_raffle_report } alias irc_raffle_stopraffle { timerircrafflereport off set %irc_raffle_on 0 msg %irc_raffle_chan 9,1Raffle is over! A winner will be selected in %irc_raffle_winner_delay minute(s). set %timer_winner $calc(%irc_raffle_winner_delay * 60) timerrafflewinner 1 %timer_winner irc_raffle_winner } alias irc_raffle { set %user_number $2 set %user_name $nick set %irc_raffle_checknum $read(slots.txt,$2) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) set %x $2 if (%irc_raffle_name == irc_noname) { write $+(-l,%x) slots.txt %irc_raffle_numb $+ . $+ %user_name msg %irc_raffle_chan 9,1User %user_name is now set to number %irc_raffle_numb in the raffle. inc %irc_raffle_entries } else { msg %irc_raffle_chan 9,1Sorry %user_name $+ , that number is already taken by %irc_raffle_name irc_raffle_available } } alias irc_raffle_available { set %x 1 set %y $lines(slots.txt) set %z $null set %true 1 set %irc_raffle_longmessage 0 set %irc_raffle_listmessage 75 set %irc_raffle_msglenth 0 while (%x <= %y) { set %irc_raffle_checknum $read(slots.txt,%x) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) if (%irc_raffle_name == irc_noname) { if (%true == 1) { inc %true set %z %irc_raffle_numb inc %x inc %irc_raffle_msglenth } else { set %z %z $+ , %irc_raffle_numb inc %irc_raffle_msglenth if (%irc_raffle_msglenth == %irc_raffle_listmessage) { if ((%irc_raffle_msglenth > 74) && (%irc_raffle_msglenth < 150)) { msg %irc_raffle_chan 9,1Currently, the available numbers are %z } else { msg %irc_raffle_chan 9,1 $+ %z } set %irc_raffle_listmessage $calc(%irc_raffle_listmessage + 75) set %irc_raffle_longmessage 1 set %true 1 } inc %x } } else { inc %x } } if ((%irc_raffle_longmessage == 1) && (%irc_raffle_msglenth > 75)) { msg %irc_raffle_chan 9,1 $+ %z $+ . } elseif (%irc_raffle_msglenth == 75) { halt } else { msg %irc_raffle_chan 9,1Currently, the available numbers are %z $+ . } } alias irc_raffle_who { if (%xyz == !who) { set %x 1 set %y $lines(slots.txt) write -c who.txt while (%x <= %y) { set %irc_raffle_checknum $read(slots.txt,%x) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) if (%irc_raffle_name != irc_noname) { write who.txt 9,1 $+ %irc_raffle_name has number %irc_raffle_numb inc %x } else { inc %x } } } else { set %x %yz set %y $lines(slots.txt) write -c who.txt set %irc_raffle_checknum $read(slots.txt,%x) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) if (%irc_raffle_name != irc_noname) { write who.txt 9,1 $+ %irc_raffle_name has number %irc_raffle_numb } else { msg %irc_raffle_chan 9,1Number %yz is currently not reserved for anyone in the raffle. } } play %irc_raffle_chan who.txt 1500 } alias irc_raffle_winner { set %irc_raffle_on 0 set %irc_raffle_numwinners.temp 0 set %irc_raffle_numwinners.true 1 while (%irc_raffle_numwinners.true <= %irc_raffle_numwinners) { inc %irc_raffle_numwinners.temp inc %irc_raffle_numwinners.true set %winner_numb $rand(1,%irc_raffle_slots) set %irc_winner $read(slots.txt,%winner_numb) set %irc_winner_name $gettok(%irc_winner,2,46) set %x 1 while ((%irc_winner_name == irc_noname) && (%x < 5000)) { set %winner_numb $rand(1,%irc_raffle_slots) set %irc_winner $read(slots.txt,%winner_numb) set %irc_winner_name $gettok(%irc_winner,2,46) inc %x } if ((%x < 5000) && (%irc_raffle_numwinners == 1)) { msg %irc_raffle_chan 4,1And our winner is....8,1 $+ %irc_winner_name $+ 9,1! Congrats! 8,1 %irc_winner_name 9,1won with number 8,1 %winner_numb $+ . write $+(-l,%winner_numb) slots.txt %winner_numb $+ . $+ irc_noname set %irc_winnerlist %irc_winner_name } elseif ((%x < 5000)) { if (%irc_raffle_numwinners.temp == 1) { msg %irc_raffle_chan 9,1And our first winner is.... $+ %irc_winner_name $+ ! Congrats! %irc_winner_name won with number %winner_numb $+ . write $+(-l,%winner_numb) slots.txt %winner_numb $+ . $+ irc_noname set %irc_winnerlist %irc_winner_name $+ . } if ((%irc_raffle_numwinners.temp > 1) && (%irc_raffle_numwinners.temp < %irc_raffle_numwinners)) { msg %irc_raffle_chan 9,1And our next winner is.... $+ %irc_winner_name $+ ! Congrats! %irc_winner_name won with number %winner_numb $+ . write $+(-l,%winner_numb) slots.txt %winner_numb $+ . $+ irc_noname set %irc_winnerlist %irc_winnerlist $+ %irc_winner_name $+ . } if ((%irc_raffle_numwinners.temp > 1) && (%irc_raffle_numwinners.temp == %irc_raffle_numwinners)) { msg %irc_raffle_chan 9,1And our last winner is.... $+ %irc_winner_name $+ ! Congrats! %irc_winner_name won with number %winner_numb $+ . write $+(-l,%winner_numb) slots.txt %winner_numb $+ . $+ irc_noname set %irc_winnerlist %irc_winnerlist $+ %irc_winner_name } } else { msg %irc_raffle_chan 9,1No Valid Winner Found, either nobody claimed the prizes and nobody is left, or nobody entered the raffle. ; timer* off halt } } msg %irc_raffle_chan 9,1Please message me "gimmie" to claim your prize. You have %irc_raffle_winner.timelimit minutes to claim your prize before another winner is selected. Please note, if you won more then once, please message me for each win. irc_raffle_winner.timelimit } alias irc_raffle_removeme { set %irc_raffle_removeme.name $nick var %irc_num 1 set %irc_raffle_lines $lines(slots.txt) set %irc_raffle_checknum $read(slots.txt,%irc_num) while (%irc_num <= %irc_raffle_lines) { set %irc_raffle_checknum $read(slots.txt,%irc_num) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) if (%irc_raffle_name == %irc_raffle_removeme.name) { write $+(-l,%irc_num) slots.txt %irc_raffle_numb $+ . $+ irc_noname inc %irc_raffle_entries -1 msg %irc_raffle_chan 9,1Removing %irc_raffle_name $+ 's entry from the raffle. Please note, number %irc_raffle_numb is now available. halt } else { inc %irc_num } } msg %irc_raffle_chan 9,1Unable to find an entry for user $nick $+ . } alias irc_raffle_remove { set %x $1 set %irc_raffle_checknum $read(slots.txt,%x) set %irc_raffle_numb $gettok(%irc_raffle_checknum,1,46) set %irc_raffle_name $gettok(%irc_raffle_checknum,2,46) if (%irc_raffle_name != irc_noname) { write $+(-l,%x) slots.txt %irc_raffle_numb $+ . $+ irc_noname inc %irc_raffle_entries -1 msg %irc_raffle_chan 9,1Removing %irc_raffle_name $+ 's entry from the raffle. Please note, number %irc_raffle_numb is now available. } else { echo -a 4Error: Nobody currently has number %x selected for the raffle, therefore you cannot remove them from it. } } alias irc_raffle_options { set %irc_raffle_winner_delay $?="How many minutes would you like to wait after a raffle stops accepting entries, to auto-select a winner?" set %irc_raffle_report_delay $?="How many minutes between reports to the channel would you like there to be, on the status of the raffle? (Time Left, Entries Accepted, Ect)" set %irc_raffle_winner.timelimit $?="How many minutes would you like to grant the winner of a raffle to contact the bot, before forcing a new winner?" } alias irc_raffle_stop { timerircraffle off timerrafflewinner off timerircrafflereport off set %irc_raffle_on 0 msg %irc_raffle_chan 9,1Raffle has been stopped. No winner will be auto-selected. } alias irc_raffle_report { set %irc_raffle_endtime %irc_raffle_endseconds set %irc_raffle_current_time $ctime set %irc_raffle_minleft $calc((%irc_raffle_endtime - %irc_raffle_current_time) / 60) set %irc_raffle_mins $round(%irc_raffle_minleft,0) if (%irc_raffle_mins < 1) { set %irc_raffle_mins less then one } msg %irc_raffle_chan 9,1R8,1a4,1f13,1f11,1l12,1e 9,1in Progress for 7,1 $+ %irc_raffle_prize $+ 9,1. There are currently 8,1 %irc_raffle_entries 9,1entries with a max of 8,1 %irc_raffle_slots 9,1entries. This raffle will end at 8,1 %irc_raffle_end %ampmend 9,1on 8,1 %irc_raffle_end_date $+ 9,1, which is in 8,1 %irc_raffle_mins 9,1minute(s). To Enter the raffle, simply type "7,1!raffle9,1" followed by the number you would like to have for the drawing.4,1 You must be an original winner to claim the first place prizes. 12,1 Secondary winners only will receive lowest prize listed . 8,1 You must respond with the word "gimmie" within 5 minutes or new winner will be chosen. 9,1 Thanks to Lith for a very cool script!!! } alias irc_raffle_addslots { set %irc_raffle_addslots $?="How many slots would you like to add to the raffle?" set %x $calc(%irc_raffle_slots + 1) set %irc_raffle_slots $calc(%irc_raffle_slots + %irc_raffle_addslots) while (%x <= %irc_raffle_slots) { write slots.txt %x $+ . $+ irc_noname inc %x } msg %irc_raffle_chan 9,1Slots have been added to the raffle! The raffle now has a total of %irc_raffle_slots slots. } alias irc_raffle_restart { set %irc_raffle_restart_slots $lines(slots.txt) set %irc_raffle_on 1 set %irc_raffle_time $?="How long untill you would like this restarted raffle to stop?" set %irc_raffle_start $asctime(h:nn) set %irc_raffle_truetime $ctime set %irc_raffle_end $calc(%irc_raffle_truetime + (%irc_raffle_time * 60)) set %irc_raffle_endseconds %irc_raffle_end set %ampmend $asctime(%irc_raffle_end,TT) set %irc_raffle_end_date $asctime(%irc_raffle_end,m/d/yy) set %irc_raffle_end $asctime(%irc_raffle_end,h:nn) set %ampmstart $asctime(TT) set %irc_raffle_start_date $asctime(m/d/yy) msg %irc_raffle_chan 9,1Raffle started! Raffle will be for  $+ %irc_raffle_prize $+ , and we have %irc_raffle_slots slots open! Start picking your numbers. Pick with !raffle followed by the number you would like. Valid numbers are between 1 and %irc_raffle_slots $+ . msg %irc_raffle_chan 9,1Raffle Started at %irc_raffle_start $+ %ampm on %irc_raffle_start_date and will continue for %irc_raffle_time minute(s). Raffle will end at %irc_raffle_end %ampmend on %irc_raffle_end_date $+ . set %timer $calc(%irc_raffle_time * 60) set %timer2 $calc(%irc_raffle_report_delay * 60) timerircraffle 1 %timer irc_raffle_stopraffle timerircrafflereport 0 %timer2 irc_raffle_report msg $chan 9,1Past Raffle Entries as follows: set %xyz !who irc_raffle_who } alias irc_raffle_report_reset { set %irc_raffle_report_delay $?="How many minutes between delays to the channel would you like?" set %timer2 $calc(%irc_raffle_report_delay * 60) timerircrafflereport 0 %timer2 irc_raffle_report } alias irc_raffle_winner.timelimit { set %irc_winner.tokens %irc_raffle_numwinners set %irc_x 1 set %irc_raffle_winner.time $calc(%irc_raffle_winner.timelimit * 60) while (%irc_x <= %irc_winner.tokens) { set %timer.token $gettok(%irc_winnerlist,%irc_x,46) $+(timer,%timer.token) 1 %irc_raffle_winner.time irc_raffle_winner.reset %timer.token inc %irc_x } } alias irc_raffle_winner.reset { set %irc_winner.nick $1 set %irc_winner.tokens %irc_raffle_numwinners ; set %irc_x 1 ; set %irc_raffle_winner.time $calc(%irc_raffle_winner.timelimit * 60) ; while (%irc_x <= %irc_winner.tokens) { ; set %timer.token $gettok(%irc_winnerlist,%irc_x,46) ; if (%irc_winner.tokens == 1) { ; set %winner.reset %timer.token ; } ; elseif ((%irc_winner.tokens > 1) && (%irc_x != %irc_winner.tokens)) { ; set %winner.reset %winner.reset %+ , %timer.token ; } ; elseif (%irc_x == %irc_winner.tokens) { ; set %winner.reset %winner.reset and %timer.token ; } ; inc %irc_x ; } msg %irc_raffle_chan 9,1Winner %irc_winner.nick failed to message the bot in the allotted time. New winner will now be drawn. set %irc_raffle_numwinners 1 irc_raffle_winner set %irc_raffle_numwinners %irc_winner.tokens } alias irc_raffle_winner.claim { set %irc_raffle_winner.claim $nick var %irc_temp $timer(%irc_raffle_winner.claim) if (%irc_temp != $null) { $+(timer,%irc_raffle_winner.claim) off msg %irc_raffle_winner.claim 9,1Prize Claimed. msg %irc_raffle_chan 9,1Winner %irc_raffle_winner.claim has claimed their prize. inc %irc_raffle_numwinners -1 set %irc_x 1 while (%irc_x <= %irc_winner.tokens) { set %timer.token $gettok(%irc_winnerlist,%irc_x,46) if (%timer.token == %irc_raffle_winner.claim) { set %timer.token $deltok(%timer.token,%irc_x,46) halt } else { inc %irc_x } } } else { msg %irc_raffle_winner.claim 9,1Error: Name not detected as a winner. } } alias irc_raffle_addtime { } menu channel,status { IRC Raffle .Start Raffle: irc_raffle_create $?="How many Slots would you like in the raffle?" $?="How many minutes would you like the raffle to last?" $?="How many winners will there be in this raffle?" $?="What is it you are raffling off?" | set %irc_raffle_chan $chan .Stop Raffle: irc_raffle_stop .Restart a Stopped Raffle (this includes disconnects): irc_raffle_restart .Modify Raffle ..Remove Entry: irc_raffle_remove $?="What number entry would you like to remove?" ..Add Slots: irc_raffle_addslots ..Randomly Select A New/Another Winner: set %irc_raffle_numwinners $$?="How many winners would you like to pick?" | irc_raffle_winner .Report Commands ..Raffle Status: irc_raffle_report ..Ajust Report Delay To Channel: irc_raffle_report_reset ..All Numbers Currently Selected: set %xyz !who | irc_raffle_who ..All Numbers Currently Open: irc_raffle_available .Options: ..Settings: irc_raffle_options }