Previous Winner v.1.2.2

By Tamaki on Feb 23, 2009

YOU MUST HAVE THE_ALMIGHTY_DUELIST'S INTEGRATION SCRIPT FOR THIS SCRIPT TO WORK RIGHT!!!! YOU CAN FIND IT HERE: http://www.hawkee.com/snippet/4936/

To install this script, type /install winners

Image

Dialog Functions

Save Winners -
Save's nick to database along with date and time.

Display Winners -
Displays previous winners to the channel.

Expunge Winners -
Deletes entire winners record.

Set Channel -
Sets your main channel 0bv.

Set Topic -
Sets topic in the main channel.

Set Notifications -
Sets notifications in your channel.
Changes your topic when a new person is added to the database.
Displays when a person is added to the database.

Commands - (Please note, you can not use these yourself)
!winners (displays the most recent winner)
!winners (displays the last of players)
If someone types !winners and you don't have that many winners, it'll display the last 10 winners, regardless of how many people are in the database.

To uninstall - /uninstall winners

-edit-
Added entrymsg option for servers that support this. It is not recomended if your server doesn't recomend /msg ChanServ set # entrymsg . If your server doesn't, please use the Help Connection Center found here: http://www.hawkee.com/snippet/5590/ and I will customize for you.

Made Display Winners dialog visible as a msg to the channel instead of a .notice.

To update your version of the bot, simply replace your current one with this. DO NOT INITIALIZE!!! It will work just fine if you've already installed it. This is only to update your current bot. -edit- Is now ready for the new TAD's Integration Script! ```mirc on *:LOAD: { createlicense winners echo -a Type /install winners to install the Previous Winners v.1.2 script! } on *:START: { If ($readini(winners.ini,status,installed) == yes ) { If ($readini(winners.ini,settings,auto_start) == yes ) { check winners } Else { echo -a Type /winners or press F9 to start the Previous Winners v.1.2 script! } } Else { echo -a Type /install winners to install the Previous Winners v.1.2 script! } } dialog winners_install { title winners option dbu size -1 -1 100 10 } on *:DIALOG:winners_install:init:*: { dialog -x winners_install winners_install } alias winners_install { set %previous.winners 0 set %win.chan $?="Please enter the name of your channel." writeini winners.ini status installed yes echo -a Congradulations!!! You've installed the Previous Winners v1.1 Script. echo -a Press F9 or type /winners to start-up the Previous Winners Script. } alias winners_uninstall { unset %previous.winners unset %win.chan unset %win.topic unset %pre.win .remove winners.ini .remove winners.txt echo -a Uninstalled successfully! Please type /install winners to re-install the Previous Winners v.1.2! } dialog winners { title Previous Winners v.1.2 option dbu size -1 -1 101 33 button "Save Winners", 1, 1 1 100 10 button "Display Winners", 2, 1 11 100 10 button "Expunge Winners", 3, 1 22 100 10 menu "Settings", 4 item "Set Channel", 5, 4 item "Set Notifications", 6, 4 item "Set Topic", 7, 4 item "Set Entry Message", 8, 4 } on *:DIALOG:winners:close:0: { set % $+ winners $+ _open no } on *:DIALOG:winners:sclick:1: { close winners start swin } on *:DIALOG:winners:sclick:2: { close winners start dwin } on *:DIALOG:winners:sclick:3: { close winners start ewin } on *:DIALOG:winners:menu:5: { minimize winners set %win.chan $?="Please enter your channel name." restore winners } on *:DIALOG:winners:menu:6: { minimize winners start win_sett } on *:DIALOG:winners:menu:7: { minimize winners set %win.topic $?="Please enter your topic. It will be changed immediatley." If (%win.topic == $null ) { restore winners } Else { If (%change.topic.on.add == yes ) { topic %win.chan %win.topic Most recent winner: %pre.win restore winners } Else { topic %win.chan %win.topic restore winners } } } on *:DIALOG:winners:menu:8: { minimize winners set %win.entrymsg $$?="Please enter your entry message. It will be changed immediatley." If (%win.entrymsg == $null ) { restore winners } Else { If (%change.entrymsg.on.add == yes ) { msg ChanServ set %win.chan entrymsg %win.entrymsg Most recent winner: %pre.win restore winners } Else { msg ChanServ set %win.chan entrymsg %win.entrymsg restore winners } } } dialog swin { title Save Winners option dbu size -1 -1 101 33 text "Nick", 1, 1 1 20 10 edit "", 2, 21 1 79 10, autohs default button "Save", 3, 1 11 49 10 button "Reset", 4, 50 11 49 10 button "Back", 5, 1 22 99 10 } on *:DIALOG:swin:close:0: { set % $+ swin $+ _open no } on *:DIALOG:swin:sclick:3: { If ($did(2) == $null ) { echo -a Please input a name into the Nick Edit Box. did -f swin 2 } Else { inc %previous.winners write winners.txt $did(2) Date: $adate Time: $time set %pre.win $did(2) If (%change.topic.on.add == yes ) { topic %win.chan %win.topic Most recent winner: %pre.win } If (%notify.channel.on.add == yes ) { msg %win.chan $did(2) is our most recent winner! Congradulations!!!!! } If (%change.entrymsg.on.add == yes ) { msg ChanServ set entrymsg %win.chan %win.entrymsg Most recent winner: %pre.win } echo -a $did(2) added on $adate at $time $+ . } } on *:DIALOG:swin:sclick:4: { close swin start swin } on *:DIALOG:swin:sclick:5: { close swin start winners } dialog dwin { title Display Winners option dbu size -1 -1 101 44 text "Number of Winners to Display", 1, 1 1 100 10 combo 2, 1 11 100 10, drop vsbar button "Display", 3, 1 22 49 10, disable button "Reset", 4, 50 22 49 10 button "Back", 5, 1 33 99 10 } on *:DIALOG:dwin:close:0: { set % $+ dwin $+ _open no } on *:DIALOG:dwin:init:0: { var %temp.1 %previous.winners While (%temp.1 > 0 ) { did -a dwin 2 %temp.1 dec %temp.1 } } on *:DIALOG:dwin:sclick:2: { did -e dwin 3 } on *:DIALOG:dwin:sclick:3: { If ($did(2) != $null ) { display_winners $did(2) } Else { display_winners } } on *:DIALOG:dwin:sclick:4: { close dwin start dwin } on *:DIALOG:dwin:sclick:5: { close dwin start winners } dialog ewin { title Expunge Winners option dbu size -1 -1 101 32 text "Are you sure you want to erase winning records?", 1, 1 1 100 20 button "Yes", 2, 1 21 49 10 button "No", 3, 50 21 49 10 } on *:DIALOG:ewin:close:0: { set % $+ ewin $+ _open no } on *:DIALOG:ewin:sclick:2: { set %previous.winners 0 .remove winners.txt unset %pre.win close ewin start winners echo -a Previous winners have been expunged! } on *:DIALOG:ewin:sclick:3: { close ewin start winners } on *:TEXT:!winners*:#: { If ($chan == %win.chan ) { If ($2 == $null ) { var %temp.1 $read(winners.txt, %previous.winners) notice $nick The most recent winner is: %temp.1 } Else { If ($2 <= %previous.winners ) { notice $nick These are the previous $2 winners: var %temp.1 %previous.winners var %temp.2 1 While (%temp.1 > $calc(%previous.winners - $2 ) ) { var %temp.3 $read(winners.txt, %temp.1 ) notice $nick %temp.2 $+ . %temp.3 dec %temp.1 inc %temp.2 } } Else { notice $nick We don't have than many previous winners...displaying previous 10 winners: var %temp.1 %previous.winners var %temp.2 1 While (%temp.1 > $calc(%previous.winners - 10 ) ) { var %temp.3 $read(winners.txt, %temp.1 ) notice $nick %temp.2 $+ . %temp.3 dec %temp.1 inc %temp.2 } } } } } alias display_winners { If ($1 == $null ) { var %temp.1 $read(winners.txt, %previous.winners) msg %win.chan The most recent winner is: %temp.1 } Else { If ($1 <= %previous.winners ) { msg %win.chan These are the previous $1 winners: var %temp.1 %previous.winners var %temp.2 1 While (%temp.1 > $calc(%previous.winners - $1 ) ) { var %temp.3 $read(winners.txt, %temp.1 ) msg %win.chan %temp.2 $+ . %temp.3 dec %temp.1 inc %temp.2 } } } } alias f9 { check winners } alias winners { check winners } dialog win_sett { title Winners Settings option dbu size -1 -1 101 44 check "Notify Channel on add", 1, 1 1 100 10 check "Change Topic on add", 2, 1 11 100 10 check "Change Entry Message on add", 3, 1 22 100 10 button "Back", 4, 1 33 100 10 } on *:DIALOG:win_sett:close:0: { set % $+ win_sett $+ _open no } on *:DIALOG:win_sett:init:0: { If (%notify.channel.on.add == yes ) { did -c win_sett 1 } If (%change.topic.on.add == yes ) { did -c win_sett 2 } If (%change.entrymsg.on.add == yes ) { did -c win_sett 3 } } on *:DIALOG:win_sett:sclick:1: { If (%notify.channel.on.add == yes ) { set %notify.channel.on.add no did -u win_sett 1 } Else { set %notify.channel.on.add yes did -c win_sett 1 } } on *:DIALOG:win_sett:sclick:2: { If (%change.topic.on.add == yes ) { set %change.topic.on.add no did -u win_sett 2 } Else { set %change.topic.on.add yes did -c win_sett 2 } } on *:DIALOG:win_sett:sclick:3: { If (%change.entrymsg.on.add == yes ) { set %change.entrymsg.on.add no did -u win_sett 3 } Else { set %change.entrymsg.on.add yes did -c win_sett 3 } } on *:DIALOG:win_sett:sclick:4: { close win_sett restore winners } ``` ``` ```

Comments

Sign in to comment.
Tamaki   -  Feb 27, 2009

-edit-
Added entrymsg option for servers that support this. It is not recomended if your server doesn't recomend /msg ChanServ set # entrymsg . If your server doesn't, please use the Help Connection Center found here: http://www.hawkee.com/snippet/5590/ and I will customize for you.

Made Display Winners dialog visible as a msg to the channel instead of a .notice.

To update your version of the bot, simply replace your current one with this. DO NOT INITIALIZE!!! It will work just fine if you've already installed it. This is only to update your current bot.
 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.