Anvil¶
Anvil interface.
TRSAnvil¶
Main record to interact with the Anvil interface.
Anvil.GetSlotBoxes¶
function TRSAnvil.GetSlotBoxes(): TBoxArray;
Returns Anvil.SlotBoxes that have “smithable” items.
To see Anvil.SlotBoxes you can run this:
{$I WaspLib/osrs.simba}
begin
ShowOnTarget(Anvil.SlotBoxes);
end.
And it should look something like this:
Anvil.GetSlotBoxes filters out the slots that are unavailable:
{$I WaspLib/osrs.simba}
begin
ShowOnTarget(Anvil.GetSlotBoxes());
end.
One thing you might notice from the rune 2h sword, is that our slot boxes are smaller than the actual click boxes of the slot.
This is on purpose and there’s 2 reasons for it:
Simplifies code because the slot sizes are not always equal, the size used is the smallest one anvil slots can have (limbs and bolts).
From previous click accuracy tests, we concluded humans tend to focus the click towards the center of what they are trying to click, close to a gaussian distribution, so using the whole click box is a little bit pointless.
Anvil.SetupInterface¶
procedure TRSAnvil.SetupInterface;
Initializes Anvil variables.
Note
This is automatically called for you on the Anvil variable.
Anvil.IsOpen¶
function TRSAnvil.IsOpen(): Boolean;
Returns true if the Anvil is open.
Example:
WriteLn Anvil.IsOpen();
Anvil.WaitOpen¶
function TRSAnvil.WaitOpen(time: Integer; interval: Integer = -1): Boolean;
Returns true if the Anvil is open within time milliseconds.
Example:¶
WriteLn Anvil.WaitOpen();
Anvil.SetQuantity¶
function TRSAnvil.SetQuantity(value: Integer): Boolean;
Attempts to enable the quantity button for the given value.
This is probably more complex than most people would think it is because buttons are not always visible depending on the amount of metal bars your have in your Inventory.
Example:¶
WriteLn Anvil.SetQuantity(QUANTITY_ALL);
Anvil.CanSmith¶
function TRSAnvil.CanSmith(item: TRSItem): Boolean;
Checks if the specified item is currently available to smith.
Example:¶
WriteLn Anvil.CanSmith('Rune 2h sword');
Anvil.Smith¶
function TRSAnvil.Smith(item: TRSItem; quantity: Integer = QUANTITY_ALL; keyboardProbability: Single = -1): Boolean;
Attempts to smith the specified item with the specified quantity.
Example:¶
WriteLn Anvil.Smith('Rune 2h sword');
Anvil.Hover¶
function TRSAnvil.Hover(walk: Boolean = True): Boolean;
Hovers the closest anvil that WaspLib is aware of.
This assumes that Map is being used and setup. It’s possible to use this with other systems but you need to configure it all manually.
It will always hover the closest anvil TRSObject on your loaded map.
If you are too far, it will attempt to walk closer to it by default unless you
set the walk parameter to False.
Anvil.Open¶
function TRSAnvil.Open(constref obj: TRSObject; walk: Boolean = True): Boolean;
function TRSAnvil.Open(walk: Boolean = True): Boolean;
Opens the anvil for you. This assumes that Map is being used and is set up.
It’s possible to use this with other systems but you need to configure it all manually.
It will always use the closest anvil RSObject WaspLib is aware of on your loaded map.
If you are too far, it will attempt to walk closer to it by default unless you
set the walk parameter to False.
Example:
{$I WaspLib/osrs.simba}
begin
Map.Setup([ERSChunk.VARROCK]);
Anvil.Open();
end.
Anvil variable¶
Global TRSAnvil variable.