Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to know the index of a tool in a players inventory?

Asked by
Nonaz_jr 439 Moderation Voter
6 years ago
Edited 6 years ago

I want to find out and/or set the number that a tool is assigned to in inventory.

For example, the first tool is put in slot 1 (with hotkey 1), etc up to slot 10 (with hotkey zero), and the rest goes into the extended backpack with positions 11+.

Dropping a tool does not move other tools into a lower slot, so gaps emerge, where newly aquired tools are then put in. After a while it becomes a mess, and I want to know for a newly aquired tool in which inventory slot it was assigned.

I am assuming this is a local property. Can it be accessed anywhere? Through the official api or by accessing the core gui?

It wont work to keep a mirror inventory that applies the same add/remove rules in order to know, because if players move their tools to a different slot this would not be detected.

Any pro scripter who can give me any info or leads on this? Thanks a lot!!!

1
With "Unequipping a tool", do you mean dropping it? Because normally, when unequipping a tool, it doesn't create a gap, it just stays in your hotbar. optiplex123 21 — 6y
0
Ah thanks, I indeed meant dropping, not unequipping, thanks! I edited it Nonaz_jr 439 — 6y
0
If you make a new backpack system by first disabling the default backpack you can use a list and manipulate the positions that way TheGreatSailor 20 — 6y

Answer this question