SRL Archive - Help

Finding patterns with bitmaps?


danny2010

2011-12-31 01:27:28

I'm writing a script for a facebook game called diamond dash
the aim of the game is simple you find matching pattens click to get score

Not the best description, see for yourself https://apps.facebook.com/diamonddash

I'm using bitmaps to find the items to click which it finds no problem
but there is no pattern where it's clicking and the mouse stays there

there is a grid 10x9, I have saved a copy of each block in its own bitmap file
and have it in the script as a Bitmap

This is the grid:



the patterns can only be either left/right/up or down, each block is 40x39

This is the script i wrote:


http://pastebin.com/LGMC8f4G

Brandon

2011-12-31 01:59:22

So you want it to count the amount of bitmaps.. and the area where it finds the most, click that?

danny2010

2011-12-31 02:16:34

Sorry if i sound confusing, I think i have confused myself this is what the patterns should look like for all colors in the grid

Either this way


Or this way


If it finds either one of them it should click any block in the patten

Brandon

2011-12-31 03:18:00

From: danny2010
Sorry if i sound confusing, I think i have confused myself this is what the patterns should look like for all colors in the grid

Either this way


Or this way


If it finds either one of them it should click any block in the patten



This won't group them horizontally or vertically but it's a start.. It actually only points the mouse at it, if it has more than one block in the vicinity:


program new;
{$I SRL/SRL.Scar}
{$I srl/srl/misc/debug.scar}

Procedure FindBlocks(Color: Integer);
var
TPA: TPointArray;
ATPA: T2DPointArray;
X, Y: Integer;
begin
FindColorsTolerance(TPA, Color, 282, 210, 755, 625, 0); //Color + Size of the Box it's found in..
ATPA:= SplitTPA(TPA, 30); //Blocks of Size 30.. Just a pick colour in the middle of the blocks..
SortATPASize(ATPA, True);
MiddleTPAEx(ATPA[0], X, Y);
MMouse(X, Y, 0, 0);
end;


var
Red, Blue, Yellow, Violet, Green: Integer;
begin
Red:= 7629055;
Blue:= 16420864;
Yellow:= 517885;
Violet:= 16468919;
Green:= 10420130; //Note all colours picked are from the picture you uploaded.

MOUSESPEED:= 5000;
FindBlocks(Yellow);
end.

Oh and you can use FilterPointsLine(…) To make it do horizontal and vertical filters that way it only points if it's found in a line I guess.. Maybe someone else has a better Idea.. We'll see I guess.

danny2010

2011-12-31 03:26:21

Sorry i misread your post

Thanks for that code