SRL Archive - Other Scripts

Help WithBejewled Script.


Xanith

2009-11-30 22:00:32

I've been trying to figure out how to find 2 gems that are right next to each other, but i just cant seem to do it.

Here's the code as of now:

program New;
{.include SRL/SRL.scar}
var
MyTPA : TPointArray;
ATPA : T2DPointArray;
x, y, i, HA, HT : Integer;

const
X1 = 167;
X2 = 350;
Y1 = 32;
Y2 = 486;


procedure findAllYellow; //Finds all yellow gems and moves mouse over them
begin
If FindColorsTolerance(MyTPA, 23697, X1, Y1, X2, Y2, 0) Then
H := High(MyTPA);
for i := 0 to H do
begin
Writeln('(' + IntToStr(MyTPA[i].x)+ ','+ IntToStr(MyTPA[i].y)+')');
GetColor(MyTPA[i].x, MyTPA[i].y);
xx := MyTPA[i].x + 40;
if GetColor(MyTPA[i].x + 40, MyTPA[i].y) = 23697 then
begin
Mouse(xx, MyTPA[i].y, 0, 0, true);
Mouse(MyTPA[i].x, MyTPA[i].y, 0, 0, true);
end else
Writeln('ugh');
end;
end;


procedure findYellowDouble; //Tries to find 2 yellow gems next to eachother
begin
If FindColorsTolerance(MyTPA, 23697, X1, Y1, X2, Y2, 0) Then
ATPA := TPAToATPAEx(MyTPA, 1, 40);
HT := High(MyTPA);
HA := High(ATPA);
for i := 0 to HT do
if length(ATPA) = 2 then
begin
Mouse(MyTPA[i].x, MyTPA[i].y, 0, 0, true);
end else
writeln('damn');
end;




Begin
Setupsrl;
ActivateClient;
FindYellow;
end.



So basically what i want the function to do is, find the two gems highlighted in red then find the same matching gem (If there is one) that can be moved next to the two highlighted gems.

Any Help would be very appreciated. :p

YoHoJo

2009-11-30 22:07:44

Your gonna want to make Tpoint boxes the size of each square. Then do a for to do loop going though each box, and each gem. As you do that you want to search one box over/under/left/right, and if that comes up true, then you want to search over/under/left/right (whivhever one was true the first time) X2 (since the next gem will be TWO boxes away). Sorry no code, that just an idea for making it.

Im pretty sure SRL's inventory.scar should actually help out a lot with all of the box cords/slots ect. (rs inventory is basically a series of squares, so is bejewled).

So once again, sorry no code, just some ideas, but its something! Good Luck

Xanith

2009-11-30 22:16:16

Ok, i think i know what you mean. I'll try it out. Thanks for the help YoHoJo ^.^