Author Topic: Card Game Scripts  (Read 32187 times)

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Card Game Scripts
« Reply #30 on: December 01, 2008, 05:52:20 AM »
Poker Hand Ranking (highest to weakest list):

Five of a Kind
Only possible way to achieve this is by using a wild card (joker).For example:Having four aces and turning your joker into the fifth ace.

Royal Flush
The five highest cards, the 10 through the Ace, all five of the same
suit. A royal flush is actually an ace-high straight flush. Which suit it
is doesn't matter in poker. Two people with royal flushes would tie.

Straight Flush
Any five cards of the same suit in consecutive numerical order.

Four of a Kind
Four cards of the same denomination.

Full House
Any three cards of the same denomination, plus any pair of a
different denomination. Ties are broken first by the three of a kind,
then the pair.Example: three sevens and two threes.

Flush
Any five non-consecutive cards of the same suit.

Straight
Any five consecutive cards of mixed suits. Ace can be high or low.

Three of a Kind
Three cards of the same denomination.

Two Pair
Any two cards of the same denomination, plus any other two cards
of the same denomination. If both hands have the same high pair, the
second pair wins. If both pairs tie, the high card wins.

Pair
Any two cards of the same denomination. In a tie, the high card wins.

High Card
If no other hand is achieved, the highest card held wins.

source: http://www.pokerpages.com/pokerinfo/rank/index.htm


Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #31 on: December 01, 2008, 06:42:35 AM »
A lot of the stuff from the uno script could be applied to this one too.

There should be a max 5 player limit though (just to make sure there are enough cards for everyone 5 x 5 x 2 = 50, total number of cards: 53 with joker)

The function for checking your hand might be a bit complicated, but very doable, you just have to find out a good order to check the hand, to minimize the work. Like first check for flush, if true you can skip pair, three of a kind, full house etc. then check for five of a kind, then 4 of a kind then 3 of a kind, then full house, then pair, two pairs. And as there are only 10 possible straights, one could make a loop for checking all of them, without slowing down the script a lot.

The betting part might actually be the most complicated thing.

I might take a shot at this when I have the time and inspiration
"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 #32 on: December 01, 2008, 07:12:01 PM »
Yeah indeed it has stuff that could be taken from uno associated with player turns,players receiving cards from the deck,players joining,dropping out of game and changing names,card drawing etc.

Good to hear that hand rankings and checking hand isn't as big issue as i thought.I imagined it would be far more difficult than the betting part.The loop for Straights kills 3 birds with one rock by checking for the 10 possible straights it also finds if there will be any Straight Flushes or Royal Flushes since all 3 ranks demand five consecutive cards.

Again,well done for uno  :-) i'm sure it will be fun too playing draw poker if one day you decide to begin making the script.

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #33 on: December 06, 2008, 05:41:29 AM »
Ok, I started working on this script, although I haven't had a lot of time to write it yet.

I right now you can join the game and throw away cards and get new cards to replace them.

I also have a basic function for checking the hand (it got a bit more complicated than I had expected, but it's working pretty well atm) but I might rewrite it in case I decide to sort the cards (which would make the checking faster, but then again I'd have a function that sorts the cards, so I don't know if it would be any faster) which would make it easier to check for the highest 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 #34 on: December 11, 2008, 04:51:50 AM »
I just remembered that some people who play using the wild card consider the "five of a kind" to be one rank above the "four of a kind" and not the highest one.I was trying to think how hard it is to get it compared to the straight flush and yea i think straight flush and royal flush are more difficult to get...

It's up to the one who makes the script to decide :P

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #35 on: December 11, 2008, 06:20:07 AM »
The first version of the script will probably not have the Joker card at all, because I haven't figured out a good(fast) way to check for the 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

Atreus

  • Guest
Re: Card Game Scripts
« Reply #36 on: January 29, 2009, 12:54:03 PM »
Oy, Morio, I've been using this script for a while, with it mostly working ( a few bugs having to do with people parting) and now it's grown from a small problem to a consistent pain in the ***.  Eevery tiem a new game starts (30 seconds after !uno), i get an error, every time:
154320  ->> ERROR:modScriptFunctions:Function:RunScript:0 Error Number:450 : Wrong number of arguments or invalid property assignment

BEcause of this error, it does not say the order/card that starts the game.  It's a complete pain.  The script i'm using is basically vanilla with three modifications: !pl is interchangable with !play, !dr is interchangable with !draw, and it's only allowed to be played on #uno.


I also got this error randomly:
194420  ->> ERROR:modScriptFunctions:Function:RunScript:0 Error Number:9 : Subscript out of range: 'AssignedTurn'
but only every once is a long while

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Card Game Scripts
« Reply #37 on: January 29, 2009, 01:02:22 PM »
Those are actually IceChat Errors, and not script errors.
I would have to see the script and see what is causing it.
The IceChat God

Atreus

  • Guest
Re: Card Game Scripts
« Reply #38 on: January 29, 2009, 01:06:16 PM »
Those are actually IceChat Errors, and not script errors.
I would have to see the script and see what is causing it.

It's the uno script that's under ice7 scripts on the site.  http://www.icechat.net/site/index.php?irc-client=icechat7scripts // the secodn script.

Offtopic, but that !seen script is terribly complicated...  the one i use is simply a lot of sub ON*'s

Morio

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 256
Re: Card Game Scripts
« Reply #39 on: January 29, 2009, 09:22:12 PM »
Atreus: you don't happen to have a pretty new version of icechat 9 do you? If that is the case, you need to fix one line in the script, in the OnText sub the second 'SendCommand' line should look like this:
Code: [Select]
SendCommand "/timer unotimer 1 30 /! PlayUNO " & "newgame | "  & UnoChannel & " | " & ServerNumber & " | newgame"

About the !seen script. The one on the site is basically a bunch of ONJOIN, ONPART etc subs, and a scanning sub. But nick changes and quitting require some special care, since they are network specific, not channel specific.
"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

Atreus

  • Guest
Re: Card Game Scripts
« Reply #40 on: January 30, 2009, 07:54:08 AM »
Atreus: you don't happen to have a pretty new version of icechat 9 do you?
Yes O.o  Okay, then...  I see the difference in the script; there's spaces.  I'mma guessin' that Ice9 handles subs differently when used with /!
About the !seen script. The one on the site is basically a bunch of ONJOIN, ONPART etc subs, and a scanning sub. But nick changes and quitting require some special care, since they are network specific, not channel specific.
I just do:
Code: [Select]
Sub ONNICK(NewNick,OldNick,ServerNumber)
ntime=getidentifier("$now")
writeinifile "seen.ini",servernumber & " times",newnick,ntime
writeinifile "seen.ini",servernumber & " times",oldnick,""
writeinifile "seen.ini",servernumber & " reasons",nickname,"changing their nick from " & oldnick
writeinifile "seen.ini",servernumber & " reasons",oldnick,""
End Sub
and
Code: [Select]
Sub ONQUIT(Nickname,Host,Reason,ServerNumber)
ntime=getidentifier("$now")
writeinifile "seen.ini",servernumber & " times",nickname,ntime
writeinifile "seen.ini",servernumber & " reasons",nickname,"quitting"
End Sub

And basically my whole code goes like that.  I'm planning to change it from servernumber to a variable of getidentifier("$network") or somethign like that ($network may depend on the open window, not where the quit/nickchange was)

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: Card Game Scripts
« Reply #41 on: January 30, 2009, 08:03:38 AM »
Atreus: to make $network specific to the network the event happened on, use GetIdentifier("$network", ServerNumber)
This message brought to you by the Wonderful Wizard of Oz.