SRL Archive - Research & Development Lounge

Draynor Bank Opener


TViYH

2008-05-17 12:52:48

Idk…Just started really messing with it today. First function I've made along the lines of this. Criticism accepted.


function FindDBank : boolean;
var
DBankCol: array of integer;
x, y, DBankCols, Started, Count: integer;
Result1: boolean;
begin
repeat
MakeCompass('W');
Inc(Count);
until(Count=5);
SetArrayLength(DBankCol, 9);
DBankCol := [4871001, 2049368, 7566199, 5598072, 3421240, 5462111, 2247776, 5461592, 3422267];
MarkTime(Started);
repeat
for DBankCols := 0 to 8 do
if FindColorSpiralTolerance(x, y, DBankCol[DBankCols], MSCX-200, MSCY-200, MSCX+200, MSCY+200, 15) then
Result1 := True;
until(Result1);
MMouse(x, y, 2, 2);
Wait(100);
if IsUpText('ank booth') then
Mouse(x, y, 1, 1, False);
ChooseOption('uickly');
if BankScreen then
Result := True;
WriteLn('Found in: ' + IntToStr(TimeFromMark(Started)) + ' msec.');
end;

Also, tell me what I can improve on.

Usage:

if FindDBank then
Withdraw(1, 1, 5);

Requirements: Be standing in front or very close to one of the bank booths.

ShowerThoughts

2008-05-17 13:02:31

Why you use result1? you could just use result ;) and not bad, for a first time?

TViYH

2008-05-17 13:04:00

I used Result1 because I didn't want the script to stop right after it found the bank color. And, thanks!

This is honestly the first time I've ever used FindColorSpiralTolerance =/.

ShowerThoughts

2008-05-17 13:14:39

Result doesn't make the whole procedure end

TViYH

2008-05-17 13:22:15

Oh. I thought that whenever the function became true that it was exited.

ShowerThoughts

2008-05-17 14:02:00

LOL, that would be an disaster. :p

TViYH

2008-05-17 14:50:38

I know. That's why I put that in there. Lol. I guess I was wrong =/.