It works on it's own, but when more than one instance of the function occurs, the script dies and scar has a seizure.
Sorta broken version:
SCAR Code:
{*******************************************************************************
function RuneAmount(area, runetype: String): Integer;
By: masquerader and modified by Ron and ZephyrsFury
Description: Returns the amount of a certain rune in the specified area.
*******************************************************************************}
function RuneAmount(Area, RuneType: string): Integer;
var
RuneBmp, II: Integer;
RuneNames: TStringArray;
begin
RuneNames := ['air', 'mind', 'water', 'fire', 'earth', 'law', 'nature', 'chaos', 'death', 'body', 'cosmic', 'soul', 'blood'];
if (InStrArrEx(Lowercase(RuneType), RuneNames, II)) then
begin
RuneBmp := srl_GetBitmap(18 + II);
Result := ItemAmount(Area, 'bmp', RuneBmp, [20]);
FreeBitmap(RuneBmp);
end else
srl_Warn('RuneAmount', 'Invalid RuneType: ''' + RuneType + '''', warn_AllVersions);
end;
My sorta fix:
SCAR Code:
{*******************************************************************************
function RuneAmount(area, runetype: String): Integer;
By: masquerader and modified by Ron and ZephyrsFury
Description: Returns the amount of a certain rune in the specified area.
*******************************************************************************}
function RuneAmount(Area, RuneType: string): Integer;
var
RuneBmp, II: Integer;
RuneNames: TStringArray;
begin
srl_FreeBitmaps;
RuneNames := ['air', 'mind', 'water', 'fire', 'earth', 'law', 'nature', 'chaos', 'death', 'body', 'cosmic', 'soul', 'blood'];
if (InStrArrEx(Lowercase(RuneType), RuneNames, II)) then
begin
RuneBmp := srl_GetBitmap(18 + II);
Result := ItemAmount(Area, 'bmp', RuneBmp, [20]);
FreeBitmap(RuneBmp);
srl_FreeBitmaps;
end else
srl_FreeBitmaps;
srl_Warn('RuneAmount', 'Invalid RuneType: ''' + RuneType + '''', warn_AllVersions);
srl_FreeBitmaps;
end;
It's he only thing that works.
0.o