Advertisement
Guest User

!contest

a guest
Sep 7th, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 5.07 KB | None | 0 0
  1. on @*:text:!contest *:#botmfishfood: {
  2.   if ($nick isop #) {
  3.     if ($2 == start && !%conteston) {
  4.       msg $chan Dampe hates FishFood and likes to troll him. So guess his dampe time with !bet. Do so by typing !bet <time> <flames>. Here is an example: !bet 51 1 Documentation on the scoring system can be found here: http://pastebin.com/P41dE3rq
  5.       msg $chan Also don't copy others, as if you guess the same as them, your bet will not win. (This stops people from copying eachother) :) b
  6.       set %conteston 1
  7.       set %contestant 1
  8.       set %contestcheck 0
  9.     }
  10.     elseif ($2 == result && $len($3) > 1 && $len($4) > 0 && !%conteston && %contestdone) {
  11.       unset %contestdone
  12.       set %contesti 1
  13.       ;do fun variable stuff
  14.  
  15.       %contestant = %contestant - 1
  16.  
  17.       ;loop through all contestants
  18.       if (%contestant > 0) {
  19.         while (%contesti <= %contestant) {
  20.           if (%contesti == 1) {
  21.             %winnernum = 1
  22.  
  23.             ;weight the time difference
  24.             set %ctemp1 %contest. [ $+ [ %contesti ] ]
  25.             %timediff = $3 - %ctemp1
  26.             if (%timediff < 0) {
  27.               %timediff = %timediff * -0.9
  28.             }
  29.  
  30.             ;weight the flame difference
  31.             set %ctemp2 %contest. [ $+ [ %contesti ] ] [ $+ .f ]
  32.             %flamediff = $4 - %ctemp2
  33.             if (%flamediff < 0) {
  34.               %flamediff = %flamediff * -0.9
  35.             }
  36.             %flamediff = %flamediff * 2.5
  37.  
  38.             %contestweight = %contesti * 1.02
  39.  
  40.             %contestscore = %flamediff + %timediff
  41.             %contestscore = %contestscore / 2
  42.             %contestscore = %contestscore * %contestweight
  43.  
  44.             %winnertime = %contest. [ $+ [ %winnernum ] ]
  45.             %winnerflame = %contest. [ $+ [ %winnernum ] ] [ $+ .f ]
  46.             set %cwinner %contest. [ $+ [ %winnernum ] ] [ $+ .nick ]
  47.           }
  48.           else {
  49.             ;weight the time difference
  50.             set %ctemp1 %contest. [ $+ [ %contesti ] ]
  51.             %timediff = $3 - %ctemp1
  52.             if (%timediff < 0) {
  53.               %timediff = %timediff * -0.9
  54.             }
  55.  
  56.             ;weight the flame difference
  57.             set %ctemp2 %contest. [ $+ [ %contesti ] ] [ $+ .f ]
  58.             %flamediff = $4 - %ctemp2
  59.             if (%flamediff < 0) {
  60.               %flamediff = %flamediff * 0.9
  61.             }
  62.             %flamediff = %flamediff * 2.5
  63.  
  64.             %contestweight = %contesti * 1.02
  65.  
  66.             %contestscore2 = %flamediff + %timediff
  67.             %contestscore2 = %contestscore2 / 2
  68.             %contestscore2 = %contestscore2 * %contestweight
  69.  
  70.             if (%contestscore > %contestscore2) {
  71.               set %winnernum %contesti
  72.               %contestscore = %contestscore2
  73.               %winnertime = %contest. [ $+ [ %winnernum ] ]
  74.               %winnerflame = %contest. [ $+ [ %winnernum ] ] [ $+ .f ]
  75.               set %cwinner %contest. [ $+ [ %winnernum ] ] [ $+ .nick ]
  76.             }
  77.           }
  78.  
  79.           %contesti = %contesti + 1
  80.         }
  81.  
  82.         msg $chan The winner is %cwinner with a time of %winnertime and a flame count of %winnerflame $+ ! They win 5 rupees from Zeldobot.
  83.         ;msg $chan degub: %contestscore
  84.         timer 1 1 msg $chan !zdonate %cwinner 5
  85.  
  86.         set %contesti 1
  87.         while (%contesti <= %contestant) {
  88.           unset %contest. [ $+ [ %contesti ] ]
  89.           unset %contest. [ $+ [ %contesti ] ] [ $+ .nick ]
  90.           %contesti = %contesti + 1
  91.         }
  92.       }
  93.       else {
  94.         msg $chan No one entered the contest, so there are no winners. :(
  95.       }
  96.     }
  97.     elseif ($2 == stop && %conteston) {
  98.       unset %conteston
  99.       set %contestdone 1
  100.       msg $chan No more results will be taken in
  101.     }
  102.     elseif ($2 == result) {
  103.       msg $chan Cannot take contest results right now.
  104.     }
  105.     elseif ($2 != help) {
  106.       msg $chan Invalid command arguments.
  107.     }
  108.   }
  109.   if ($2 == help) {
  110.     msg $chan Dampe bets work on a scoring system designed by syphist, documentation can be found here: http://pastebin.com/P41dE3rq
  111.   }
  112. }
  113.  
  114. on @*:text:!bet & &:#botmfishfood: {
  115.   if (%conteston) {
  116.     set %contestj 1
  117.  
  118.     ;check if they have entered already
  119.     while (%contestj <= %contestant) {
  120.       if ($nick == %contest. [ $+ [ %contestj ] ] [ $+ .nick ]) {
  121.         set %contestcheck 1
  122.         break
  123.       }
  124.       %contestj = %contestj + 1
  125.     }
  126.  
  127.     ;determine if new entry or not
  128.     if (%contestcheck == 0) {
  129.       ;Enters them into contest based on contestant number
  130.       set %contest. [ $+ [ %contestant ] ] [ $+ .nick ] $nick
  131.       set %contest. [ $+ [ %contestant ] ] $2
  132.       set %contest. [ $+ [ %contestant ] ] [ $+ .f ] $3
  133.       %contestant = %contestant + 1
  134.       msg $chan Thank you $nick for entering the contest.
  135.     }
  136.     else {
  137.       ;Enters them into contest based on contestant number
  138.       set %contest. [ $+ [ %contestj ] ] $2
  139.       set %contest. [ $+ [ %contestj ] ] [ $+ .f ] $3
  140.       msg $chan $nick $+ , your entered time has been changed.
  141.     }
  142.   }
  143.   else {
  144.     msg $chan Sorry, there is no active contest at the moment.
  145.   }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement