PDA

View Full Version : minimap.waitFindSymbol() and minimap.waitFindSymbols()



HKbotz
01-26-2015, 12:23 AM
Made these to aid me in waiting to move to a new location where the loading screen doesn't activate. For example if you're going up and down stairs, the loading screen won't always show up so I use these to look for the new symbols to tell if I'm there or not.

Hope someone else can get some use out of them. :)

example usage:
if (minimap.waitFindSymbol(MM_SYMBOL_BANK, 5000)) then
writeln('We found the bank!');

if (minimap.waitFindSymbols([MM_SYMBOL_TREE, MM_SYMBOL_MINING], 5000)) then
wrieln('We found the mining and tree symbols!');


//By: HKbotz
function TRSMinimap.waitFindSymbol(symbol, waitTime: integer): boolean;
var
p: TPoint;
timer: TTimeMarker;
sym: _TRSSymbol;
begin
result := false;

sym := self._getSymbol(symbol);
timer.start();
repeat
if (self.findSymbol(p, symbol, self.getBounds())) then
begin
print('Found ' + sym.name + ' symbol.');
freeBitmap(sym.bmp);
exit(true);
end;
until (timer.getTime() >= waitTime);
print('Didn''t find ' + sym.name + ' symbol.');
freeBitmap(sym.bmp);
end;

//By: HKbotz
function TRSMinimap.waitFindSymbols(symbols: TIntegerArray; waitTime: integer; findOne: boolean = false): boolean;
var
found: TFoundSymbols;
timer: TTimeMarker;
begin
result := false;

timer.start();
repeat
if (self.findSymbols(symbols, self.getBounds(), found, findOne)) then
begin
print('We found all the symbols we are looking for.');
exit(true);
end;
until (timer.getTime() >= waitTime);
print('We didn''t find the symbols we are looking for.');
end;