SRL Archive - Help

More Efficient?


omgnomorenames

2012-07-30 13:47:50

It's good, but can you make it better?
program new;
var Color,x,y:Integer;
Text:String;
{$i SRL\SRL.simba}
//515, 387
function FindColorisTextUp (Color,x,y:Integer;Text:String): Boolean;
var LocationX,LocationY :Integer;
begin
For LocationX:= 0 to 102 do
begin
For LocationY:= 0 to 42 do
begin
if (FindColorTolerance(x,y,Color,0+(5*LocationX),0+(9*LocationY),5+(5*LocationX),9+(9*LocationY),10)) then
begin
MMouse (x,y,0,0);
wait (100);
if (isUpText (Text)) then
begin
Result := True;
Exit;
end;
end;
end;
end;
end;

begin
setupSRL;
Color := 7434612;
Text := 'ank booth';
if (FindColorisTextUp(Color,x,y,Text)) then begin
writeln ('Success');
end;
end.

masterBB

2012-07-30 13:56:20

function FindColorisTextUp(Color, x, y: Integer; Text: string): Boolean;
var
LocationX, LocationY: Integer;
begin
Freeze;
for LocationX := 0 to 102 do
for LocationY := 0 to 42 do
if (FindColorTolerance(x, y, Color, 0 + (5 * LocationX), 0 + (9 * LocationY), 5 + (5 * LocationX), 9 + (9 * LocationY), 10)) then
begin
MMouse(x, y, 0, 0);
wait(100);
if (isUpText(Text)) then
begin
Result := True;
Exit;
end;
end;
UnFreeze;
end;

But you could better search for all the colors on the screen, store it in a tpa and then split it in boxes.

omgnomorenames

2012-07-30 14:05:49

Freeze doesn't work with isUpText

Getdropped

2012-07-30 14:59:50

From: masterBB
function FindColorisTextUp(Color, x, y: Integer; Text: string): Boolean;
var
LocationX, LocationY: Integer;
begin
Freeze;
for LocationX := 0 to 102 do
for LocationY := 0 to 42 do
if (FindColorTolerance(x, y, Color, 0 + (5 * LocationX), 0 + (9 * LocationY), 5 + (5 * LocationX), 9 + (9 * LocationY), 10)) then
begin
MMouse(x, y, 0, 0);
wait(100);
if (isUpText(Text)) then
begin
Result := True;
Exit;
end;
end;
UnFreeze;
end;

But you could better search for all the colors on the screen, store it in a tpa and then split it in boxes.


unfreeze after you have the if(TPA) (also would make it an else unfreeze and exit) so when you have the mmouse it will be unfrozen and uptext will work. Or you could send the tpa to another function by having it return the tpa and having it mmouse and isuptext in another function.