Charmander

Liar's Dice

Sep 29th, 2011
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 4.74 KB | None | 0 0
  1. on *:text:.ldrules:#: {
  2.   notice $nick Each player has two choices during his turn: make a higher bid, or challenge the previous bid as being wrong. The player may bid an increased quantity of any face, or the same quantity of a higher face.
  3.   notice $nick If the current player thinks the previous player's bid is wrong, he challenges it, and then all dice are revealed to determine whether the bid was valid. If the number of the relevant face revealed is at least as high as the bid, then the bid is valid, in which case the bidder wins.
  4.   notice $nick Commands:
  5.   notice $nick 04.ldstart: start a new game.
  6.   notice $nick 04.ldjoin: join a game that is in the signups phase.
  7.   notice $nick 04.ldbid <quantity> <face>: make a bid.
  8.   notice $nick 04.ldbs: call the current bidder a liar.
  9.   notice $nick 04.ldinfo: get info on the current game.
  10.   notice $nick 04.lddice: get your dice rolls resent to you.
  11.   if ($findtok($enders,$nick,32)) {
  12.     notice $nick Administrator Commands:
  13.     notice $nick 07.ldskip: end the signups phase.
  14.     notice $nick 07.ldend: completely end the game.
  15.   }
  16. }
  17. alias enders return Charmander Daenym JupiterDjinn tester WildEep Poppy Birkal ibojangles
  18. on *:text:.ldskip:#: {
  19.   if (%round != on && %ldld == on && $findtok($enders,$nick,32)) {
  20.     .timer* off
  21.     trans
  22.   }
  23. }
  24. on *:text:.ldstart:#: {
  25.   set %ldchan #
  26.   if (%ldld != on) {
  27.     set %ldld on
  28.     msg # A Liar's Dice game was started by $+(04,$nick,,.) To join, type 04.ldjoin.
  29.     msg # Signups end in 0430 seconds!
  30.     .timer 1 30 trans
  31.     addplayer # $nick
  32.   }
  33.   else msg # There is already a game going on!
  34. }
  35. alias trans {
  36.   if ($numtok(%ld.players,32) >= 2) {
  37.     set %ld.round on
  38.     set %ld.it $gettok(%ld.players,$r(1,$numtok(%ld.players,32)),32)
  39.     msg %ldchan Time has ended or the signups phase was skipped, and it is time to bid! $+(04,%ld.it,,) will go first!
  40.   }
  41.   else {
  42.     msg %ldchan Not enough players! Game over.
  43.     unset %ld*
  44.     halt
  45.   }
  46.   tokenize 32 %ld.players
  47.   var %ld.count 1
  48.   while ($0 >= %ld.count) {
  49.     notice $ [ $+ [ %ld.count ] ] Your dice rolls are $+(04,%ld.dice [ $+ [ $ [ $+ [ %ld.count ] ] ] ],,.)
  50.     inc %ld.count
  51.   }
  52.   msg %ldchan To bid, type 04.ldbid <quantity> <face>.
  53. }
  54. on *:text:.ldjoin:#:if (!%ld.round && !$findtok(%ld.players,$nick,32) && %ldld == on) addplayer # $nick
  55. on $*:text:/^(\.ldbid (\d|\d\d) \d)$/Si:#: {
  56.   if ((%ld.it == $nick) && (%ld.round == on) && ((!%ld.bid) || ($2 >= $gettok(%ld.bid,1,32) && $3 > $gettok(%ld.bid,2,32)) || ($2 > $gettok(%ld.bid,1,32) && $3 <= $gettok(%ld.bid,2,32)))) {
  57.     set %ld.bid $2 $3
  58.     set %ld.person $nick
  59.     set %ld.lie $iif($findtok(%ld.total,$3,0,32) >= $2,true,false)
  60.     msg # $+(04,$nick,) claims there are $+(04,$2,) dice numbered $+(04,$3,,!)
  61.     setturn
  62.   }
  63. }
  64. on *:text:.ldbs:#: {
  65.   if (%ld.person != $nick && %ld.person && $findtok(%ld.players,$nick,32) && %ld.round == on) {
  66.     set %ld.winner $iif(%ld.lie == false,$nick,%ld.person)
  67.     msg # $+(04,%ld.winner,) wins the round!
  68.     inc %ld2. [ $+ [ %ld.winner ] ]
  69.     var %ld.count 1
  70.     while (%ld.count <= $var(%ld2.*,0)) {
  71.       set %ld.score %ld.score $+(04,$right($($var(%ld2.*,%ld.count).name),-5),,:,$chr(32),07,$var(%ld2.*,%ld.count).value,)
  72.       inc %ld.count
  73.     }
  74.     msg # %ld.score
  75.     inc %ld3
  76.     if (%ld2. [ $+ [ %ld.winner ] ] == 5) {
  77.       msg # $+(04,%ld3,) rounds played; $+(04,%ld.winner,) wins!
  78.       unset %ld*
  79.     }
  80.     else {
  81.       msg # Starting game $+(04,$calc(%ld3 + 1),,!)
  82.       set %ld.ld on
  83.       msg # A Liar's Dice game was started! To join, type 04.ldjoin.
  84.       msg # Signups end in 0430 seconds!
  85.       .timer 1 30 trans
  86.     }
  87.     unset %ld.*
  88.   }
  89. }
  90. on *:text:.lddice:#:if ($findtok(%ld.players,$nick,32)) notice $nick $+(04,$nick,'s) dice are $+(04,%ld.dice [ $+ [ $nick ] ],,!)
  91. on *:text:.ldend:#: {
  92.   if (%ldld == on && $findtok($enders,$nick,32)) {
  93.     msg # The game was ended by $+(04,$nick,,.) To start a new game, type 04.ldstart.
  94.     unset %ld*
  95.     halt
  96.   }
  97. }
  98. alias setturn {
  99.   if ($findtok(%ld.players,%ld.it,32) == $numtok(%ld.players,32)) set %ld.it $gettok(%ld.players,1,32)
  100.   else set %ld.it $gettok(%ld.players,$calc($findtok(%ld.players,%ld.it,32)+1),32)
  101.   msg %ldchan It is $+(04,%ld.it,,'s) turn!
  102. }
  103. on *:text:.ldinfo:#:if (%ldld == on) msg # Bid: $+(04,$iif(%ld.bid != $null,%ld.bid,0 0),,s) $chr(124) Turn: $+(04,%ld.it,) $chr(124) Players: $+(04,%ld.players,) $chr(124) Phase: $+(04,$iif(%ld.round == on,Bidding,Signups),)
  104. alias addplayer {
  105.   msg # $+(04,$nick,) has joined the game!
  106.   set %ld.players %ld.players $nick
  107.   set %ld.dice [ $+ [ $nick ] ] $sorttok($r(1,6) $r(1,6) $r(1,6) $r(1,6) $r(1,6),32,n)
  108.   set %ld.total %ld.total %ld.dice [ $+ [ $nick ] ]
  109. }
Advertisement
Add Comment
Please, Sign In to add comment