This extension is provided as-is without warranty. You are free to use it to your heart's content at your own risk.
First of all, download the Zip file from here:
Once downloaded extract the zip file and follow these instructions:
1. Copy Blackjack.mfx into your MMF2 Program folder under Extensions
2. Copy Blackjack.ext to your MMF2 Program folder under Data\Runtime\iPhone
3. If you plan to create a PC version of your App copy Blackjack.mfx into your MMF2 Program folder under Data\Runtime.
Basically it assumes that you load your cards into an active with 53 frames: 0 frame is the card back and then the rest are 1-13, 14-26, 27-39,40-52 A-K in the order Clubs, Diamonds, Hearts, Spades. You don't have to load them like this, but just make sure whatever you're doing you represent cards with a value 1-52 in that suit order. Once you do that you can use the following expressions:
GetCardValue( [Pass in the Current Frame/Alterable Value/etc. of the card you want the value for ] ) and it returns a value 1-13 which is A-K without accounting for suit.
CanSplitHand( Card # Value, Card # Value ) is a quick way to test if the player has a pair.
DealerHas17OrBetter( [String of dealer cards separated by commas] ) returns 1 if the cards total 17 or more. e.g. "1,51,27" 1 (Ac), 51 (Qs), 27 (Ah) returns 0 because the total is 12.
CanHit( [Pass it a string which is a comma separated list of animation frames for cards that you want to see if they total 20 or less e.g. "1,51,27" 1 (Ac), 51 (Qs), 27 (Ah)] ) and it returns 1 if you can hit (you have 20 or less) or 0 if you cannot. It treats Aces as 1s so AAQ = 12 so it returns 1. A46 = 21 so it would return 0.
Has21( [Pass it a string which is a comma separated list of animation frames for cards that you want to see if they total 21 e.g. "51,27" 51 (Qs), 27 (Ah)] ) and it returns 1 if you have 21 or 0 if you do not. It handles Aces as 11 if it makes it 21.
IsBusted takes a string like Has21 and returns 1 if > 21 else 0. It treats Aces as 1s.
GetHandValue takes a string like CanHit and returns the optimal hand value (e.g. Treats one ace as an 11 as long as it doesn't push the hand over 21)
If you can follow my pattern for representing cards as values of 1 - 52 in the suit order you should be able to use this extension without a problem.
There are no actions or conditions. This is all about expressions to test conditions.
I've used it on my War 2012 game as well. It's a good way to convert card values to face numeric values though in War I change any 1 to 14 since Ace trumps a King in that game. It may not help many people, but if it helps one of you it is worth sharing. If you use it for a blackjack game please make one better than my Blackjack Smack app. I wish you all the best.