Log in

View Full Version : More Efficient?



omgnomorenames
07-30-2012, 05:47 PM
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
07-30-2012, 05:56 PM
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
07-30-2012, 06:05 PM
Freeze doesn't work with isUpText

Getdropped
07-30-2012, 06:59 PM
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.