SRL Archive - SRL Archives

Kind Of Archaic Walking


TOB

2006-12-07 18:44:33

[PHP]procedure DirWalkUntilSymbol(dir, symbol: string; timeoutSec: Integer; clickWhenFound: Boolean);
var
StartDirWalk: Integer;
begin
MakeCompass(Lowercase(dir));
if(not(SymbolExists(symbol))) then
begin
MarkTime(StartDirWalk);
repeat
MakeCompass(Lowercase(dir));
Mouse(645, 35, 10, 8, True);
Writeln('Walking direction ' + dir + ' until ' + symbol + ' symbol is found.');
if(timeoutSec > 0) then
Writeln(' ' + IntToStr(TimeFromMark(StartDirWalk)) + '/' + (IntToStr(timeoutSec * 1000)) + ' milliseconds passed while searching.')
else
Writeln(' No timeout.');
FFlag(20);
if((TimeFromMark(StartDirWalk) > Seconds(timeoutSec)) and (timeoutSec > 0)) then Break;
until(SymbolExists(symbol));
end;
FindSymbol(x, y, symbol);
Mouse(645, y, 10, 8, True);
Flag;
Writeln(symbol + ' symbol found.');
if(clickWhenFound) then
ClickSymbolIfExists(symbol);
end;[/PHP]

Uses:
[PHP]{*******************************************************************************
function SymbolExists(Name: String): Boolean;
By: TOB
Description: Finds if minimap symbol exists by name.
*******************************************************************************}
function SymbolExists(Name: string): Boolean;
var
necessaryx, necessaryy: Integer;
begin
Result:= (GetSymbolColor(necessaryx, necessaryy, Lowercase(Name)) > 0);
end;

{*******************************************************************************
function ClickSymbolIfExists(symbol: string): Boolean;
By: TOB
Description: Clicks if minimap symbol exists by name.
*******************************************************************************}
function ClickSymbolIfExists(symbol: string): Boolean;
var
necessaryx, necessaryy: Integer;
begin
if((GetSymbolColor(necessaryx, necessaryy, Lowercase(symbol)) > 0)) then
Result:= True;
if(Result) then
begin
Mouse(necessaryx, necessaryy, 10, 10, True);
Flag;
PerfectNorth;
end;
end;[/PHP]

Someone could easily edit it to search for color and symbol or just symbol/color in one function but there are much better ways of walking.