SRL Archive - Research & Development Lounge

Check Axe


Naum

2008-06-08 03:36:36

This little function will find what axe you have based on its color, this is flawless and has been tested. Enjoy :)

Function CheckAxe : Boolean;
Var Axe : String;
Begin
MMouseItem(1);
Axe := 'No';
Wait(800+Random(200));

Case GetColor(584, 219) Of

2308684 : Axe := 'Bronze';

5066067 : Axe := 'Iron';

7500411 : Axe := 'Steel';

6242368 : Axe := 'Mithril';

4346690 : Axe := 'Addy';

6642500 : Axe := 'Rune';

end;

Try
Result := True;
WriteLn('Found ' +Axe+ ' Axe');
Exit;

finally
If Axe = 'No' Then
Begin
WriteLn('Please Have An Axe In your Inventory!');
Result := False;
GetApplication.BringToFront;
TerminateScript;
end;

except

end;
end;


Using Text:

Function CheckAxe : Boolean;
Var Axe : String;
Begin
MMouseItem(1);
Axe := 'No';
Wait(800+Random(200));

Begin

If IsUpText('ronze') Then Axe := 'Bronze';

If IsUpText('ron') Then Axe := 'Iron';

If IsUpText('eel') Then Axe := 'Steel';

If IsUpText('ith') Then Axe := 'Mithril';

If IsUpText('ddy') Then Axe := 'Addy';

If IsUpText('une') Then Axe := 'Rune';

end;


Try
Result := True;
WriteLn('Found ' +Axe+ ' Axe');
Exit;

finally
If Axe = 'No' Then
Begin
WriteLn('Please Have An Axe In your Inventory!');
Result := False;
GetApplication.BringToFront;
TerminateScript;
end;

except

end;
end;

W0uter

2008-06-08 04:36:46

Nice script, maby I'll use this if I'm going to write a PowerCutter or something.
A question: Wouldn't it be more usefull if it searches the whole invetory? (it only searches the first slot now I guess..) It wouldn't be hard to make it search the whole inventory I think.
I mean something like this:


var
FoundAxe: Boolean;
x,y: Integer;

begin
repeat
x:= x+ //Something
Y:= y+ //Something

Case GetColor(x, y) Of

2308684 : Axe := 'Bronze';

5066067 : Axe := 'Iron';

7500411 : Axe := 'Steel';

6242368 : Axe := 'Mithril';

4346690 : Axe := 'Addy';

6642500 : Axe := 'Rune';

if (not(Axe='No')) then
FoundAxe:= True;

until(FoundAxe);
end;

I didn't add failsafes in it, like don't let scar search more then 28 times (it keeps searching now, even if there isn't an axe).

Naum

2008-06-08 04:56:00

If it searches the whole Inv then it might find other items ;)

Sc00by22

2008-06-08 05:00:39

Cheers, Going to use this in my first script :)

W0uter

2008-06-08 09:59:54

From: NaumanAkhlaQ
If it searches the whole Inv then it might find other items ;)

Ok, well, then working with DTM's could finish the job..
Let SCAR search for the Axe DTM (with 255 tolerance in the middle) and then look which color is in the middle with FindColor so you know which axe it is.

Bye,
Wouter