SRL Archive - SRL Archives

Function FindTalismanInBank


The Claw

2007-06-21 09:02:59

{*******************************************************************************
function FindTalismanInBank(TalismanName: String; tol: Integer): Boolean;
By: The Claw - base on FindTalismanInInvent by Bebemycat2
Description: Returns true if the specifyed talisman is in bank
air - mind - water - earth - fire - body - cosmic - chaos - nature - law - death
*******************************************************************************}

function FindTalismanInBank(TalismanName: string; tol: Integer): Boolean;
begin
case LowerCase(TalismanName) of
'air':
begin
if (FindBitmapToleranceIn(talis_air, x, y, MSX1, MSY1, MSX2, MSY2, tol))
then
Result := True
else
Result := False
end;
'mind':
begin
if (FindBitmapToleranceIn(talis_mind, x, y, MSX1, MSY1, MSX2, MSY2, tol))
then
Result := True
else
Result := False
end;
'water':
begin
if (FindBitmapToleranceIn(talis_water, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
else
Result := False
end;
'earth':
begin
if (FindBitmapToleranceIn(talis_earth, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
else
Result := False
end;
'fire':
begin
if (FindBitmapToleranceIn(talis_fire, x, y, MSX1, MSY1, MSX2, MSY2, tol))
then
Result := True
else
Result := False
end;
'body':
begin
if (FindBitmapToleranceIn(talis_body, x, y, MSX1, MSY1, MSX2, MSY2, tol))
then
Result := True
else
Result := False
end;
'cosmic':
begin
if (FindBitmapToleranceIn(talis_cosmic, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
else
Result := False
end;
'chaos':
begin
if (FindBitmapToleranceIn(talis_chaos, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
else
Result := False
end;
'nature':
begin
if (FindBitmapToleranceIn(talis_nature, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
else
Result := False
end;
'law':
begin
if (FindBitmapToleranceIn(talis_law, x, y, MSX1, MSY1, MSX2, MSY2, tol))
then
Result := True
else
Result := False
end;
'death':
begin
if (FindBitmapToleranceIn(talis_death, x, y, MSX1, MSY1, MSX2, MSY2,
tol)) then
Result := True
end;
end;
FreeBitmap(talis_air)
FreeBitmap(talis_body)
FreeBitmap(talis_chaos)
FreeBitmap(talis_cosmic)
FreeBitmap(talis_death)
FreeBitmap(talis_earth)
FreeBitmap(talis_fire)
FreeBitmap(talis_law)
FreeBitmap(talis_mind)
FreeBitmap(talis_nature)
FreeBitmap(talis_water)
end;

Based heavily on FindTalismanInInvent by bebemycat. When I was updating my runecrafter, I thought this would be handy so I made a couple of changes and here it is. :p

If you want to use it for whatever reason, remember to LoadSRLTalismanBitmaps before calling this.

Bobarkinator

2007-06-21 09:15:56

Very good for runecrafters

nielsie95

2007-06-21 09:30:32

Nice :)

You could shorten it a bit:



case LowerCase(TalismanName) of
'air' : Bitmap := talis_air;
'water' : Bitmap := talis_water;
end;

Result := FindBitmap(Bitmap, x, y, MSX1, MSY1, MSX2, MSY2, tol);
FreeBitmap(Bitmap);

Bobarkinator

2007-06-21 09:42:22

Then you dont get the joy of scripting :p

The Claw

2007-06-21 10:11:20

oh yup, true that nielsie. man, i suck at making code short lol. :p