SRL Archive - SRL Archives

Herblore.scar Try 2


Dynamite

2009-07-05 18:48:01

This is my second try, I added another Function :)

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Herblore routines --//
//-----------------------------------------------------------------//
// * procedure SetupHerblore; // * SRL
// * Function VialCheck; // * The Man
// * Function ClickedVialCheck; // * The Man
{*******************************************************************************
procedure SetupHerblore;
By: SRL
Description: Declares Global Bitmaps.
*******************************************************************************}
procedure SetupHerblore;
begin
end;
{*******************************************************************************
procedure VialCheck;
By: The Man
Description: Returns true if there is a vial in the inventory
*******************************************************************************}
Function VialCheck: Boolean;
var
VialDTM, x, y : Integer;
begin
VialDTM := DTMFromString('78DA6314646060506040038C4824906607125' +
'204D4F002091E22D4B0135003720F33013562408293801A512021' +
'40408D349090C6AF0600B0BB0126');

Result := FindDTM(VialDTM, x, y, MIX1, MIY1, MIX2, MIY2);
FreeDTM(VialDTM);
end;
{*******************************************************************************
procedure ClickedVialCheck;
By: The Man
Description: Returns true if the vial is clicked
*******************************************************************************}
Function ClickedVialCheck: Boolean;
var
CVialDTM, x, y : Integer;
begin
CVialDTM := DTMFromString('78DA63E467606090674001FFFFFF07D38C503' +
'E232B909024A0861348F013A1868B801A90194C04D48800090E22' +
'D408105003F293147E3500CC6C18F4');

Result := FindDTM(CVialDTM, x, y, MIX1, MIY1, MIX2, MIY2);
FreeDTM(CVialDTM);
end;
Please post feedback.

T~M

Naike

2009-07-05 18:53:37

I suggest using bitmap.scar instead of making DTMs..

Otherwise good going :)

Dynamite

2009-07-05 19:02:09

Oh yeh, I keep forgetting that bitmaps are faster now.
OK when I get time I will do.
thank you.

T~M

Torrent of Flame

2009-07-05 21:03:02

{*******************************************************************************
procedure CountVials;
By: Torrent of Flame
Description: Returns the number of full and empty vials in your inventory.
*******************************************************************************}
procedure CountVials;
var
empty, full, emptyDTM, fullDTM: integer;
begin
emptyDTM := DTMFromString('78DA63E462606010644001151595609A11CA6' +
'7E401122CA86A5A2B6C51D57061AAD9B63404550D2790E0236017' +
'2B9010435553525286AA46004848A2AAF1F60EC454238CAAC6DCC' +
'206450D00FE550971');
fullDTM := DTMFromString('78DA63E4626060106740014B571C02D38C503' +
'E232F9060415553536081AA06640E1BAA9A6D4B4350D530030931' +
'543575AD1B50D5B003092954350B16EF47552308242451D524A4F' +
'5A3AAE10712C2A86AA213DB51D40000086C0C06');

empty := CountItems('dtm', emptyDTM, []);
full := CountItems('dtm', fullDTM, []);
Writeln('You have '+ IntToStr(empty) +' empty vials and '+ IntToStr(full) +' full vials.');

FreeDTM('emptyDTM');
FreeDTM('fullDTM');
end;

I made that y-day. Surely mine would be more useful? ^_^

Dynamite

2009-07-05 21:08:36

Why would you need to know how many?
You just withdraw how many you need…
And mine checks whether it is clicked, so the script doesnt loop.
And… Dont thread hi-jack. :(

T~M

Torrent of Flame

2009-07-05 21:13:32

Well it works both ways mine. Also what if your script withdraws the wrong type?

And mine gives an output, too. + The script wouldnt loop. If it finds the vials it will move onto the next procedures right?


EDIT: Not trying to thread hijack. Was just posting what I had.

Dynamite

2009-07-06 01:49:41

on scripts i have used before, it misclicks the vial then clicks tje herb and loops around and never gets it.
anyway i was just trying to contribute.

T~M

Coh3n

2009-07-06 05:39:40

From: The Man
anyway i was just trying to contribute.


That's good, you shouldn't get criticized for contributing :)

I think those functions could be pretty useful, nice going. ;) I also think you could expand on them, make them do a little more then see if the Vial is there, maybe Count the vials? Know what I mean?