Liar's Dice

By GoldFish on Oct 16, 2011

READ DESCRIPTION

One of my friends requested I code this game, so I did. I haven't found any other Liar's Dice scripts on Hawkee, so here you go!

*** In the first line, make sure you replace with the users you want to be able to end the signups phase prematurely and end the game. You can edit these nicks any time you want. For example, if the users that I want to be able to skip and end are potato, mustard, and bob, the line should read: alias enders return potato mustard bob

*** I did not create the game, just the script. If you wish to find rules, you can get them by typing .ldrules. This command will also give you the commands used in the game. Rules can be found online as well.

*** This script is meant for a bot to host.

STUFF YOU SHOULD KNOW

*** The game ends when one player reaches 5 points.

*** In this version, anyone can call out someone. If you wish to change this, change the line "if (%ld.person != $nick && %ld.person && $findtok(%ld.players,$nick,32) && %ld.round == on) {" to "if (%ld.person != $nick && %ld.person && $nick == %ld.it && %ld.round == on) {"

Enjoy!

alias enders return <NICKS GO HERE>
on *:text:.ldrules:#: {
  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.
  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.
  notice $nick Commands:
  notice $nick 04.ldstart: start a new game.
  notice $nick 04.ldjoin: join a game that is in the signups phase.
  notice $nick 04.ldbid <quantity> <face>: make a bid.
  notice $nick 04.ldbs: call the current bidder a liar.
  notice $nick 04.ldinfo: get info on the current game.
  notice $nick 04.lddice: get your dice rolls resent to you.
  if ($findtok($enders,$nick,32)) {
    notice $nick Administrator Commands:
    notice $nick 07.ldskip: end the signups phase.
    notice $nick 07.ldend: completely end the game.
  }
}
on *:text:.ldskip:#: {
  if (%round != on && %ldld == on && $findtok($enders,$nick,32)) {
    .timer* off
    trans
  }
}
on *:text:.ldstart:#: {
  set %ldchan #
  if (%ldld != on) {
    set %ldld on
    msg # A Liar's Dice game was started by $+(04,$nick,,.) To join, type 04.ldjoin.
    msg # Signups end in 0430 seconds!
    .timer 1 30 trans
    addplayer # $nick
  }
  else msg # There is already a game going on!
}
alias trans {
  if ($numtok(%ld.players,32) >= 2) {
    set %ld.round on
    set %ld.it $gettok(%ld.players,$r(1,$numtok(%ld.players,32)),32)
    msg %ldchan Time has ended or the signups phase was skipped, and it is time to bid! $+(04,%ld.it,,) will go first!
  }
  else {
    msg %ldchan Not enough players! Game over.
    unset %ld*
    halt
  }
  tokenize 32 %ld.players
  var %ld.count 1
  while ($0 >= %ld.count) {
    notice $ [ $+ [ %ld.count ] ] Your dice rolls are $+(04,%ld.dice [ $+ [ $ [ $+ [ %ld.count ] ] ] ],,.)
    inc %ld.count
  }
  msg %ldchan To bid, type 04.ldbid <quantity> <face>.
}
on *:text:.ldjoin:#:if (!%ld.round && !$findtok(%ld.players,$nick,32) && %ldld == on) addplayer # $nick
on $*:text:/^(\.ldbid (\d|\d\d) \d)$/Si:#: {
  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)))) {
    set %ld.bid $2 $3
    set %ld.person $nick
    set %ld.lie $iif($findtok(%ld.total,$3,0,32) >= $2,true,false)
    msg # $+(04,$nick,) claims there are $+(04,$2,) dice numbered $+(04,$3,,!)
    setturn
  }
}
on *:text:.ldbs:#: {
  if (%ld.person != $nick && %ld.person && $findtok(%ld.players,$nick,32) && %ld.round == on) {
    set %ld.winner $iif(%ld.lie == false,$nick,%ld.person)
    msg # $+(04,%ld.winner,) wins the round!
    inc %ld2. [ $+ [ %ld.winner ] ]
    var %ld.count 1
    while (%ld.count <= $var(%ld2.*,0)) {
      set %ld.score %ld.score $+(04,$right($($var(%ld2.*,%ld.count).name),-5),,:,$chr(32),07,$var(%ld2.*,%ld.count).value,)
      inc %ld.count
    }
    msg # %ld.score
    inc %ld3
    if (%ld2. [ $+ [ %ld.winner ] ] == 5) {
      msg # $+(04,%ld3,) rounds played; $+(04,%ld.winner,) wins!
      unset %ld*
    }
    else {
      msg # Starting game $+(04,$calc(%ld3 + 1),,!)
      set %ld.ld on
      msg # A Liar's Dice game was started! To join, type 04.ldjoin.
      msg # Signups end in 0430 seconds!
      .timer 1 30 trans
    }
    unset %ld.*
  }
}
on *:text:.lddice:#:if ($findtok(%ld.players,$nick,32)) notice $nick $+(04,$nick,'s) dice are $+(04,%ld.dice [ $+ [ $nick ] ],,!)
on *:text:.ldend:#: {
  if (%ldld == on && $findtok($enders,$nick,32)) {
    msg # The game was ended by $+(04,$nick,,.) To start a new game, type 04.ldstart.
    unset %ld*
    halt
  }
}
alias setturn {
  if ($findtok(%ld.players,%ld.it,32) == $numtok(%ld.players,32)) set %ld.it $gettok(%ld.players,1,32)
  else set %ld.it $gettok(%ld.players,$calc($findtok(%ld.players,%ld.it,32)+1),32)
  msg %ldchan It is $+(04,%ld.it,,'s) turn!
}
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),) 
alias addplayer {
  msg # $+(04,$nick,) has joined the game!
  set %ld.players %ld.players $nick
  set %ld.dice [ $+ [ $nick ] ] $sorttok($r(1,6) $r(1,6) $r(1,6) $r(1,6) $r(1,6),32,n)
  set %ld.total %ld.total %ld.dice [ $+ [ $nick ] ]
}

Comments

Sign in to comment.
GoldFish   -  Oct 22, 2011

@jethro: sorry, I thought I edited them all out.
@blackvenomm666 I don't have access to mirc right now but I'll add that tomorrow.

 Respond  
blackvenomm666   -  Oct 17, 2011

also i would add an on text event for the bots owner so if they wish to edit the list of people who can end the signups phase prematurely and end the game. they can easily use the command to do so. just a thought:)

 Respond  
Jethro   -  Oct 16, 2011

Your snippet won't work properly without having these channels edited out:> #scripting,#mildeepI've seen many people who submit their personal scripts or snippets without or forget making a needed change to work for the general public.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.