This is the voting booth which you can use to provide up-to 4 options for voting in your channel.
Please note that this script will flood if you do have flood protections on.
Simply load into your remotes, if it doesn't work right, type /ivote to install it.
Type /vote to open the dialog and start the script up.
Is compatible with Voting Booth Client v.1.0.0.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;Voting System;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;v.1.0.0.0;;;;;;;;;;;;;;;;
;;;;;The_Almighty_Duelist's Scripts;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;Loading and Starting;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:LOAD: {
writeini vote.ini status vote_channel $$?="Please enter voting channel."
writeini vote.ini settings vote_timeout 60
writeini vote.ini settings change_vote on
writeini vote.ini settings auto_start on
writeini vote.ini settings build v.1.0.0.0
writeini vote.ini status installed yes
echo -a You may now use the Voting System. Type /vote to open the dialog window.
}
on *:START: {
If ($readini(vote.ini,settings,auto_start) == on) {
dialog -m vote vote
}
Else {
echo -a Type /vote to open the voting dialog window.
}
}
;;;;;;;;;;;;;;;;;
;;;;;Aliases;;;;;
;;;;;;;;;;;;;;;;;
alias vote {
If ($readini(vote.ini,status,installed) == yes) {
dialog $iif($dailog(vote) == vote,-v,-m vote) vote
}
Else {
echo -a Please type /ivote to install the voting system.
}
}
alias vchan {
return $readini(vote.ini,status,vote_channel)
}
alias ivote {
writeini vote.ini status vote_channel $$?="Please enter voting channel."
writeini vote.ini settings vote_timeout 60
writeini vote.ini settings change_vote on
writeini vote.ini settings auto_start on
writeini vote.ini settings build v.1.0.0.0
writeini vote.ini status installed yes
echo -a You may now use the Voting System. Type /vote to open the dialog window.
}
alias vote_timeout {
return $readini(vote.ini,settings,vote_timeout)
}
alias send_info {
If (%vote == on) && ($1 != $null) {
.notice $nick vote Q %vote.q
.notice $nick vote 1 %vote.1
.notice $nick vote 2 %vote.2
If (%vote.3 != $null) {
.notice $nick vote 3 %vote.3
}
If (%vote.4 != $null) {
.notice $nick vote 4 %vote.4
}
.notice $nick vtfin
}
Else {
.notice $nick ftv
}
}
alias build {
return $readini(vote.ini,settings,build)
}
alias vote_start {
set %vote on
msg $vchan 11,1Attention $vchan $+ ! This is the Voting System $build $+ . You can vote using Voting Booth $build or higher.
msg $vchan 11,1Poll: %vote.q Time: $vote_timeout
msg $vchan 11,1Answer 1: %vote.1
msg $vchan 11,1Answer 2: %vote.2
If (%vote.3 != $null) {
msg $vchan 11,1Answer 3: %vote.3
If (%vote.4 != $null) {
msg $vchan 11,1Answer 4: %vote.4
}
}
msg $vchan 11,1To vote, simply type !vote <answer choice> or type /notice $me !vote <answer choice>. For help, type .vhelp
If ($readini(vote.ini,settings,change_vote) == on) {
msg $vchan 11,1You may change your answer before time expires.
}
.timervote 1 $vote_timeout vote_results
}
alias vote_results {
$iif($dialog(vote) == vote,dialog -x vote,)
set %vote off
$iif($dialog(vote) == vote,dialog -m vote vote,dialog -m vote vote)
msg $vchan 11,1Attention $vchan $+ ! Times up for the following vote: %vote.q $+ .
msg $vchan 11,1Here are the results:
msg $vchan 11,1Answer 1: %vote.1 Results: %vote.r1
msg $vchan 11,1Answer 2: %vote.2 Results: %vote.r2
If (%vote.3 != $null) {
msg $vchan 11,1Answer 3: %vote.3 Results: %vote.r3
If (%vote.4 != $null) {
msg $vchan 11,1Answer 4: %vote.4 Results: %vote.r4
}
}
vote_reset
}
alias vote_reset {
remini vote.ini voters
unset %vote*
set %vote off
}
;;;;;;;;;;;;;;;;;
;;;;;Dialogs;;;;;
;;;;;;;;;;;;;;;;;
dialog vote {
title Voting System - Voting Booth
option dbu
size -1 -1 200 99
text "Poll", 1, 1 1 20 10
edit "", 2, 21 1 179 10, autohs
text "Answer Choices", 3, 1 11 200 10
text "1", 4, 1 22 10 10
edit "", 5, 11 22 89 10, autohs
text "2", 6, 101 22 10 10
edit "", 7, 111 22 89 10, autohs
text "3", 8, 1 33 10 10
edit "", 9, 11 33 89 10, autohs
text "4", 10, 101 33 10 10
edit "", 11, 111 33 89 10, autohs
text "Time Limit (Seconds)", 12, 1 44 100 10
edit "", 13, 101 44 30 10, autohs
button "Start", 14, 1 66 99 10
button "Stop", 15, 101 66 99 10, disable
button "Reset", 25, 1 88 199 10
menu "Settings", 29
item "Set Channel", 30, 29
item "Change Vote", 31, 29
}
;;;;;;;;;;;;;;;;;;;;;
;;;;;Activations;;;;;
;;;;;;;;;;;;;;;;;;;;;
on *:DIALOG:vote:*:*: {
If ($devent == init) {
did -ra vote 13 $vote_timeout
If (%vote == on) {
did -b vote 2,5,7,9,11,13,14,25
did -e vote 15
did -a vote 2 %vote.q
did -a vote 5 %vote.1
did -a vote 7 %vote.2
did -a vote 9 %vote.3
did -a vote 11 %vote.4
If ($readini(vote.ini,settings,change_vote) == on) {
did -c vote 31
}
}
}
If ($devent == edit) {
If ($did == 13) {
writeini vote.ini settings vote_timeout $did(13)
}
}
If ($devent == sclick) {
If ($did == 14) {
If (%vote == on) {
dialog -x vote
dialog -m vote vote
}
Elseif ((($did(2) != $null) && ($did(5) != $null)) && ($did(7) != $null)) {
set %vote.q $did(2)
set %vote.1 $did(5)
set %vote.r1 0
set %vote.2 $did(7)
set %vote.r2 0
If ($did(9) != $null) {
set %vote.3 $did(9)
set %vote.r3 0
}
If ($did(11) != $null) {
set %vote.4 $did(11)
set %vote.r4 0
}
vote_start
dialog -x vote
dialog -m vote vote
}
Else {
echo -a Please enter a question and at least (the first) 2 answers.
}
}
If ($did == 15) {
If (%vote != on) {
dialog -x vote
dialog -m vote vote
}
Else {
vote_results
dialog -x vote
dialog -m vote vote
.timervote* off
}
}
If ($did == 25) {
dialog -x vote
dialog -m vote vote
}
}
If ($devent == menu) {
If ($did == 30) {
writeini vote.ini status vote_channel $?="Please enter the channel on which the poll will run."
dialog -v vote
}
If ($did == 31) {
If ($readini(vote.ini,settings,change_vote) == on) {
writeini vote.ini settings change_vote off
did -u vote 31
}
Else {
writeini vote.ini settings change_vote on
did -c vote 31
}
}
}
}
on *:TEXT:.vhelp*:*: {
If ($2 == $null) {
.notice $nick Please select from the following help topics (.vhelp <topic>). !vote, !results, voteclient
}
Elseif ($2 == !vote) {
.notice $nick You can either type !vote <choice number> or type /notice $me !vote <choice number> when there is voting.
}
Elseif ($2 == !results) {
.notice $nick During a vote, you can type !results or /notice $me !results to find out who's voted how, so far.
}
Elseif ($2 == voteclient) {
.notice $nick You can download the vote client here: http://www.hawkee.com/snippet/6262/ and use it to answer votes during a poll.
}
Else {
.notice $nick I can't help you on this topic.
}
}
on *:NOTICE:.vhelp*:*: {
If ($2 == $null) {
.notice $nick Please select from the following help topics (.vhelp <topic>). !vote, !results, voteclient
}
Elseif ($2 == !vote) {
.notice $nick You can either type !vote <choice number> or type /notice $me !vote <choice number> when there is voting.
}
Elseif ($2 == !results) {
.notice $nick During a vote, you can type !results or /notice $me !results to find out who's voted how, so far.
}
Elseif ($2 == voteclient) {
.notice $nick You can download the vote client here: http://www.hawkee.com/snippet/6262/ and use it to answer votes during a poll.
}
Else {
.notice $nick I can't help you on this topic.
}
}
on *:TEXT:!vote*:*: {
If (%vote == on) && ($2 != $null) {
If (%vote. [ $+ [ $2 ] ] != $null) {
If ($readini(vote.ini,voters,$nick) == $null) {
inc %vote.r [ $+ [ $2 ] ]
writeini vote.ini voters $nick $2
.notice $nick You have voted for %vote. [ $+ [ $2 ] ]
}
Elseif ($readini(vote.ini,settings,change_vote) == on) && ($readini(vote.ini,voters,$nick) != $2) {
dec %vote.r [ $+ [ $readini(vote.ini,voters,$nick) ] ]
inc %vote.r [ $+ [ $2 ] ]
writeini vote.ini voters $nick $2
.notice $nick You have changed your vote to %vote. [ $+ [ $2 ] ]
}
Elseif ($readini(vote.ini,settings,change_vote) == on) {
.notice $nick You have already voted for %vote. [ $+ [ $2 ] ]
}
Else {
.notice $nick You can't change your vote once you've voted.
}
}
Else {
.notice $nick There is no option $2 $+ .
}
}
Elseif ($2 == $null) {
.notice $nick Please type !vote <number>
}
Else {
.notice $nick There is no vote going on right now.
}
}
on *:NOTICE:!vote*:*: {
If (%vote == on) && ($2 != $null) {
If (%vote. [ $+ [ $2 ] ] != $null) {
If ($readini(vote.ini,voters,$nick) == $null) {
inc %vote.r [ $+ [ $2 ] ]
writeini vote.ini voters $nick $2
.notice $nick You have voted for %vote. [ $+ [ $2 ] ]
}
Elseif ($readini(vote.ini,settings,change_vote) == on) && ($readini(vote.ini,voters,$nick) != $2) {
dec %vote.r [ $+ [ $readini(vote.ini,voters,$nick) ] ]
inc %vote.r [ $+ [ $2 ] ]
writeini vote.ini voters $nick $2
.notice $nick You have changed your vote to %vote. [ $+ [ $2 ] ]
}
Elseif ($readini(vote.ini,settings,change_vote) == on) {
.notice $nick You have already voted for %vote. [ $+ [ $2 ] ]
}
Else {
.notice $nick You can't change your vote once you've voted.
}
}
Else {
.notice $nick There is no option $2 $+ .
}
}
Elseif ($2 == $null) {
.notice $nick Please type !vote <number>
}
Else {
.notice $nick There is no vote going on right now.
}
}
on *:TEXT:!results*:*: {
If (%vote == on) {
.notice $nick These are the results so far for the poll: %vote.q
.notice $nick %vote.1 - %vote.r1 --- %vote.2 - %vote.r2 $iif(%vote.3 != $null,$iif(%vote.4 != $null, --- %vote.3 - %vote.r3 --- %vote.4 - %vote.r4, --- %vote.4 - %vote.r3 ),)
.notice $nick Time Limit: $vote_timeout
}
Else {
.notice $nick There is no vote going on right now.
}
}
on *:NOTICE:!results*:*: {
If (%vote == on) {
.notice $nick These are the results so far for the poll: %vote.q
.notice $nick %vote.1 - %vote.r1 --- %vote.2 - %vote.r2 $iif(%vote.3 != $null,$iif(%vote.4 != $null, --- %vote.3 - %vote.r3 --- %vote.4 - %vote.r4 , --- %vote.3 - %vote.r3 ),)
.notice $nick Time Limit: $vote_timeout
}
Else {
.notice $nick There is no vote going on right now.
}
}
on *:NOTICE:showvote*:*: {
send_info $nick
}