Damn Pierce, winning hands are shame to script!!! I don't even see all the logic behind this... I could create tons of "if" statement but it wouldn't help anyone at all. Anyways....
Notice to Pierce if you ever read this again: I tested it with my system and I get errors few times. I'm just not sure of the answer.
If anyone helps I will of course appreciate but I just posted the references to my situation...
I'm actually stuck... lol and out of beers!
Code: Select all
function ValidateCards( data_elem, player_cards )
//Main Hand
var check_royalFlush := 0,
check_straightFlush := 0,
check_fourOfAKind := 0,
check_fullHouse := 0,
check_flush := 0,
check_straight := 0,
check_treeOfAKind := 0,
check_twoPairs := 0,
check_pair := 0,
check_highCard;
//The cards
var first_card := data_elem.GetProp( "TCard1" ),
second_card := data_elem.GetProp( "TCard2" ),
third_cards := data_elem.GetProp( "TCard3" ),
fourth_card := data_elem.GetProp( "TCard4" ),
fifth_card := data_elem.GetProp( "TCard5" ),
playerCard1 := player_cards[1],
playerCard2 := player_cards[2];
//Right now I'm testing with all the 7cards on the table for each players. I might fix later to read
//the process flop-turn & || river to append in var the_cards
var the_cards := {first_card, second_card, third_cards, fourth_card, fifth_card, playerCard1, playerCard2};
var clubs := 0,
diamonds := 0,
hearts := 0,
spades := 0;
foreach card in the_cards
if( card[1] == "clubs" )
clubs += 1;
if( clubs >= 5 )
check_flush := 1;
break;
endif
elseif( card[1] == "diamonds" )
diamonds += 1;
if( diamonds >= 5 )
check_flush := 1;
break;
endif
elseif( card[1] == "hearts" )
hearts += 1;
if( hearts >= 5 )
check_flush := 1;
break;
endif
elseif( card[1] == "spades" )
spades += 1;
if( spades >= 5 )
check_flush := 1;
break;
endif
endif
SleepMS(2);
endforeach
var cardValue := array{},
i;
for( i:=1; i<=the_cards.Size(); i+=1 )
var tempCard := the_cards[i],
the_card := tempCard[2];
cardValue.Append( the_card );
SleepMS(2);
endfor
//stuff to identify Straight, HighCard, Pairs, here...
if( check_royalFlush )
Broadcast( "check_royalFlush oh and by the way YOU SUCK! ..." ); //To be removed
return 1;
elseif( check_straightFlush )
Broadcast( "check_straightFlush" );
return 1;
elseif( check_fourOfAKind )
Broadcast( "check_fourOfAKind" );
return 1;
elseif( check_fullHouse )
Broadcast( "check_fullHouse" );
return 1;
elseif( check_flush )
Broadcast( "check_flush" );
return 1;
elseif( check_straight )
Broadcast( "check_straight" );
return 1;
elseif( check_treeOfAKind )
Broadcast( "check_treeOfAKind" );
return 1;
elseif( check_twoPairs )
Broadcast( "check_twoPairs" );
return 1;
elseif( check_pair )
Broadcast( "check_pair" );
return 1;
else
Broadcast( "check_highCard" );
return 1;
endif
return 1;
endfunction
Data_elem is the reference to the datafile pokertable element ( You can use different poker tables with different settings ).
Property of each TableCards & PlayersCards are array. First param is the string color name ( clubs, diamonds, hearts, spades ) and the second param is the card value ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q ,K , A ).