Ok I finally started working on it a little. Right now all I got is the detection system worked out. Right now its kinda gaudy, I'm going to change the TBox areas to TPoints then all the points are worked off from that one point making it easy.
As you'll see in the script I'm using a record to story the cards; Kind = Heart, Diamond, Spade or Club. Num is obvious its the number but I'm using 2 - 14. I'm thinking on some kind of point system to figure out hands and how good they are etc.
Now I'm kinda stumped on how to do the system to find out possible hands from cards on table. How to sort what my best hand is (from 7 cards). How to sort and rank hands. Umm I know there's others I wanted but can't remember atm.
Also I want to record their names and start doing stats on them. How many times they fold, raise, call, check, win, lose and more if I can. All of this I will save in a ini file and use it for future use in case I run into same ppl.
I will need to figure out how to read the different text and load it. I've never done it so I might need help. I really don't want to do it manually, there is commas and other strange letters that is used for names. So if anyone knows what font it is and how to load it in scar please tell me how to do it.
Edit: Later I'll be doing a complex automation that calculates the odds counts cards which will also be given to the player if they want to play with it w/o auto. But the auto will bet by percentages +/- random amount depending on how much the player has and much more.
Here's a picture to give you guys the idea. You'll notice only 4 cards on table but as I'm sure you know 1 more card will be flipped after betting. Also note its a jpg not the original bmp which was 1.75megs so my script detection might now work on this picture if you want to try it.

Note I am repeating the detection system and clearing the debug constantly. This will be tweaked and changed completely later on.
{ Client Size 799, 576
Player Layout
9 Chips 1
8 2
7 3
6 5 4
Sit at 5
{
Spade = 33 color 0
Clubs = 16 color 0
Dimonds = 58 color 526536
Hearts = 45 color 394952
Table Cards
y1 = 199 Card Type
y2 = 215
y1 = 184 Card Num
y2 = 198
x2 +12
X1a = 274 286
x1b = 328 340
x1c = 382 394
x1d = 436 448
x1e = 490 502
Card1Num := 274, 184, 286, 198
Card2num := 328, 184, 340, 198
Card3num := 382, 184, 394, 198
Card4Num := 436, 184, 448, 198
Card5Num := 490, 184, 502, 198
My Cards
Kind Number
y1a = 385 y1N = 370
y2a = 399 y2N = 384
x1a = 374
x2a = 386
y1b = 391 y1N = 374
y2b = 403 y2N = 388
x1b = 389
x2b = 401
}
type
Card = record
Kind: string;
Num: integer;
end;
Var
CardsDealt, LastDealt: Integer;
SevenBlack, SevenRed, NineRed, NineBlack: integer;
TCardKindArea, TCardNumArea, MyKindArea, MyNumArea: Array of TBox;
MyCards: String;
MyCardArr, TCardArr: Array of Card;
function CardNumber(Area: TBox): Integer;//requires bitmaps
var
B, R: TPointArray;
i, x, y, Len: integer;
CardNum, CardNumCount: TIntegerArray;
begin
CardNum := [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
CardNumCount := [ 35, 26, 39, 31, 37, 26, 42, 35, 69, 33, 54, 45, 38];
FindColorsTolerance(B, 131586, Area.x1, Area.y1, Area.x2, Area.y2, 0);
FindColorsTolerance(R, 1184458, Area.x1, Area.y1, Area.x2, Area.y2, 0);
Len := Length(B)+Length(R);
if (Len = 26) then
if FindBitmapIn(SevenBlack, x, y, Area.x1, Area.y1, Area.x2, Area.y2) or FindBitmapIn(SevenRed, x, y, Area.x1, Area.y1, Area.x2, Area.y2) then
Result := 7
else
Result := 3;
if (Len = 35) then
if FindBitmapIn(NineBlack, x, y, Area.x1, Area.y1, Area.x2, Area.y2) or FindBitmapIn(NineRed, x, y, Area.x1, Area.y1, Area.x2, Area.y2) then
Result := 9
else
Result := 2;
if (Len = 35) or (Len = 26) then
Exit;
For i := 0 to High(CardNum) do
if Len = CardNumCount[i] then
Result := CardNum[i];
end;
function PlayersDealt: integer;
var
i, x, y: integer;
PlayerCardsArray, PA: Array of TPoint;
begin
PlayerCardsArray := [Point(540, 115), Point(602, 143), Point(676, 233), Point(592, 306), Point(176, 305), Point(106, 232), Point(181, 141), Point(243, 115)];
PA := PlayerCardsArray;
For i := 0 to High(PlayerCardsArray) do
if FindColorTolerance(x, y, 7037951, PA[i].x, PA[i].y, PA[i].x+12, PA[i].y+15, 0) then
Result := Result + 1;
if FindColorTolerance(x, y, 16777215, 406, 368, 426, 388, 0) or FindColorTolerance(x, y, 7037951, 423, 341, 440, 356, 0) then //Player 5 sitting here or watching
Result := Result + 1;
if Result > 9 then
Result := -1;
Status('Players = '+IntToStr(Result));
end;
Function CardKind(Area: TBox): String;
var
TPA: TPointArray;
begin
FindColorsTolerance(TPA, 0, Area.x1, Area.y1, Area.x2, Area.y2, 0);
If Length(TPA) = 33 then
Result := 'S';
If Length(TPA) = 16 then
Result := 'C';
if (Result = 'C') or (Result = 'S') then
Exit;
FindColorsTolerance(TPA, 526536, Area.x1, Area.y1, Area.x2, Area.y2, 0);
If Length(TPA) = 58 then
begin
Result := 'D';
Exit;
end;
FindColorsTolerance(TPA, 394952, Area.x1, Area.y1, Area.x2, Area.y2, 0);
If Length(TPA) = 45 then
begin
Result := 'H';
Exit;
end;
end;
Procedure LoadBitmaps;
begin
SevenBlack := BitmapFromString(11, 15, 'beNr7/58YwMTExI4BgI' +
'JxcXHICpgwgJSUFFwBECCb+fHjR2RBTAXz5s0DiqxYsQKrkyDa9fT' +
'03rx5g1VBTEwMUAHQEPK0A+0lqF1fXx+X9t27dwMVTJo0CVeQRkZG' +
'AhV8+fIFlwKg29ACBDNS8CvAAgDNz3CD');
SevenRed := BitmapFromString(11, 15, 'beNr7/58YcEpI6LS4OBoC' +
'Ct7NyEBWACTR0HlNTbgCIEI288/Hj8iCmApeLVkCFHmzdi1WJ0G0X' +
'7a2/v32LVYFd9PSgAqAhpCnHWgvYe02Nri0f9i/H6jgxcyZuIL0Tk' +
'oKUMGfL19wKQC6DS1AMCMFvwIsAADv85aK');
NineBlack := BitmapFromString(11, 15, 'beNqNUTEKxCAQBBtfIJh' +
'CCwW7fCB/sdXCIt9IZZ2UviHPCvELuYEF8Tw4MsXi7Li74/o873Ec' +
'x7IsjDHEUsqg5pyNMaxDjLGp930jo7WutYIiOueQua6LLnjvQUkl4' +
'IxMCIEo9RyGIjPP8/8OrYo8KKWaSh76ttZa9g3O+TD3PE8hBKnbtv' +
'UefjG8AkAtrDa6rmu/ByClNHjoN0nY911KCWmaJmz+7Rd+AEA6Q00' +
'=');
NineRed := BitmapFromString(11, 15, 'beNr7/5948HL+/Gvu7qeEh' +
'IDk6+XL0WSfT5160cAAKAtH9wsL4bK/370DilzQ0fn9/j2I+/79JR' +
'MToMivN28gCu6mpwO5EFmolvfvQYYUFEC4EDPRLAWKXLaywm8CXBf' +
'cDXBZiBuQjb1oaIjsBSA6LS6OZu/7HTvOqahAZJ/19yO7AROg+QII' +
'gHqBToVzH1ZUIIcDEDwoKUFzA3JIQuNi3rzz6upAqfMaGsCQJzYKA' +
'cRtdzI=');
TCardKindArea := [IntToBox(274, 199, 286, 215), IntToBox(328, 199, 340, 215), IntToBox(382, 199, 394, 215), IntToBox(436, 199, 448, 215), IntToBox(490, 199, 502, 215)];
TCardNumArea :=[IntToBox(274, 184, 286, 200), IntToBox(328, 184, 340, 200), IntToBox(382, 184, 394, 200), IntToBox(436, 184, 448, 200), IntToBox(490, 184, 502, 200)];
MyKindArea := [IntToBox(374, 385, 386, 399), IntToBox(389, 391, 401, 403)];
MyNumArea := [IntToBox(374, 370, 386, 385), IntToBox(389, 374, 401, 388)];
end;
Procedure ReadCards;
var
i: integer;
Table: String;
begin
for i := 0 to 4 do
Table := Table+' '+(IntToStr( CardNumber(TCardNumArea[i]) )+CardKind(TCardKindArea[i]));
SetArrayLength(MyCardArr, 2);
for i := 0 to 1 do
begin
MyCardArr[i].Num := CardNumber(MyNumArea[i]);
MyCardArr[i].Kind := CardKind(MyKindArea[i]);
end;
SetArrayLength(TCardArr, 5);
for i := 0 to 4 do
begin
TCardArr[i].Num := CardNumber(TCardNumArea[i]);
TCardArr[i].Kind := CardKind(TCardNumArea[i]);
end;
MyCards := IntToStr(CardNumber(MyNumArea[0]))+CardKind(MyKindArea[0])+' '+IntToStr(CardNumber(MyNumArea[1]))+CardKind(MyKindArea[1]);
SetArrayLength(MyCardArr, 2);
ClearDebug;
Writeln('My Cards: '+MyCards);
Writeln('Table: '+Table);
end;
Begin
LoadBitmaps;
ClearDebug;
ChangeReportWidth(220);
ClearReport;
Status('Waiting to be Dealt...');
ReadCards;
Repeat
If PlayersDealt > 0 then//Player and Card Count
begin
wait(2000);
repeat
CardsDealt := PlayersDealt * 2;
wait(200);
until CardsDealt > 0;
LastDealt := CardsDealt;
ClearReport;
AddToReport(IntToStr(CardsDealt)+' Cards Dealt');
AddToReport(IntToStr(52 - CardsDealt)+ ' in Deck');
Repeat
Wait(1000);
ReadCards;
until (PlayersDealt < 1);
Status('Waiting to be Dealt...');
CardsDealt := 0;
end; //End;
wait(10);
Until(false);
end.