Simba Code:
program new;
{$i srl/srl/misc/smart.scar}
{$i srl/srl.scar}
{$i srl/srl/misc/PaintSmart.scar}
function tGetAmount(Area: string; Slot: Integer): Integer;
var
textCols: TIntegerArray;
x, y, i: Integer;
b, bounds: TBox;
TPA: TPointArray;
s: String;
begin
case Lowercase(Area) of
'inv': b := InvBox(Slot);
'bank': b := BankIndexToMSBox(Slot);
'deposit box', 'dbox': b := DepositItemBox(Slot);
else
srl_Warn('GetAmount', 'Invalid GetAmount area ', warn_AllVersions);
end;
// If no item is found in the specified slot
if (not FindColor(x, y, SRL_OUTLINE_BLACK, b.x1, b.y1, b.x2, b.y2)) then
begin
srl_Warn('GetAmount', 'Item doesn''t exist in '+Capitalize(Area)+' slot '+IntToStr(Slot)+' ', warn_AllVersions);
Exit;
end;
Inc(Result);
textCols := [65535, 65278, 16777215, 8453888];
SMART_DrawBoxEx(False, b, clRed);
// Loop through all the possible text colors until one is found
for i := 0 to High(textCols) do
if (FindColor(x, y, textCols[i], b.x1, b.y1, b.x2, b.y2)) then
begin
FindColors(TPA, textCols[i], b.x1, b.y1, b.x2, b.y2);
bounds := GetTPABounds(TPA);
bounds := IntToBox(bounds.x1-2, bounds.y1-2, bounds.x2+2, bounds.y2+2);
SMART_DrawBoxEx(False, bounds, clYellow);
s := GetTextAtExWrap(bounds.x1, bounds.y1, bounds.x2, bounds.y2, 0, 1, 1, textCols[i], 0, StatChars);
Result := StrToIntDef(GetNumbers(s), 1);
// If greater than 100k, examine it to get the exact number
if ((i = 2) or (i = 3)) then
begin
MouseBox(b.x1, b.y1, b.x2, b.y2, 2);
if (WaitOption('xamine', 500)) then
Result := StrToInt(GetNumbers(GetChatBoxText(8, clBlack)));
end;
Exit;
end;
end;
var
i: Integer;
begin
Smart_Server := 152;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
ClearDebug;
SmartSetDebug(True);
ActivateClient;
SMART_DrawBoxEx(True, IntToBox(0, 0, 0, 0), clRed); // Clears the canvas
for i := 1 to 15 do
Writeln(IntToStr(tGetAmount('bank', i)));
//Writeln(GetNumbers(GetChatBoxText(8, clBlack)));
end.
Inventory: