Author Topic: Number of Items in Inv / Number of max items  (Read 2348 times)

Can anyone tell me how to get the number of items a player has in their inventory alongside how to see how many items they can hold?
Thanks

Can't check right now, but I think it's PlayerDatablock.maxItems.

There is also a support add-on for max slots. Like, Sub's code, if you change that other than 5, the support add-on will fix the slot numbers to all the clients that use that certain datablock based on the slot count.

To find out how many items a player has, you could do something like:

for(%i=0;%i<%player.getDatablock().maxTools;%i++)
{
    %tool = %player.tool[%i];
    if(isObject(%tool))
        %tools++;
}
return %tools;
« Last Edit: May 12, 2014, 09:23:20 PM by Advanced Bot »

To find out how many items a player has, you could do something like:

for(%i=0;%i<%player.getDatablock().maxTools;%i++)
{
    %tool = %player.tool[%i];
    if(isObject(%tool))
        %tools++;
}
return %tools;


%player.weaponCount

%player.weaponCount
Never seen that, wouldn't that kind of mess things up?

Never seen that, wouldn't that kind of mess things up?

How would it mess things up? I've seen it used before.

How would it mess things up? I've seen it used before.
We are all learning something new everyday!!1!

%player.weaponCount
I wouldn't suggest using this method, as some add-ons don't add/remove items properly.

%player.weaponCount

This variable is extremely unreliable and is a remnant of the old weapon slot system (including currWeaponSlot). I wouldn't recommend using it, use Advanced Bot's method instead.

I'm assuming that PlayerDatablock.maxItems works because no one has said otherwise. I will use this alongside Advanced Bot's method. Thanks!

I'm assuming that PlayerDatablock.maxItems works because no one has said otherwise. I will use this alongside Advanced Bot's method. Thanks!

It's maxTools, not maxItems.

I'm assuming that PlayerDatablock.maxItems
It can work, but I don't think all datablocks will have it, but maxTools is the actual variable.