omgnomorenames
2012-07-27 02:16:28
Edited on July/27/12 @ 11:38pm : Works great except on small objects added secondary isUpTextCheck since it sometimes doesn't see objects it ends at.
If any problems arise feel free to message me, and you're are more than free to take, use and edit this script (Just give me a little credit ;) ).
A little function of mine used to find upText while moving the mouse.
A fun little function that utilizes isUpTextMMouse by moving the mouse in a spiral till it finds Text or reaches limit (outside of screen).
Test Script Attempts to find bank
If any problems arise feel free to message me, and you're are more than free to take, use and edit this script (Just give me a little credit ;) ).
A little function of mine used to find upText while moving the mouse.
// isUpTextMMouse moves mouse until Text is found or mouse reaches position x,y
// returns True if Text is found and ends early
// returns False if Text is not found and mouse reaches position x,y
Function isUpTextMMouse (var x, y : Integer; Text : String): Boolean;
var x1,y1,z :Integer;
begin
Result := False;
GetMousePos (x1,y1);
x := x - x1;
y := y - y1;
z := 0;
writeln ('Start');
repeat
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z:= z+1;
if (x < 0) then begin
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
end else if (x > 0) then begin
MoveMouse (x1+z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/x)-Round(Random(2)*Sin(Random(100)*Pi*z/x)));
end else begin
while ((z = y) or (z = (-y))) do
begin
if (isUpText (Text)) then begin
Result := True;
Exit;
end;
if (y<0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1-z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else if (y>0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1+z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else begin
Exit;
end;
z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)))
wait (200);
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
end;
Writeln ('End');
end; A fun little function that utilizes isUpTextMMouse by moving the mouse in a spiral till it finds Text or reaches limit (outside of screen).
// FindUpTextSpiral moves mouse in a spiral till text is found or reaches limit
// Returns True if Text is found
function FindUpTextSpiral (var Text : String):Boolean;
var
x : integer;
y : integer;
z : Integer;
begin
z := 0;
repeat
x := Round(z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
if (isUpTextMMouse(x,y,TexT)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z := z+1;
until (z >= 250)
Result := False;
end;Test Script Attempts to find bank
program new;
{.include SRL/SRL.simba}
var TEXT1 : String;
// 0,50 end 515,387
// isUpTextMMouse moves mouse until Text is found or mouse reaches position x,y
// returns True if Text is found and ends early
// returns False if Text is not found and mouse reaches position x,y
Function isUpTextMMouse (var x, y : Integer; Text : String): Boolean;
var x1,y1,z :Integer;
begin
Result := False;
GetMousePos (x1,y1);
x := x - x1;
y := y - y1;
z := 0;
repeat
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z:= z+1;
if (x < 0) then begin
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
end else if (x > 0) then begin
MoveMouse (x1+z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/x)-Round(Random(2)*Sin(Random(100)*Pi*z/x)));
end else begin
while ((z = y) or (z = (-y))) do
begin
if (isUpText (Text)) then begin
Result := True;
Exit;
end;
if (y<0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1-z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else if (y>0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1+z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else begin
Exit;
end;
z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)))
end;
function FindUpTextSpiral (var Text : String):Boolean;
var
x : integer;
y : integer;
z : Integer;
begin
z := 0;
repeat
x := Round(z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
if (isUpTextMMouse(x,y,TexT)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z := z+1;
until (z >= 250)
Result := False;
end;
begin
SetupSRL;
TEXT1 := 'ank';
wait (1000);
if (FindUpTextSpiral (TEXT1)) then
begin
writeln ('Success');
end;
end.