View Full Version : Finding patterns with bitmaps?
danny2010
12-31-2011, 06:27 AM
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:
(http://imageshack.us/photo/my-images/688/diamondash.png/)
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
12-31-2011, 06:59 AM
So you want it to count the amount of bitmaps.. and the area where it finds the most, click that?
danny2010
12-31-2011, 07:16 AM
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
http://img43.imageshack.us/img43/2457/purpleacross.png
Or this way
http://img266.imageshack.us/img266/9327/purpledown.png
If it finds either one of them it should click any block in the patten
Brandon
12-31-2011, 08:18 AM
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
http://img43.imageshack.us/img43/2457/purpleacross.png
Or this way
http://img266.imageshack.us/img266/9327/purpledown.png
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
12-31-2011, 08:26 AM
Sorry i misread your post
Thanks for that code
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.