;
;
;This code EXPECTS the following variables, it is your responcability to ensure there there.
;%play.list %spin.nick %spin.last
;
;
;This code creates 6 variables, they are erased when the vftod.clean.up alias is triggered, also any timers created well be destroyed.
;%vftod.channel - channel of Thruth or Dare
;%vftod.answered.Truth - count of votes for truth
;%vftod.answered.Dare - count of votes for dare
;%vftod.answered.Skip - count of votes for skip
;%vftod.voter.list - list of voters (voter names well be removed as they vote)
;%vftod.total.voters - total number of voters
;
;
;You init the voting by running /vote.for.truth.or.dare
; Nicks are msged 1 per second untill all the list is messaged (excluding %spin.nick %spin.last)
; Then a 60 count to a reminder is started
; Then a 120 second count to voting closes is started
;
;If the reminders are triggered then only yet to vote nicks are msged (1 per second)
;If all votes are recieved or the thruth votes or Dare votes become over 50% then voting closes ( reminders well also be canceled )
;When voting closes equal votes check is performed and one is chosen, then channel is msged as to the result. YOU NEED TO ADD CODE HERE FOR TRUTH OR DARE
;
;
alias vote.for.truth.or.dare {
vftod.clean.up
set %vftod.channel $chan | ;***************** dont know ya channel so set it here if need be.
set %vftod.answered.Truth 0
set %vftod.answered.Dare 0
set %vftod.answered.Skip 0
set %vftod.voter.list $remtok($remtok(%play.list,%spin.nick,1,32),%spin.last,1,32)
set %vftod.total.voters $numtok(%vftod.voter.list,32)
;
var %i = %vftod.total.voters
while (%i) {
.timer $+ $+(.vftod.vote.msg.,%i) 1 %i msg $!( $+ $gettok(%vftod.voter.list,%i,32) $+ ,) You are requested to vote for $!( $+ %spin.nick $+ ,) to take a Truth or a Dare, please reply with T or D or Truth or Dare, to pass you may enter S or Skip, you have around 2 minutes to respond.
dec %i
}
;
.timer.vftod.reminder 1 $calc(60 + %vftod.total.voters) vftod.reminder
.timer.vftod.close.voting 1 $calc(120 + %vftod.total.voters) vftod.close.voting
}
;
on *:TEXT:T:?:{ vftod.voter.reply $nick T }
on *:TEXT:Truth:?:{ vftod.voter.reply $nick T }
on *:TEXT:D:?:{ vftod.voter.reply $nick D }
on *:TEXT:Dare:?:{ vftod.voter.reply $nick D }
on *:TEXT:S:?:{ vftod.voter.reply $nick S }
on *:TEXT:Skip:?:{ vftod.voter.reply $nick S }
;
alias vftod.voter.reply {
if ($istok(%vftod.voter.list,$1,32)) {
if ($2 == T) { inc %vftod.answered.Truth }
elseif ($2 == D) { inc %vftod.answered.Dare }
else { inc %vftod.answered.Skip }
set %vftod.voter.list $remtok(%vftod.voter.list,$1,32)
msg $1 Vote Recorded, thankyou for your time.
var %vftod.more.than.half = $int($calc((%vftod.total.voters - %vftod.answered.Skip) / 2 + 1))
if ((!%vftod.voter.list) || (%vftod.answered.Truth >= %vftod.more.than.half) || (%vftod.answered.Dare >= %vftod.more.than.half)) {
vftod.close.voting
}
}
}
;
alias vftod.reminder {
var %i = $numtok(%vftod.voter.list,32)
while (%i) {
.timer $+ $+(.vftod.reminder.msg.,%i) 1 %i msg $!( $+ $gettok(%vftod.voter.list,%i,32) $+ ,) You are requested to vote for $!( $+ %spin.nick $+ ,) to take a Truth or a Dare, please reply with T or D or Truth or Dare, to pass you may enter S or Skip, you have around 1 minute to respond. (this is a remainder)
dec %i
}
}
;
alias vftod.close.voting {
if (%vftod.answered.Truth == %vftod.answered.Dare) {
if ($rand(0,1)) { inc %vftod.answered.Truth }
else { inc %vftod.answered.Dare }
}
if (%vftod.answered.Truth > %vftod.answered.Dare) {
msg %vftod.channel %spin.nick will be getting a Truth from %spin.last by a voting of ( $+ %vftod.answered.Truth $+ ) : ( $+ %vftod.answered.Dare $+ )
;
;
;**** Place what ever you do to cause a TRUTH here
;
;
}
else {
msg %vftod.channel %spin.nick will be getting a Dare from %spin.last by a voting of ( $+ %vftod.answered.Dare $+ ) : ( $+ %vftod.answered.Truth $+ )
;
;
;**** Place what ever you do to cause a DARE here
;
;
}
vftod.clean.up
}
;
alias vftod.clean.up {
unset %vftod.*
.timer.vftod.* off
}