mIRC Home    About    Download    Register    News    Help

Print Thread
#115600 28/03/05 03:05 AM
Joined: Aug 2004
Posts: 7,168
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
I realize that what I'm about to ask for might be used for spamming, but I don't see any way around that (although if someone comes up with a way to do this without it being able to be used for spamming, that much better).
I'm trying to write onto my bot a method where the players (nicks are stored in %play.list) can vote for the person that was picked (%spin.nick) to take a Truth or a Dare. Only those in the players list, excluding the person picked and the person that spun the bottle (%spin.last)

What I want the bot to do is PM the people that can vote, and ask them for their vote..putting a time limit of 2 minutes for voting. Voting options are to be Truth, Dare, or Skip. Each person is allowed one vote and the votes are to be tabulated, with the bot giving a random vote at the end, only if the number of Truth votes equals the number of Dare votes...those that voted Skip can be ignored for the count.

After all of the votes have been tabulated, the bot is to message the channel with the vote results (ie: %spin.nick will be getting a Truth from %spin.last by a voting of (#of Truths) : (# of Dares))
swapping Truth & Dare as appropriate if the vote came out for a Dare.

Looking forward to your replies and expertise.

#115601 28/03/05 02:26 PM
C
Chernobel
Chernobel
C
hello there,,
how can i add my channel to the favourite channel list in the new mIRC version.
channel name is #Love on DALnet
confused

#115602 28/03/05 02:29 PM
Joined: Dec 2002
Posts: 3,534
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,534
From the menubar click Favorites > Add to favorites?

D
DaveC
DaveC
D
Code:
;
;
;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
}


* I just sweept downt he code and removed all -s on sets and echo's -st whcih i use to debug, I think I got em all.

#115604 28/03/05 11:52 PM
Joined: Aug 2004
Posts: 7,168
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
You should've put this as a new topic, not in reply to my topic, as what you said has nothing to do with my topic

Joined: Aug 2004
Posts: 7,168
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,168
Excellent work DaveC...will test it out as soon as I can...hopefully it'll work flawlessly


Link Copied to Clipboard