Author Topic: Card Game Scripts  (Read 32191 times)

DocBeat

  • Newbie
  • *
  • Posts: 43
Card Game Scripts
« on: November 15, 2008, 09:59:11 AM »
Quote
Does anyone have any script for card games like draw poker or UNO?

I've played UNO on IRC a few times (it was installed on a mIRC bot) and it works very nice for as many players as you want (very cool if you are bored of trivia)
and it has the following features:

1)Players !join and with !deal the game begins.Other players may type "!join" too while the game is being played (with the disadvantage of having all 7 cards while others have discarded some) and the current
players may !quit (if only one is left he/she is declared the winner and gains points like in trivia).

2)Players discard their cards:   "!play c <number or type or color for colorchange>"
where c is a color initial : c={b,y,r,g,w}
for blue yellow red green and white,number={0,1,2,3,4,5,6,7,8,9} and type={S,R,d2} where S stands for skip ('throw' it and the next player loses his/her turn), R for reverse ('throw' it and reverse the turn of the players)
and d2 for draw two ('throw it' and the next player draws two cards).
The S and R cards only work for games of 3 or more players (they are used as normal color cards for two player game).

Examples:
Code: [Select]
!play y 1
!play r d2 (for discarding a red "draw two cards" card)
!play w b (for playing a white card and changing color to blue)
!play b R  (for playing a blue Reverse card)

There is also a special card wd4 (white draw 4)
Example:
!play wd4 y
Throw the wd4 ( next player draws 4 cards and loses his/her turn) and turn the color yellow.

3)Players !draw 1 card if they want or if they don't have anything else to play.After that they
!pass or !play.

4)Notices are sent (it's best to receive them in your console) to every player whenever their turn comes.The notice includes information
about the turns (who plays next and who plays after the next etc.) the number of cards each player has and your current cards.Also you get notice for every card you draw.

Code: [Select]
Example:
--Botname-- Next: | Player2 - 7 Cards | Player3 - 7 Cards | Player4 - 7 Cards
--Botname-- [6][9][1][S][7][R][W]

5)Announcements in Game:
"Uno! Player1 has one card left!" (after throwing his/her card before the last card)
"Player1 was Skipped! Player2's turn." (when one uses the S card)
"Top Card: [ cardnamehere ]" (on every turn when one has to throw a card)
"Player1 Draws Two and is Skipped! Player2's turn." (when before Player1's turn an S card was used)

6)15 different Cards: [ 0 ] [1][2][3][4][5][6][7][8][9][ S ][R][D2][W][WD4]

Example of game session:
Code: [Select]
<@Bot> Player1 was Skipped! Player2's turn.
<@Bot> Top Card: [S]
<@Player2> !play wd4 g
<@Bot> Player3 draws 4 cards and is skipped!
<@Bot> Player4's turn.
<@Bot> Top Card: [*]
<@Player4> !draw
<@Bot> Player4 draws a card.
<@Player4> !pass
<@Bot> Player4 passes his/her turn.Player1's turn.
<@Player1> !play g S
<@Bot> Uno! Player1 has one card left!
<@Bot> Player2 was Skipped! Player3's turn.
<@Bot> Top Card: [S]

Of course color is added where needed for better functionality ("[ * ]" without color wouldn't mean much...)
It would be nice if anyone is interested in coding it  :lol:

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #1 on: November 15, 2008, 03:31:40 PM »
An update to how the rules are:

1)[ S ] card works for two players too.The one who uses it plays again ([R] still works as a normal card).
2)[D2] makes the next player get skipped and also draw two cards (same with WD4 but two cards less penalty in this case and it can only be used with same color as the top card while WD4 can be used everywhere).
« Last Edit: November 15, 2008, 03:33:25 PM by DocBeat »

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Card Game Scripts
« Reply #2 on: November 15, 2008, 05:02:08 PM »
I think someone already made a UNO script, but I am not sure if it was made in IceChat.
The IceChat God

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #3 on: November 16, 2008, 08:28:01 AM »
Ok i found the script i was talking about (yeah someone has made a script for mIRC)

Features:
•   108 Card Standard Uno Deck
•   Anyone can start Uno by typing !Uno
•   Only player who started the game and Ops can stop Uno by typing !UnoStop
•   Anyone can join by typing Join (not !Join) even after cards have been delt.
•   Anyone can quit by typing !Quit
•   Leaving the channel removes the user from the game.
•   Leaving the network removes the user from the game.
•   Getting kicked from a channel removes the user from the game.
•   User can change nicks during game play.
•   2-10 Players can play.
•   Person to start game (person who typed !Uno) starts game with !Deal once 2 or more people join.
•   7 cards dealt to each player to start the game.
•   Use !Play <Card Color [b,g,r,y]> <Card Number/Letter [0-9,S,D2,R]>
•   Use !Play <Wild/Wild Draw 4 [w,wd4]> <color [b,g,r,y]>
•   Words are excepted during play. (Typing “!Play Blue Five” and “!play b 5” are the same)
•   !CardCount to see how many cards the other players have.
•   !Score & !Score <Nick>
•   Colors, Letters, Numbers, Words are accepted except for Wild Draw Fours which must be !play WD4 <color> or !play WildDraw4 <color> or !play WildDrawFour <color>
•   User quits, their points are still added to winner’s score.
•   User quits, their cards are added back into deck.
•   Shows cards that have been drawn, not all cards.
•   Scores and Number of games played saved to text file so you can unload without losing rankings.
•   !UnoTop10 to see the top 10 players.
•   !Rank (Average Points per Game, Points and Games)

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #4 on: November 16, 2008, 08:33:08 AM »
mIRC Remote(part1):
Code: [Select]
/* This section contains the help contents for IRC Uno Commands.
!Uno - Use this command in an active Uno channel to start a game of IRC Uno.
Join - Use this command to join a game after someone has typed !Uno
!Deal - If you started a game with !Uno you will be informed to use this command to deal the cards after 1-9 other players join.
!Play - Use !Play <color> <card> to play standard cards, 0-9, Reverse, Skip, DrawTwo. Use !Play W <color> to play a wild and !Play WD4 to play a wild draw for. (Colors, numbers and words are accepted values. Red, r, five, 5, d2, drawtwo, etc.. are all accepted values.)
!Draw - Use this if none of your cards play to draw a card off of the top of the deck.
!Pass - If enabled use this to pass if your drawn card cannot play.
!UnoTop10 <Option> - Type this to see the top 10 players. Options: Average, Games, Points
!Score - Type !Score to see your score, type !Score <Nick> to see someone else's score.
!TopCard - Missed which card was on top? This command will reshow it.
!ShowCards - Missed your cards? This command will let you look again.
!UnoStop - Stops Uno, Ops and the player who started the game are allowed to stop it.
!Quit - Tired of the game? !Quit will remove you.
!Players - Who's playing Uno? Type !Players to find out.
!Rank - If enabled this command will tell you how you rank.
!Count - Tells you how many cards each player has.
*/
;----------------------------------------------------------------------
on *:load: {
  echo -a 0,1---=) 4Loaded 11{15IRC-Uno11} 9by 11{15Lost.Lion@gmail.com11} 0(=---
  if (!$exists(" $+ $scriptdir $+ Uno.txt $+ ")) {
    echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " not found, creating now.
    write -l1 " $+ $scriptdir $+ Uno.txt $+ " !PlayerList!
    write -l2 " $+ $scriptdir $+ Uno.txt $+ " !Options!.1.0.1.0.0.0.1.0.0
    write -l3 " $+ $scriptdir $+ Uno.txt $+ " !Channels!,#Uno
    write -l4 " $+ $scriptdir $+ Uno.txt $+ " 0
    if (!$exists(" $+ $scriptdir $+ Uno.txt $+ ")) {
      echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " was not sucessfully created, please make sure $scriptdir is not write-protected and reload Uno.mrc.
      halt
    }
    else {
      echo -a 0,1" $+ $scriptdir $+ Uno.txt $+ " was sucessfully created.
    }
  }
  echo -a 0,1Right click in any Channel or type 4/UnoOptions0 for options.
  unoreset
}
;----------------------------------------------------------------------
on *:text:!deal:%iuno.c2: {
  if ($network == %iuno.np) {
    if (%iuno.dl != 1) {
      if ($nick == %iuno.fp) {
        if ($numtok(%iuno.u,46) >= 2) {
          var %iuno.s 1
          while (%iuno.s <= 7) {
            var %iuno.v 2
            while (%iuno.v <= $numtok(%iuno.u,46)) {
              set %iuno.h. $+ $gettok(%iuno.u,%iuno.v,46) $instok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.v,46) ] ] ,$gettok(%iuno.d,1,46),-0,46)
              set %iuno.d $deltok(%iuno.d,1,46)
              inc %iuno.v
            }
            set %iuno.h. $+ %iuno.fp $instok(%iuno.h. [ $+ [ %iuno.fp ] ] ,$gettok(%iuno.d,1,46),-0,46)
            set %iuno.d $deltok(%iuno.d,1,46)
            inc %iuno.s
          }
          set %iuno.dl 1
          while ($pos($gettok(%iuno.d,1,46),w,0)) {
            set %iuno.d $instok(%iuno.d,$gettok(%iuno.d,1,46),$rand(1,$numtok(%iuno.d,46)),46)
            set %iuno.d $deltok(%iuno.d,1,46)
          }
          set %iuno.dp $instok(%iuno.dp,$gettok(%iuno.d,1,46),1,46)
          set %iuno.d $deltok(%iuno.d,1,46)
          set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
          set %iuno.u $deltok(%iuno.u,1,46)
          if ($pos($gettok(%iuno.dp,1,46),S,1)) {
            skip $network $gettok(%iuno.u,1,46)
          }
          elseif ($pos($gettok(%iuno.dp,1,46),D2,1)) {
            drawtwo $network $gettok(%iuno.u,1,46)
          }
          elseif ($pos($gettok(%iuno.dp,1,46),R,1)) {
            reverse $network $nick
          }
          else {
            showtopcard $network $chan
            unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn.
            unocards $network $gettok(%iuno.u,1,46)
          }
        }
        else {
          unomsg $network $chan Sorry but you need 2 people to play.
        }
      }
      else {
        unomsg $network $chan Sorry but %iuno.fp needs to deal.
      }
    }
    else {
      unomsg $network $chan Uno has already been delt.
    }
  }
}
;----------------------------------------------------------------------
on *:text:join:%iuno.c2: {
  if ($network == %iuno.np) {
    if ($numtok(%iuno.u,46) < 10) {
      if (%iuno.dl != 1) {
        set %iuno.u $addtok(%iuno.u,$nick,46)
        unomsg $network $chan $nick is Uno player $chr(35) $+ $findtok(%iuno.u,$nick,1,46)
        unomsg3 $network %iuno.fp There are now $numtok(%iuno.u,46) players for Uno, type !deal in %iuno.c2 to start the game.
      }
      else {
        if (!$findtok(%iuno.u,$nick,46)) {
          set %iuno.u $addtok(%iuno.u,$nick,46)
          unomsg $network $chan Dealing $nick into current Uno game.
          var %iuno.jt 1
          while (%iuno.jt <= 7) {
            if (!$numtok(%iuno.d,46)) {
              set %iuno.ud %iuno.dp
              unset %iuno.dp
              set %iuno.dp $gettok(%iuno.ud,1,46)
              set %iuno.ud $deltok(%iuno.ud,1,46)
              unomsg $network $chan Shuffling discard pile
              newunodeck x
            }
            set %iuno.h. $+ $nick $instok( %iuno.h. [ $+ [ $nick ] ] ,$gettok(%iuno.d,1,46),-0,46)
            set %iuno.d $deltok(%iuno.d,1,46)
            inc %iuno.jt
          }
          unocards $network $nick
        }
        else {
          unomsg $network $chan Hey $nick $+ , you're already playing.
        }
      }
    }
    else {
      unomsg $network $chan Sorry $nick but 10 users are already playing.
    }
  }
}
;----------------------------------------------------------------------
on *:text:!unostop:%iuno.c2: {
  if ($network == %iuno.np) {
    if ($nick == %iuno.fp || $nick isop %iuno.c2) {
      unomsg $network $chan $nick has stopped IRC-Uno: Type !Uno to begin anew.
      unoreset
    }
    else {
      unomsg $network $chan Only %iuno.fp may stop the current game, type !quit to leave the game.
    }
  }
}
;----------------------------------------------------------------------
on *:text:!uno:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    set %iuno.color $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),2,46)
    set %iuno.rank $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),3,46)
    set %iuno.draw $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),4,46)
    set %iuno.comm $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),5,46)
    set %iuno.c $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",3),2-,44)
    unocolors
    if (!%iuno.fp) {
      set %iuno.fp $nick
      set %iuno.c2 $chan
      set %iuno.np $network
      set %iuno.abv m.b.g.m.y.s.d2.d2.r.0.1.2.3.4.5.6.7.8.9
      set %iuno.words r.Blue.Green.Red.Yellow.Skip.Draw2.DrawTwo.Reverse.Zero.One.Two.Three.Four.Five.Six.Seven.Eight.Nine
      newunodeck
      set %iuno.u $addtok(%iuno.u,$nick,46)
      unomsg $network $chan IRC-Uno Started: Type join to join in.
    }
    else {
      unomsg3 $network %iuno.fp An Uno game has already been started in %iuno.c2 $+ .
    }
    unset %iuno.t.u
  }
}
;----------------------------------------------------------------------
on *:text:!play W*D* *:%iuno.c2: {
  if ($network == %iuno.np) {
    if (($2 == WD4) || ($2 == WildDrawFour) || ($2 == WildDraw4)) {
      if (!$findtok(%iuno.abv,$3,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46)
      elseif ($3 == r) set %iuno.pv m
      else set %iuno.pv $3
      if ($nick == $gettok(%iuno.u,1,46)) {
        if ($pos(%iuno.h. [ $+ [ $nick ] ],zWD4,1)) {
          if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($pos($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),zWD4,1)))) {
            if (%iuno.pv == b || %iuno.pv ==  g || %iuno.pv ==  m || %iuno.pv ==  y ) {
              set %iuno.dp $instok(%iuno.dp,[ %iuno.pv ] $+ $chr(42),1,46)
              set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],zWD4,1,46)
              if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left!
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
              set %iuno.u $deltok(%iuno.u,1,46)
              if (%iuno.pv == b) set %iuno.pv Blue.
              if (%iuno.pv == g) set %iuno.pv Green.
              if (%iuno.pv == m) set %iuno.pv Red.
              if (%iuno.pv == y) set %iuno.pv Yellow.
              if (%iuno.udc) unset %iuno.udc
              var %iuno.d4 1
              while (%iuno.d4 <= 4) {
                if (!$numtok(%iuno.d,46)) {
                  set %iuno.ud %iuno.dp
                  unset %iuno.dp
                  set %iuno.dp $gettok(%iuno.ud,1,46)
                  set %iuno.ud $deltok(%iuno.ud,1,46)
                  unomsg $network $chan Shuffling discard pile
                  newunodeck x
                }
                set [ %iuno.h. [ $+ [ $gettok(%iuno.u,1,46) ] ] ] $instok(%iuno.h. [ $+ [ $gettok(%iuno.u,1,46) ] ],$gettok(%iuno.d,1,46),-0,46)
                set %iuno.d $deltok(%iuno.d,1,46)
                inc %iuno.d4
              }
              unset %iuno.d4
              unomsg $network $chan $gettok(%iuno.u,1,46) draws 4 cards and is skipped!
              drawncards $network $gettok(%iuno.u,1,46) 4
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
              set %iuno.u $deltok(%iuno.u,1,46)
              if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) {
                score $network $nick
              }
              else {
                unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn.
                showtopcard $network $chan
                unocards $network $gettok(%iuno.u,1,46)
              }
            }
            else {
              unomsg $network $chan Please specify a color $nick $+ . !play WD4 [b,g,r,y]
            }
          }
          else {
            unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass.
          }
        }
        else {
          unomsg $network $chan You don't have that card $nick $+ .
        }
      }
    }
  }
}
;----------------------------------------------------------------------
on *:text:!play W*:%iuno.c2: {
  if ($network == %iuno.np) {
    if (!$findtok(%iuno.abv,$3,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46)
    elseif ($3 == r) set %iuno.pv m
    else set %iuno.pv $3
    if ($nick == $gettok(%iuno.u,1,46)) {
      if ($poscs(%iuno.h. [ $+ [ $nick ] ],ZW,1)) {
        if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($poscs($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),ZW,1)))) {
          if (%iuno.pv == b || %iuno.pv == g || %iuno.pv == m || %iuno.pv == y ) {
            set %iuno.dp $instok(%iuno.dp,[ %iuno.pv ] $+ $chr(42),1,46)
            set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],ZW,1,46)
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left!
            if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) {
              score $network $nick
            }
            else {
              set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
              set %iuno.u $deltok(%iuno.u,1,46)
              if (%iuno.udc) unset %iuno.udc
              if (%iuno.pv == b) set %iuno.pv Blue.
              if (%iuno.pv == g) set %iuno.pv Green.
              if (%iuno.pv == m) set %iuno.pv Red.
              if (%iuno.pv == y) set %iuno.pv Yellow.
              unomsg $network $chan $nick changed the color to %iuno.pv $gettok(%iuno.u,1,46) $+ 's turn.
              showtopcard $network $chan
              unocards $network $gettok(%iuno.u,1,46)
            }
          }
          else {
            unomsg $network $chan Please specify a color $nick $+ . !play W [b,g,r,y]
          }
        }
        else {
          unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass.
        }
      }
      else {
        unomsg $network $chan You don't have that card $nick $+ .
      }
    }
  }
}
;----------------------------------------------------------------------
on *:text:!play *:%iuno.c2: {
  if ($network == %iuno.np) {
    if (!$findtok(%iuno.abv,$2,46)) set %iuno.pv $gettok(%iuno.abv,$findtok(%iuno.words,$2,46),46)
    elseif ($2 == r) set %iuno.pv m
    else set %iuno.pv $2
    if (!$findtok(%iuno.abv,$3,46)) set %iuno.px $gettok(%iuno.abv,$findtok(%iuno.words,$3,46),46)
    else set %iuno.px $3
    set %iuno.pvx %iuno.pv $+ %iuno.px
    if ($nick == $gettok(%iuno.u,1,46)) {
      if ($findtok(%iuno.h. [ $+ [ $nick ] ],%iuno.pvx,0,46)) {
        if (($pos($gettok(%iuno.dp,1,46),[ %iuno.pv ],1)) || (($pos($gettok(%iuno.dp,1,46),[ %iuno.px ],1)) && ($iif($pos($gettok(%iuno.dp,1,46),D2,1),$iif($pos(%iuno.pvx,D2,1),$true,$false),$true)))) {
          if ((%iuno.udc != 1) || ((%iuno.udc == 1) && ($pos($gettok(%iuno.h. [ $+ [ $nick ] ],$numtok(%iuno.h. [ $+ [ $nick ] ],46),46),%iuno.pvx,1)))) {
            set %iuno.dp $instok(%iuno.dp,$upper(%iuno.pvx),1,46)
            set %iuno.h. [ $+ [ $nick ] ] $remtok(%iuno.h. [ $+ [ $nick ] ],%iuno.pvx,1,46)
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46) == 1) unomsg $network $chan  $+ %iuno.cr $+ U $+ %iuno.cy $+ n $+ %iuno.cb $+ o $+ %iuno.cg $+ !  $+ %iuno.fc $+ $nick has one card left!
            set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
            set %iuno.u $deltok(%iuno.u,1,46)
            if ($numtok(%iuno.h. [ $+ [ $nick ] ],46)) {
              if ($pos($gettok(%iuno.dp,1,46),S,1)) {
                skip $network $gettok(%iuno.u,1,46)
              }
              elseif ($pos($gettok(%iuno.dp,1,46),D2,1)) {
                drawtwo $network $gettok(%iuno.u,1,46)
              }
              elseif ($pos($gettok(%iuno.dp,1,46),R,1)) {
                reverse $network $nick
              }
              else {
                unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn.
                showtopcard $network $chan
                unocards $network $gettok(%iuno.u,1,46)
              }
            }
            else {
              score $network $nick
            }
            if (!$numtok(%iuno.h. [ $+ [ $nick ] ],46)) {
              score $network $nick
            }
            if (%iuno.udc) unset %iuno.udc
          }
          else {
            unomsg $network $chan Sorry $nick but you must play the card you've drawn or !Pass.
          }
        }
        else {
          unomsg $network $chan Sorry but that card doesn't play $nick $+ .
        }
      }
      else {
        unomsg $network $chan You don't have that card $nick $+ .
      }
    }
  }
}
;----------------------------------------------------------------------
on *:text:!draw:%iuno.c2: {
  if ($network == %iuno.np) {
    if ($nick == $gettok(%iuno.u,1,46)) {
      if (%iuno.udc != 1) {
        if (!$numtok(%iuno.d,46)) {
          set %iuno.ud %iuno.dp
          unset %iuno.dp
          set %iuno.dp $gettok(%iuno.ud,1,46)
          set %iuno.ud $deltok(%iuno.ud,1,46)
          unomsg $network $chan Shuffling discard pile
          newunodeck x
        }
        set %iuno.h. $+ $nick $instok( %iuno.h. [ $+ [ $nick ] ] ,$gettok(%iuno.d,1,46),-0,46)
        set %iuno.d $deltok(%iuno.d,1,46)
        if (%iuno.draw == 1) set %iuno.udc 1
        drawncards $network $gettok(%iuno.u,1,46) 1
        unomsg $network $chan $nick draws a card.
      }
      else {
        unomsg $network $chan $nick you must play the card you drew or !Pass
      }
    }
  }
}
;----------------------------------------------------------------------
on *:text:!TopCard:%iuno.c2: {
  if ($network == %iuno.np) showtopcard $network $chan
}
;----------------------------------------------------------------------
on *:text:!pass:%iuno.c2: {
  if ($network == %iuno.np) {
    if ($nick == $gettok(%iuno.u,1,46)) {
      if (%iuno.draw == 1) {
        if (%iuno.udc == 1) {
          set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
          set %iuno.u $deltok(%iuno.u,1,46)
          unomsg $network $chan $nick passes, $gettok(%iuno.u,1,46) $+ 's turn.
          showtopcard $network $chan
          unocards $network $gettok(%iuno.u,1,46)
          unset %iuno.udc
        }
        else {
          unomsg $network $chan $nick you must draw before you can pass.
        }
      }
      else {
        unomsg $network $chan $nick you must draw until you can play.
      }
    }
  }
}
;----------------------------------------------------------------------
on *:text:!UnoTop10*:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    if (%iuno.tt == 1) {
      if ($2 == Points) filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter2 */*
      elseif ($2 == Games) filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter3 */*
      else filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter */*
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Uno Top 10 for $iif($2 == Points,Total Points,$iif($2 == Games,Games Played,Average Points Per Game $chr(40) $+ Points/Games $+ $chr(41))) is:
      set %iuno.ptv.n $network
      write -il1 " $+ $scriptdir $+ UnoTop.txt $+ " [Top10]
      write -il12 " $+ $scriptdir $+ UnoTop.txt $+ " [EndTop10]
      play -aq5m1tTop10 unomsg3 $nick " $+ $scriptdir $+ UnoTop.txt $+ " 1000
      write -dl1 " $+ $scriptdir $+ UnoTop.txt $+ "
      write -dl12 " $+ $scriptdir $+ UnoTop.txt $+ "
    }
    else {
      unomsg3 $network $nick Sorry but !UnoTop10 is disabled.
    }
  }
}
;----------------------------------------------------------------------
on *:text:!Rank:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    if (%iuno.rank == 1) {
      filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter2 */*
      if ($read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *)) {
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *)
        set %iuno.r.p $readn
        filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter3 */*
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *)
        set %iuno.r.g $readn
        filter -ffac " $+ $scriptdir $+ Uno.txt $+ " " $+ $scriptdir $+ UnoTop.txt $+ " unofilter */*
        set %iuno.r.t $read(" $+ $scriptdir $+ UnoTop.txt $+ ", nw, $nick *)
        set %iuno.r.a $readn
        unomsg3 $network $nick Your IRC Uno Rankings: %iuno.r.a / %iuno.r.p / %iuno.r.g
        unomsg3 $network $nick (Points per Game / Total Points / Total Games)
      }
      else {
        unomsg3 $network $nick Sorry but you are currently unranked, play Uno to get into the rankings!
      }
    }
    else {
      unomsg3 $network $nick Sorry but individual ranks are disabled.
    }
  }
}

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #5 on: November 16, 2008, 08:36:37 AM »
mIRC Remote (part2)
Code: [Select]
;----------------------------------------------------------------------
on *:text:!score:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    if (%iuno.sco == 1) {
      if ($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick)) unomsg3 $network $nick You have $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick),1,47) total points and $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$nick),2,47) games played.
      else unomsg3 $network $nick No score saved.
    }
    else {
      unomsg3 $network $nick !Score has been disabled.
    }
  }
}
;----------------------------------------------------------------------
on *:text:!score *:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    if (%iuno.scon == 1) {
      if ($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2)) unomsg3 $network $nick $2 has $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),1,47) total points and $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),2,47) games played.
      else unomsg3 $network $nick No score saved for $2
    }
    else {
      unomsg3 $network $nick !Score <Nick> has been disabled.
    }
  }
}
;----------------------------------------------------------------------
on *:text:!showcards:%iuno.c2: {
  if ($network == %iuno.np) unocards $network $nick
}
;----------------------------------------------------------------------
on *:text:!quit:%iuno.c2: {
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick
}
;----------------------------------------------------------------------
on *:text:!players:%iuno.c2: {
  if ($network == %iuno.np) {
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Current Uno Players are:
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ $replace(%iuno.u,.,$chr(32))
  }
}
;----------------------------------------------------------------------
on *:text:!Commands:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    set %iuno.cmnd !Uno, Join, !Deal, !Play <color> <card>, !Play [W/WD4] <color>, !Draw, !Pass, !UnoTop10, !Score, !Score <nick>, !TopCard, !ShowCards, !UnoStop, !Quit, !Players, !Rank, !Count
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Commands for IRC Uno are: %iuno.cmnd
    unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Type !Help <Command> for more information on a command.
    unset %iuno.cmnd
  }
}
;----------------------------------------------------------------------
on *:text:!Help*:%iuno.c: {
  if ($chanvalid($chan,$network))  {
    set %iuno.cmnd !Uno.Join.!Deal.!Play.!Draw.!Pass.!UnoTop10.!Score.!TopCard.!ShowCards.!UnoStop.!Quit.!Players.!Rank.!Count
    if (!$findtok(%iuno.cmnd,$2,1,46)) {
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ Sorry but I cannot find any help for that command.
    }
    else {
      set %iuno.line $findtok(%iuno.cmnd,$2,1,46) + 1
      unomsg3 $network $nick  $+ %iuno.fc $+ , $+ %iuno.bc $+ $Read(" $+ $scriptdir $+ Uno.mrc $+ ", %iuno.line)
      unset %iuno.line
    }
    unset %iuno.cmnd
  }
}
;----------------------------------------------------------------------
on *:text:!Count:%iuno.c2: {
  set %iuno.cnt.tmp 1
  set %iuno.cnt.rp Card Count:
  while (%iuno.cnt.tmp <= $numtok(%iuno.u,46)) {
    set %iuno.cnt.rp %iuno.cnt.rp $+ $chr(32) $+ $gettok(%iuno.u,%iuno.cnt.tmp,46) $numtok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.cnt.tmp,46) ] ],46) :
    inc %iuno.cnt.tmp
  }
  unomsg3 $network $nick %iuno.cnt.rp
  unset %iuno.cnt.*
}
;----------------------------------------------------------------------
on *:KICK:%iuno.c: {
  if (($findtok(%iuno.u,$knick,46)) && ($network == %iuno.np)) runoplayer $network $knick
}
;----------------------------------------------------------------------
on *:NICK: {
  if ($network == %iuno.np)  {
    if ($findtok(%iuno.u,$nick,1,46)) {
      set %iuno.u $reptok(%iuno.u,$nick,$newnick,1,46)
      if ($nick == %iuno.fp) {
        set %iuno.fp $newnick
      }
      set %iuno.h. [ $+ [ $newnick ] ] %iuno.h. [ $+ [ $nick ] ]
      unset %iuno.h. [ $+ [ $nick ] ]
    }
  }
}
;----------------------------------------------------------------------
on *:PART:%iuno.c2: {
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick
}
;----------------------------------------------------------------------
on *:QUIT: {
  if (($findtok(%iuno.u,$nick,46)) && ($network == %iuno.np)) runoplayer $network $nick
}
;----------------------------------------------------------------------
alias chanvalid {
  if (%iuno.mn == 0) return $true
  elseif ((%iuno.mn == 1) && ($findtok(%iuno.c. [ $+ [ $2 ] ],$1,1,46))) return $true
  else return $false
}
;----------------------------------------------------------------------
alias score {
  unomsg $1 %iuno.c2 We have a winner! Go $2
  set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,1,46),46)
  var %iuno.sc 1
  var %iuno.cs $numtok(%iuno.u,46)
  while (%iuno.sc <= %iuno.cs) {
    addplayerscoreb $gettok(%iuno.u,%iuno.sc,46)
    inc %iuno.sc
  }
  addplayerscore $2
  unomsg $1 %iuno.c2 $2 gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$2),2,47) games played.
  unoreset
}
;----------------------------------------------------------------------
alias unocid {
  if ($isid) {
    var %e = return $+($chr(3),$color(info),$!unocid: Error -)
    if ($version < 6.0) %e multi-server capability was only added in version 6.0
    if (!$len($1)) %e you must specify a network, server, or wildcarded string as first parameter.
    if (!$regex($ticks,$2,/^-?\d+-?(?:-\d+)?$/)) %e second param should either be a number or a range.
    var %n = $iif($3 isnum 1-15,$3,1), %params = $1 $iif($3 !isnum,$3)
    set -u %result
    scon -at $+ %n unocid % $+ params
    return $gettok(%result,$2,32)
  }
  if ($1 iswm $server) || ($istok($server $network,$1,32)) {
    if ($2) && ($me !ison $2) return
    set -u %result %result $cid
  }
}
;----------------------------------------------------------------------
alias unomsg {
  if ($unocid($1,1,$2)) {
    scid $ifmatch
    msg $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ $3-
    scid -r
  }
}
;----------------------------------------------------------------------
alias unomsg2 {
  if ($unocid($1,1,$2)) {
    scid $ifmatch
    msg $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ $3-
    scid -r
  }
}
;----------------------------------------------------------------------
alias unomsg3 {
  if ($play($1).status) {
    set %iuno.um3n %iuno.ptv.n
    set %iuno.um3c $1
    set %iuno.um3m $2-
  }
  else {
    set %iuno.um3n $1
    set %iuno.um3c $2
    set %iuno.um3m $3-
  }
  if ($unocid(%iuno.um3n,1,%iuno.c2)) {
    scid $ifmatch
    if (%iuno.comm == 0) notice %iuno.um3c  $+ %iuno.fc $+ , $+ %iuno.bc $+ $iif($play(%iuno.um3c).status,$chr(35) $+ $play(%iuno.um3c).pos $+ $chr(32)) $+ %iuno.um3m
    if (%iuno.comm == 1) msg %iuno.um3c  $+ %iuno.fc $+ , $+ %iuno.bc $+ $iif($play(%iuno.um3c).status,$chr(35) $+ $play(%iuno.um3c).pos $+ $chr(32)) $+ %iuno.um3m
    scid -r
  }
}
;----------------------------------------------------------------------
alias runoplayer {
  if ($2 == %iuno.fp) {
    set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,46),46)
    if ($numtok(%iuno.u,46) <= 1) {
      if ($numtok(%iuno.u,46) != 0) {
        addplayerscoreb $2
        addplayerscore $gettok(%iuno.u,1,46)
        unomsg $1 %iuno.c2 $gettok(%iuno.u,1,46) gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$gettok(%iuno.u,1,46)),2,47) games played.
        unoreset
      }
      else {
        unomsg $1 %iuno.c2 No one is playing Uno t.t Type !Uno to begin anew.
        unoreset
      }
    }
    else {
      set %iuno.fp $gettok(%iuno.u,1,46)
      unomsg $1 %iuno.c2 $2 was removed from the current Uno game.
      unomsg $1 %iuno.c2 %iuno.fp is now in control of the current Uno game.
      unomsg3 $1 %iuno.fp You may now stop Uno by typing !unostop into %iuno.c2
      unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn.
      showtopcard $network $chan
      unocards $network $gettok(%iuno.u,1,46)
      if (%iuno.dl == 1) {
        set %iuno.t.x 1
        set %iuno.t.r $numtok(%iuno.h. [ $+ [ $2 ] ],46)
        while (%iuno.t.r >= %iuno.t.x) {
          set %iuno.d $instok(%iuno.d,$gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.x,46),$rand(1,$numtok(%iuno.d,46)),46)
          inc %iuno.t.x
        }
        addplayerscoreb $2
        unset %iuno.h. [ $+ [ $2 ] ]
      }
    }
  }
  elseif ($findtok(%iuno.u,$2,0,46)) {
    set %iuno.u $deltok(%iuno.u,$findtok(%iuno.u,$2,1,46),46)
    if ($numtok(%iuno.u,46) <= 1) {
      if ($numtok(%iuno.u,46) != 0) {
        addplayerscoreb $2
        addplayerscore $gettok(%iuno.u,1,46)
        unomsg $1 %iuno.c2 $gettok(%iuno.u,1,46) gains %iuno.t.u points. For a total of %iuno.t.k points, and a total of $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$gettok(%iuno.u,1,46)),2,47) games played.
        unoreset
      }
      else {
        unomsg $1 %iuno.c2 No one is playing Uno t.t Type !Uno to begin anew.
        unoreset
      }
    }
    else {
      unomsg $1 %iuno.c2 $2 was removed from the current Uno game.
      unomsg $network $chan $gettok(%iuno.u,1,46) $+ 's turn.
      showtopcard $network $chan
      unocards $network $gettok(%iuno.u,1,46)
      if (%iuno.dl == 1) {
        set %iuno.t.x 1
        set %iuno.t.r $numtok(%iuno.h. [ $+ [ $2 ] ],46)
        while (%iuno.t.r >= %iuno.t.x) {
          set %iuno.d $instok(%iuno.d,$gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.x,46),$rand(1,$numtok(%iuno.d,46)),46)
          inc %iuno.t.x
        }
        addplayerscoreb $2
        unset %iuno.h. [ $+ [ $2 ] ]
      }
    }
  }
}
;----------------------------------------------------------------------
alias addplayerscore {
  set %iuno.t.q $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),2,47)
  inc %iuno.t.q
  write -l1 " $+ $scriptdir $+ Uno.txt $+ " $addtok($read(" $+ $scriptdir $+ Uno.txt $+ ",1),$1,46)
  if (!$read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1)) write " $+ $scriptdir $+ Uno.txt $+ " $1 0/0
  set %iuno.t.r $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),1,47)
  set %iuno.t.k $calc(%iuno.t.r + %iuno.t.u)
  $eval(write -s $+ $1 " $+ $scriptdir $+ Uno.txt $+ " $1 %iuno.t.k $+ $chr(47) $+ %iuno.t.q)
}
;----------------------------------------------------------------------
alias addplayerscoreb {
  set %iuno.h. [ $+ [ $1 ] ] $remove(%iuno.h. [ $+ [ $1 ] ],b,g,m,y,z,D4)
  set %iuno.t.s $replace(%iuno.h. [ $+ [ $1 ] ],.,+,S,20,D2,20,R,20,W,50)
  set %iuno.t.s $calc(%iuno.t.s)
  write -l1 " $+ $scriptdir $+ Uno.txt $+ " $addtok($read(" $+ $scriptdir $+ Uno.txt $+ ",1),$1,46)
  if (!$read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1)) write " $+ $scriptdir $+ Uno.txt $+ " $1 0/0
  set %iuno.t.a $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),2,47)
  inc %iuno.t.a
  set %iuno.t.u $calc(%iuno.t.s + %iuno.t.u)
  $eval(write -s $+ $1 " $+ $scriptdir $+ Uno.txt $+ " $1 $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",s,$1),1,47) $+ $chr(47) $+ %iuno.t.a)
}
;----------------------------------------------------------------------
alias unocards { /* Network, Nick */
  if (%iuno.h. [ $+ [ $2 ] ]) {
    set %iuno.ch. [ $+ [ $2 ] ] $sorttok(%iuno.h. [ $+ [ $2 ] ],46,a)
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
    set %iuno.ch. [ $+ [ $2 ] ] $replace(%iuno.ch. [ $+ [ $2 ] ],.,$chr(93) $+ $chr(3))
    set %iuno.ch. [ $+ [ $2 ] ] %iuno.ch. [ $+ [ $2 ] ] $+ $chr(93)
    unomsg3 $1 $2 %iuno.d4.s %iuno.ch. [ $+ [ $2 ] ]
  }
  else {
    echo -s Uno error - User $2 does not have any cards.
  }
}
;----------------------------------------------------------------------
alias showtopcard {  /* Network, Channel */
  set %iuno.dc $gettok(%iuno.dp,1,46)
  set %iuno.dc $replace(%iuno.dc,b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.dc $replace(%iuno.dc,g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.dc $replace(%iuno.dc,m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.dc $replace(%iuno.dc,y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.dc $replace(%iuno.dc,z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.dc $replace(%iuno.dc,.,$chr(93) $+ $chr(3))
  unomsg $1 $2 Top Card: %iuno.dc $+ $chr(93)
  var %iuno.cc 2
  set %iuno.cl Next:
  while (%iuno.cc <= $numtok(%iuno.u,46)) {
    set %iuno.cl %iuno.cl $chr(124) $gettok(%iuno.u,%iuno.cc,46) - $numtok(%iuno.h. [ $+ [ $gettok(%iuno.u,%iuno.cc,46) ] ],46) Cards
    inc %iuno.cc
  }
  unomsg3 $1 $gettok(%iuno.u,1,46)  $+ %iuno.fc $+ , $+ %iuno.bc $+ %iuno.cl
}
;----------------------------------------------------------------------
alias unoreset {
  unset %iuno.*
  set %iuno.color $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),2,46)
  set %iuno.rank $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),3,46)
  set %iuno.draw $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),4,46)
  set %iuno.comm $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),5,46)
  set %iuno.rwt $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),6,46)
  set %iuno.tt $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),7,46)
  set %iuno.sco $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),8,46)
  set %iuno.scon $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),9,46)
  set %iuno.mn $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",2),10,46)
  set %iuno.c $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",3),2-,44)
  set %iuno.as $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),1,32)
  if (%iuno.as > 0) {
    set %iuno.networks $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),2,32)
    set %iuno.as3 $gettok($read(" $+ $scriptdir $+ Uno.txt $+ ",4),3-,32)
  }
  set %iuno.as.c 1
  while (%iuno.as.c <= %iuno.as) {
    set %iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.as.c,44) ] ] $gettok(%iuno.as3,%iuno.as.c,32)
    inc %iuno.as.c
  }
  unocolors
}
;----------------------------------------------------------------------
alias newunodeck {
  if (!$1) set %iuno.ud b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.b1.b2.b3.b4.b5.b6.b7.b8.b9.g0.g1.g2.g3.g4.g5.g6.g7.g8.g9.g1.g2.g3.g4.g5.g6.g7.g8.g9.m0.m1.m2.m3.m4.m5.m6.m7.m8.m9.m1.m2.m3.m4.m5.m6.m7.m8.m9.y0.y1.y2.y3.y4.y5.y6.y7.y8.y9.y1.y2.y3.y4.y5.y6.y7.y8.y9.bD2.bD2.gD2.gD2.mD2.mD2.yD2.yD2.bS.bS.gS.gS.yS.yS.mS.mS.bR.bR.gR.gR.yR.yR.mR.mR.ZW.ZW.ZW.ZW.zWD4.zWD4.zWD4.zWD4
  if ($1) {
    set %iuno.ud $replace(%iuno.ud,b $+ $chr(42),$chr(42),g $+ $chr(42),$chr(42),m $+ $chr(42),$chr(42),y $+ $chr(42),$chr(42))

    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),ZW,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46)
    if ($findtok(%iuno.ud,$chr(42),0,46)) set %iuno.ud $reptok(%iuno.ud,$chr(42),zWD4,1,46)
  }
  var %iuno.it $numtok(%iuno.ud,46)
  unset %iuno.d
  var %iuno.i = 1
  while (%iuno.i <= %iuno.it) {
    var %iuno.r $rand(1,$numtok(%iuno.ud,46))
    set %iuno.d $instok(%iuno.d,$gettok(%iuno.ud,%iuno.r,46),-0,46)
    set %iuno.ud $deltok(%iuno.ud,%iuno.r,46)
    inc %iuno.i
  }
  unset %iuno.ud
}
;----------------------------------------------------------------------
alias skip {
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
  set %iuno.u $deltok(%iuno.u,1,46)
  unomsg $1 %iuno.c2 $2 was Skipped! $gettok(%iuno.u,1,46) $+ 's turn.
  showtopcard $1 %iuno.c2
  unocards $1 $gettok(%iuno.u,1,46)
}
;----------------------------------------------------------------------
alias drawtwo {
  var %iuno.d2v 1
  while (%iuno.d2v <= 2) {
    if (!$numtok(%iuno.d,46)) {
      set %iuno.ud %iuno.dp
      unset %iuno.dp
      set %iuno.dp $gettok(%iuno.ud,1,46)
      set %iuno.ud $deltok(%iuno.ud,1,46)
      unomsg $1 %iuno.c2 Shuffling discard pile
      newunodeck x
    }
    set %iuno.h. [ $+ [ $2 ] ] $instok(%iuno.h. [ $+ [ $2 ] ],$gettok(%iuno.d,1,46),-0,46)
    set %iuno.d $deltok(%iuno.d,1,46)
    inc %iuno.d2v
  }
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
  set %iuno.u $deltok(%iuno.u,1,46)
  unomsg $1 %iuno.c2 $2 Draws Two and is Skipped! $gettok(%iuno.u,1,46) $+ 's turn.
  showtopcard $1 %iuno.c2
  drawncards $network $2 2
  unocards $1 $gettok(%iuno.u,1,46)
}

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #6 on: November 16, 2008, 08:38:46 AM »
mIRC Remote last part (part3) :
Code: [Select]
;----------------------------------------------------------------------
alias unocolors {
  if (%iuno.color == 1) {
    set %iuno.cb 12
    set %iuno.cg 9
    set %iuno.cw 0
    set %iuno.fc 0
    set %iuno.bc 1
  }
  else {
    set %iuno.cb 2
    set %iuno.cg 3
    set %iuno.cw 1
    set %iuno.fc 1
    set %iuno.bc 0
  }
  set %iuno.cr 4
  set %iuno.cy 8
}
;----------------------------------------------------------------------
alias drawncards {
  set %iuno.t.m $numtok(%iuno.h. [ $+ [ $2 ] ],46)
  set %iuno.t.l $gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.m,46)
  set %iuno.t.j $3
  while (%iuno.t.j > 1) {
    dec %iuno.t.m
    set %iuno.t.l %iuno.t.l $+ $chr(46) $+ $gettok(%iuno.h. [ $+ [ $2 ] ],%iuno.t.m,46)
    dec %iuno.t.j
  }
  set %iuno.t.l $replace(%iuno.t.l,b,$eval($chr(3) $+ %iuno.cb $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.t.l $replace(%iuno.t.l,g,$eval($chr(3) $+ %iuno.cg $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.t.l $replace(%iuno.t.l,m,$eval($chr(3) $+ %iuno.cr $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.t.l $replace(%iuno.t.l,y,$eval($chr(3) $+ %iuno.cy $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.t.l $replace(%iuno.t.l,z,$eval($chr(3) $+ %iuno.cw $+ $chr(44) $+ %iuno.bc $+ $chr(91)))
  set %iuno.t.l $replace(%iuno.t.l,.,$chr(93) $+ $chr(3))
  set %iuno.t.l %iuno.t.l $+ $chr(93)
  unomsg3 $1 $2  $+ %iuno.fc $+ , $+ %iuno.bc $+ Drawn Card(s): %iuno.t.l
}
;----------------------------------------------------------------------
alias reverse { /* Network, Nick */
  var %iuno.ri 2
  while (%iuno.ri <= $numtok(%iuno.u,46)) {
    set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,%iuno.ri,46),1,46)
    inc %iuno.ri
    set %iuno.u $deltok(%iuno.u,%iuno.ri,46)
  }
  if ((%iuno.rwt == 1) && ($numtok(%iuno.u,46) == 2)) {
    set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
    set %iuno.u $deltok(%iuno.u,1,46)
  }
  set %iuno.u $instok(%iuno.u,$gettok(%iuno.u,1,46),-0,46)
  set %iuno.u $deltok(%iuno.u,1,46)
  unomsg $1 %iuno.c2 $2 Reversed it! $gettok(%iuno.u,1,46) $+ 's turn.
  showtopcard $1 %iuno.c2
  unocards $1 $gettok(%iuno.u,1,46)
}
;----------------------------------------------------------------------
alias chanpop {
  did -r UnoOptions 10
  didtok UnoOptions 10 44 %iuno.c
  did -c UnoOptions 10 1
}
;----------------------------------------------------------------------
alias chanpop2 {
  did -r UnoOptions 43
  if (!$1) didtok UnoOptions 43 46 %iuno.c. [ $+ [ $did(53).text ] ]
  if ($1) didtok UnoOptions 43 46 %iuno.c. [ $+ [ $did(40).text ] ]
  did -c UnoOptions 43 1
  if (!$1) did -c UnoOptions 40 $findtok($didtok(UnoOptions,40,44),$did(53).text,1,44)
}
;----------------------------------------------------------------------
alias unofilter { ;Average per Game
  if ($calc($gettok($1,2,32)) > $calc($gettok($2,2,32))) return -1
  if ($calc($gettok($1,2,32)) < $calc($gettok($2,2,32))) return 1
  if ($calc($gettok($1,2,32)) == $calc($gettok($2,2,32))) return 0
}
;----------------------------------------------------------------------
alias unofilter2 { ;Total Points
  if ($gettok($gettok($1,2,32),1,47) > $gettok($gettok($2,2,32),1,47)) return -1
  if ($gettok($gettok($1,2,32),1,47) < $gettok($gettok($2,2,32),1,47)) return 1
  if ($gettok($gettok($1,2,32),1,47) == $gettok($gettok($2,2,32),1,47)) return 0
}
;----------------------------------------------------------------------
alias unofilter3 { ;Total Games
  if ($gettok($gettok($1,2,32),2,47) > $gettok($gettok($2,2,32),2,47)) return -1
  if ($gettok($gettok($1,2,32),2,47) < $gettok($gettok($2,2,32),2,47)) return 1
  if ($gettok($gettok($1,2,32),2,47) == $gettok($gettok($2,2,32),2,47)) return 0
}
;----------------------------------------------------------------------
alias UnoOptions {
  dialog -ma UnoOptions UnoOptions
}
;----------------------------------------------------------------------
alias mnunoupdate {
  set %iuno.networks $didtok(UnoOptions,40,44)
  set %iuno.tv.c 1
  while (%iuno.tv.c <= $numtok(%iuno.networks,44)) {
    set %iuno.tv2.c 1
    while (%iuno.tv2.c <= $numtok(%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.tv.c,44) ] ],46)) {
      set %iuno.c $addtok(%iuno.c,$gettok(%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.tv.c,44) ] ],%iuno.tv2.c,46),44)
      inc %iuno.tv2.c
    }
    inc %iuno.tv.c
  }
}
;----------------------------------------------------------------------
dialog -l UnoOptions {
  title "IRC Uno by Lost.Lion@gmail.com"
  size -1 -1 300 328
  option pixels notheme
  tab "Options", 6, 1 1 299 300
  tab "Network Options", 38
  tab "Variations", 27
  tab "About", 7
  button "Apply", 1, 220 300 70 25, ok
  button "UnLoad", 23, 7 265 70 25, tab 6
  button "ReLoad", 24, 78 265 70 25, tab 6
  button "Reset", 25, 149 265 70 25, tab 6
  button "Open Uno.txt", 26, 220 265 72 25, tab 6
  button "Remove Network", 47, 158 168 87 20, tab 38 disable
  button "Add Channel", 48, 7 66 87 20, tab 38 disable
  button "Remove Channel", 49, 158 121 87 20, tab 38 disable
  button "Add Channel", 39, 5 32 87 20, tab 6
  button "Remove Channel", 50, 145 74 87 20, tab 6
  button "Cancel", 46, 141 300 65 25
  box "Color Scheme", 8, 5 95 140 55, tab 6
  box "User Communications", 20, 145 95 140 55, tab 6
  box "Rank System", 32, 5 150 140 55, tab 6
  box "Score System", 34, 145 150 140 55, tab 6
  text "Uno Channel(s)", 9, 145 33 84 17, tab 6 center
  text "Uno for mIRC created by Lost.Lion@gmail.com", 11, 6 24 289 17, tab 7
  text "Version 1.13", 12, 6 40 100 17, tab 7
  text "Find me at irc.rizon.net channel #Lovely Nick KovuKun", 14, 5 83 290 17, tab 7
  text "Special Thanks To:", 15, 5 122 291 17, tab 7 center
  text "superlady of #lovely for giving me many ideas and lots of support.", 16, 5 141 291 30, tab 7 center
  text "All the members of #lovely for putting up with the testing and for joining in to help find the bugs.", 17, 5 172 291 30, tab 7 center
  text "RG for making the Dialog Editor and Script Editor that I am Using.", 18, 5 203 291 30, tab 7 center
  text "Networks", 41, 7 150 100 17, tab 38
  text "Channels", 42, 7 103 100 17, tab 38
  text "IRC Uno uses $findcid ($unocid) by FiberOPtics", 44, 5 253 291 17, tab 7 center
  link "http://www.mirc.net", 13, 6 56 146 17, tab 7
  link "http://www.mircscripts.org/users/RG", 19, 58 234 185 17, tab 7
  link "http://www.mirc.net/user/FiberOPtics", 45, 58 272 186 17, tab 7
  radio "Black Background", 4, 7 113 107 17, tab 6 group
  radio "White Background", 5, 7 129 107 17, tab 6
  radio "Notice", 21, 148 113 57 17, tab 6 group
  radio "Message", 22, 148 129 64 17, tab 6
  check "Enable !Rank", 3, 7 168 100 17, tab 6
  check "Reverse acts like Skip with 2 Players", 28, 5 45 196 17, tab 27
  check "Enable !UnoTop10", 33, 7 183 111 17, tab 6
  check "Enable !Score", 36, 147 168 100 17, tab 6
  check "Enable !Score <nick>", 37, 147 184 126 17, tab 6
  check "Enable Multi-Network", 35, 7 26 118 17, tab 38
  check "1 !Draw then !Pass", 2, 5 27 117 17, tab 27
  check "All Networks", 54, 145 68 100 17, tab 38 disable
  check "Cards Dealt Face Up", 29, 5 81 124 17, tab 27 disable
  check "!Play or Lose (No !Draw)", 30, 5 99 140 17, tab 27 disable
  check "DrawTwo/DrawFours Accumulate", 31, 5 117 185 17, tab 27 disable
  check "Wild Draw 4 Doesn't Skip Player", 55, 5 63 195 17, tab 27 disable
  combo 10, 145 51 138 70, tab 6 drop sort
  combo 40, 7 168 149 70, tab 38 drop sort disable
  combo 43, 7 121 149 70, tab 38 drop sort disable
  edit "#Channel", 51, 5 51 138 20, tab 6
  edit "#Channel", 52, 7 47 138 20, tab 38 disable
  edit "Network", 53, 145 47 138 20, tab 38 disable
}
;----------------------------------------------------------------------
on *:dialog:UnoOptions:init:0: {
  if (%iuno.draw == 1) did -c UnoOptions 2
  if (%iuno.rank == 1) did -c UnoOptions 3
  if (%iuno.color == 1) did -c UnoOptions 4
  if (%iuno.color == 2) did -c UnoOptions 5
  if (%iuno.comm == 0) did -c UnoOptions 21
  if (%iuno.comm == 1) did -c UnoOptions 22
  if (%iuno.rwt == 1) did -c UnoOptions 28
  if (%iuno.tt == 1) did -c UnoOptions 33
  if (%iuno.sco == 1) did -c UnoOptions 36
  if (%iuno.scon == 1) did -c UnoOptions 37
  if (%iuno.mn == 1) {
    did -c UnoOptions 35
    didtok UnoOptions 40 44 %iuno.networks
    didtok UnoOptions 43 46 %iuno.c. [ $+ [ $gettok(%iuno.networks,1,44) ] ]
    did -c UnoOptions 40 1
    did -c UnoOptions 43 1
    did -b UnoOptions 39,51,10,50
    did -e UnoOptions 52,53,48,54,43,49,40,47
  }
  chanpop
}
;----------------------------------------------------------------------
on *:dialog:UnoOptions:sclick:23: {
  dialog -x UnoOptions
  unload -rs " $+ $scriptdir $+ Uno.mrc $+ "
}
on *:dialog:UnoOptions:sclick:24: {
  dialog -x UnoOptions
  reload -rs " $+ $scriptdir $+ Uno.mrc $+ "
}
on *:dialog:UnoOptions:sclick:25: {
  dialog -x UnoOptions
  unoreset
}
on *:dialog:UnoOptions:sclick:26: {
  dialog -x UnoOptions
  run " $+ $scriptdir $+ Uno.txt $+ "
}
on *:dialog:UnoOptions:sclick:46: {
  dialog -x UnoOptions
}
on *:dialog:UnoOptions:sclick:39: {
  set %iuno.c $addtok(%iuno.c,$did(51).text,44)
  chanpop
}
on *:dialog:UnoOptions:sclick:50: {
  set %iuno.c $remtok(%iuno.c,$did(10,1).seltext,44)
  did -d UnoOptions 10 $did(10).sel
  chanpop
}
on *:dialog:UnoOptions:sclick:48: {
  if ($did(54).state == 1) {
    set %iuno.c.all $addtok(%iuno.c.all,$did(52).text,46)
    did -r UnoOptions 53
    did -a UnoOptions 53 All
  }
  else {
    set %iuno.c. [ $+ [ $did(53).text ] ] $addtok(%iuno.c. [ $+ [ $did(53).text ] ],$did(52).text,46)
  }
  if (!$findtok($didtok(UnoOptions,40,46),$did(53).text,46)) {
    did -a UnoOptions 40 $did(53).text
  }
  mnunoupdate
  chanpop2
}
on *:dialog:UnoOptions:sclick:49: {
  set %iuno.c. [ $+ [ $did(40).seltext ] ] $remtok(%iuno.c. [ $+ [ $did(40).seltext ] ],$did(43).seltext,46)
  if ($numtok( %iuno.c. [ $+ [ $did(40).seltext ] ],46) == 0) {
    unset %iuno.c. [ $+ [ $did(40).seltext ] ]
    did -d UnoOptions 40 $did(40).sel
  }
  did -c UnoOptions 40 1
  chanpop2 X
}
on *:dialog:UnoOptions:sclick:47: {
  unset %iuno.c. [ $+ [ $did(40).seltext ] ]
  did -d UnoOptions 40 $did(40).sel
  set %iuno.networks $remtok(%iuno.networks,$did(40).seltext,1,44)
  chanpop2
}
on *:dialog:UnoOptions:sclick:40: {
  chanpop2 X
}
on *:dialog:UnoOptions:sclick:35: {
  if ($did(35).state == 1) {
    did -r UnoOptions 40,43
    didtok UnoOptions 40 44 %iuno.networks
    didtok UnoOptions 43 46 %iuno.c. [ $+ [ $gettok(%iuno.networks,1,44) ] ]
    did -c UnoOptions 40 1
    did -c UnoOptions 43 1
    did -b UnoOptions 39,51,10,50
    did -e UnoOptions 52,53,48,54,43,49,40,47
  }
  else {
    did -e UnoOptions 39,51,10,50
    did -b UnoOptions 52,53,48,54,43,49,40,47
  }
}
;----------------------------------------------------------------------
on *:dialog:UnoOptions:close:*: {
  set %iuno.draw $did(2).state
  set %iuno.rank $did(3).state
  set %iuno.rwt $did(28).state
  set %iuno.tt $did(33).state
  set %iuno.sco $did(36).state
  set %iuno.scon $did(37).state
  set %iuno.mn $did(35).state
  if ($did(4).state == 1) set %iuno.color 1
  else set %iuno.color 2
  if ($did(21).state == 1) set %iuno.comm 0
  else set %iuno.comm 1
  unocolors
  write -l3 " $+ $scriptdir $+ Uno.txt $+ " !Channels! $+ $chr(44) $+ %iuno.c
  write -l2 " $+ $scriptdir $+ Uno.txt $+ " !Options! $+ $chr(46) $+ %iuno.color $+ $chr(46) $+ %iuno.rank $+ $chr(46) $+ %iuno.draw $+ $chr(46) $+ %iuno.comm $+ $chr(46) $+ %iuno.rwt $+ $chr(46) $+ %iuno.tt $+ $chr(46) $+ %iuno.sco $+ $chr(46) $+ %iuno.scon $+ $chr(46) $+ %iuno.mn
  unset %iuno.c
  if (%iuno.mn == 0) set %iuno.c $didtok(UnoOptions,10,44)
  else {
    mnunoupdate
  }
  set %iuno.lfc 1
  set %iuno.lft $numtok(%iuno.networks,44) $+ $chr(32) $+ %iuno.networks
  while (%iuno.lfc <= $numtok(%iuno.networks,44)) {
    set %iuno.lft $addtok(%iuno.lft,%iuno.c. [ $+ [ $gettok(%iuno.networks,%iuno.lfc,44) ] ],32)
    inc %iuno.lfc
  }
  write -l4 " $+ $scriptdir $+ Uno.txt $+ " %iuno.lft
  unset %iuno.lfc
  unset %iuno.lft
}
;----------------------------------------------------------------------
menu channel {
  Uno Options: UnoOptions
}
;----------------------------------------------------------------------
on *:unload: {
  unset %iuno.*
  echo -a 0,1--=) 4UnLoaded 11{15IRC-Uno11} 9by 11{15Lost.Lion@gmail.com11} 0(=--
}

mIRC Variables:
Code: [Select]
%iuno.color 1
%iuno.rank 1
%iuno.draw 1
%iuno.comm 0
%iuno.rwt 0
%iuno.tt 1
%iuno.sco 1
%iuno.scon 1
%iuno.mn 0
%iuno.as 0
%iuno.as.c 1
%iuno.cb 12
%iuno.cg 9
%iuno.cw 0
%iuno.fc 0
%iuno.bc 1
%iuno.cr 4
%iuno.cy 8
%iuno.c #Uno
Sorry for the huge code paste the script was really big  - this were the remotes and variables [unmodified].If anyone is good at mIRC scripting he may try his/her skills and convert it for icechat usage  :lol:

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #7 on: November 16, 2008, 01:21:45 PM »
I could take a shot at this.

So far I only have the stuff for randomly selecting and removing 7 cards from the deck (which would happen every time a person joins a game)

I'm not even gonna look at those mirc scripts, I won't gat anything out of the anyway, but I'll try to keep you updated about the project
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #8 on: November 17, 2008, 12:13:39 PM »
This is just a short reply to keep you updated.

The project is a bit bigger than I thought (lots of things that need to be checked and such)

This is what I Have:
-players can join
-players are dealt 7 cards at the start (assuming there is 7 cards in the deck)
-the order of players is random
-players can put cards only on their own turn
-you can only put the cards you are allowed to put in a certain situation
-the cards you put are removed from your hand
-the game ends if someone gets rid of all his cards

Still to do:
-add full functionality to the 'draw 2' and 'wild draw 4 cards
-add a !draw command for when you don't have any cards to put
-add some other commands such as !showcards, !count, !pass and a few others
-reshuffle the deck if all cards get picked up
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #9 on: November 17, 2008, 05:25:40 PM »
Sounds quite a big progress to me , good job   :-)

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Card Game Scripts
« Reply #10 on: November 17, 2008, 05:36:48 PM »
Definately something that will be added to the Main Script Downloads.
The IceChat God

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #11 on: November 18, 2008, 05:47:46 AM »
Now I seem to have a functioning UNO script, It still needs some cleaning and a few added functions, but it fulfills most of the stuff on your list.

-The game gets activated when someone types !uno
-30s later the game starts
-at least 2 players must have joined during this time for the game to start
-when you join you get 7 cards from the top of the deck
-you put cards with the command !play card (color)
-if you don't have any cards to put you draw a new card with the !draw command
-if you still have no card to put after the !draw command you can pass over your turn to the next player with the !pass command
-every time it's your turn your cards are showed to you
-whenever you are made to draw cards, only the drawn cards are shown
-changing nicknames is allowed
-leaving the channel (in any way) removes the player from the game
-the gamestarter or an operator can stop the game at any time with a !stop command
-if there at some point after the game has started is only one player the game ends
-if the cards in the deck run out, the cards that have been put on the table (except the top card) are shuffled and made into a new deck
-you can quit the game with a !quit command
-the command !cards shows you your cards
-the command !card shows the top card
-the command !count shows how may card each player has
-when a player has only one card left the script announce is by saying: "Nickname has UNO"



I have a couple questions about the first card though, right now it's treated almost as a number or wild card, but if it happens to be, let's say a wild draw four card, should the first person then draw 4 cards, and such? Right now it just randomly selects a color and the play continues as if it was a wild card.
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #12 on: November 18, 2008, 05:46:08 PM »
Which card do you mean by "first card"? - as for the wild draw 4 card [WD4] it should work like this:
The next player draws four cards and he/she is skipped.
Example:
----------------------------------------------------------------------
Player one throws his WD4 and chooses yellow as top color.
Player two loses his turn and draws four cards.
Player three's turn : he has to throw a yellow card or change color again.
----------------------------------------------------------------------
(for two player game:player one throws wd4 and chooses color the other
draws four cards and player one plays again)

The [W] card - Example:
----------------------------------------------------------------------
Player one throws his W and changes top color.
Next player has to throw a card of the same color player one has chosen.
----------------------------------------------------------------------

When the d2 card is thrown the next player loses his/her turn (is skipped) and draws
two cards.For two player game the one who used d2 plays again and the
other draws two cards.

When the S card is used the next player loses his/her turn (gets skipped).
For two player game the player who used the S card plays again.

R reverses the turns of the players and for two player game
you choose in UNO options whether it should be used as a
normal card otherwise it does the same as the S card.

One note:Whenever a player's turn comes he shall receive notice about
his current deck and also about the turns of players to play next and the number of cards they own.

Example:
--Botname-- Next: | Player2 - 7 Cards | Player3 - 7 Cards | Player4 - 7 Cards
--Botname-- [6][9][1][ S ][7][R][W]

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #13 on: November 18, 2008, 11:23:21 PM »
with the "first card" i meant the card that is dealt from the top of the deck when the game is started, should the player that is chosen to start the game, suffer from that card?

the "reverse" card, will always reverse the player order, no options for that.

The reason for not showing the number of cards that each player has, is that I want to reduce the information that can automatically be sent at once. Right now the maximum number of lines sent at once is 4, sending the number of cards would increase this to 5.

I found the rules for the game: http://en.wikipedia.org/wiki/Uno_(game)#Official_rules I will try to implement as many of those as possible.

Also the player running the script will not be able to play, and that will not change, because he would have an advantage, as he can see the other players cards.
"I don't know what World War 3 will be fought with, but I know World War 4 with be fought with sticks and stones." - Albert Einstein

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #14 on: November 19, 2008, 08:14:09 AM »
No it doesn't make the first player draw any cards.
If the first card is D2 the first player doesn't draw cards he/she just throws another D2 card or a card of the same color.
If the first card is S or R the same thing (throw same card or same color).

If the first card is WD4 the first player doesn't draw any cards.
However,when first card is WD4 or W i can't remember if it is up to the first player to choose the color
of the card to play or if it is randomly selected.

In any case the first card is treated as color,number or type and it doesn't cause any 'damage'.