home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / L2C / adenozin / SimpleScript.exe / Main / VOTE.MRC < prev    next >
Encoding:
Text File  |  2000-05-25  |  2.0 KB  |  50 lines

  1. ;  Vote Master Custom Identifiers
  2. ;
  3. alias vote.percent {
  4.   set %vote.percent $round($calc($1 / $2),2)
  5.   if ($left(%vote.percent,1) == 0) {
  6.     if ($right(%vote.percent,2) == 00) { return 0% }
  7.     elseif ($mid(%vote.percent,3,1) == 0) { return $mid(%vote.percent,4,1) $+ $chr(37) }
  8.     else { return $right(%vote.percent,2) $+ $chr(37) }
  9.   }
  10.   elseif ($mid(%vote.percent,2,1) == $chr(46)) { return $remove(%vote.percent,$chr(46)) $+ $chr(37) }
  11. }
  12. ;
  13. ;  Vote Master Aliases
  14. ;
  15. alias vote.timesup {
  16.   if ($chan(%vote.chan) == $null) { echo 6 -a Voting Booth Closed | echo 4 -a ERROR: Unable to display results! You're not on %vote.chan | goto end }
  17.   msg %vote.chan 6Voting Booth Closed 
  18.   msg %vote.chan 12Topic was: %vote.topic
  19.   msg %vote.chan 2People who said Yes:4 %vote.yes 2(12 $+ $vote.percent(%vote.yes,%vote.total) $+ 2)
  20.   msg %vote.chan 2People who said No:4 %vote.no 2(12 $+ $vote.percent(%vote.no,%vote.total) $+ 2)
  21.   if (%vote.no == 0 && %vote.yes == 0) { msg %vote.chan 5No one voted! Geez... }
  22.   elseif (%vote.no == %vote.yes) { msg %vote.chan 5It's a Tie! }
  23.   elseif (%vote.no > %vote.yes) { msg %vote.chan 5The Majority Voted NO }
  24.   elseif (%vote.no < %vote.yes) { msg %vote.chan 5The Majority Voted YES }
  25.   :end
  26.   unset %vote.*
  27. }
  28. ;
  29. ;  Vote Master Events
  30. ;
  31. on 1:text:!yes*:#: {
  32.   if (%vote.topic != $null && $chan == %vote.chan) {
  33.     if (%vote.nick. [ $+ [ $nick ] ] != $null) { notice $nick You've already placed your vote! | halt }
  34.     inc %vote.yes 1
  35.     inc %vote.total 1
  36.     notice $nick Thanks for placing your vote!
  37.     set %vote.nick. [ $+ [ $nick ] ] voted
  38.   }
  39. }
  40. on 1:text:!no*:#: {
  41.   if (%vote.topic != $null && $chan == %vote.chan) {
  42.     if (%vote.nick. [ $+ [ $nick ] ] != $null) { notice $nick You've already placed your vote! | halt }
  43.     inc %vote.no 1
  44.     inc %vote.total 1
  45.     notice $nick Thanks for placing your vote!
  46.     set %vote.nick. [ $+ [ $nick ] ] voted
  47.   }
  48. }
  49. on 1:connect:unset %vote.*
  50.