SRL Archive - OSR Help

OSr reflection get bank items


rj

2014-06-26 19:21:49

Does the reflection include have a function for getting all items in the bank?

Wetish

2014-06-26 19:34:32

You could probably get them using widgets.

Here is getting the inventory

function R_GetWidget2(Index, ChildIndex: Integer): Integer;
begin
Result := SmartGetFieldArray2DObject(SmartCurrentTarget, 0, client_widgets, Index, ChildIndex);
end;

(*
R_GetInventoryItems2
~~~~~~~~~~~~~~

.. code-block:: pascal

R_GetInventoryItems2: TInventoryItemArray2;

.. note::

by Frement

*)
function R_GetInventoryItems2: TInventoryItemArray2;
var
_Inventory, _InventorySlot, _ItemID, _ItemQuantity: Integer;
begin
_Inventory := R_GetWidget2(149, 0);
SetLength(Result, 28);
for _InventorySlot := 0 to 27 do
begin
_ItemID := SmartGetFieldArrayInt(SmartCurrentTarget, _Inventory, Widget_getItems, _InventorySlot);
if (_ItemID > 0) then
begin
_ItemQuantity := SmartGetFieldArrayInt(SmartCurrentTarget, _Inventory, Widget_getStackSizes, _InventorySlot);
with Result[_InventorySlot] do
begin
ID := _ItemID;
Quantity := _ItemQuantity;
Slot := _InventorySlot + 1;
end;
end;
end;
SmartFreeObject(SmartCurrentTarget, _Inventory);
end;

rj

2014-06-26 19:36:49

How do I know what index to use?

Awkwardsaw

2014-06-26 20:46:20

We really don't have enough hooks to get everything that we need from widgets. As for debugging info, I like to use java bots(tribot, for example)

edit: ineedbot made a pretty decent debugger for simba: https://villavu.com/forum/showthread.php?t=107479&page=13&p=1296483#post1296483

Frement

2014-06-26 20:57:59

From: Awkwardsaw
We really don't have enough hooks to get everything that we need from widgets. As for debugging info, I like to use java bots(tribot, for example)

edit: ineedbot made a pretty decent debugger for simba: https://villavu.com/forum/showthread.php?t=107479&page=13&p=1296483#post1296483


We have enough hooks to get everything we need from widgets, I see you've said this twice now, which hooks are missing then?

rj

2014-06-26 22:39:07

Hooks are outdated ATM, I guess I'll hold off until they are updated until I start on my script, thanks guys

Awkwardsaw

2014-06-26 22:43:37

From: Frement
We have enough hooks to get everything we need from widgets, I see you've said this twice now, which hooks are missing then?


I guess most specifically, I'm looking to get the actual name of the widget, not just the 'text'