#(JustinS) Switching between hotbars and inventories
48 messages · Page 1 of 1 (latest)
(JustinS) Switching between hotbars
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
I cant find anything in the docs about this though
Depends on what exactly you are looking for, but you are prob just better off doing an exact give/take on the slots
!c give
item
give [<item>|...] (quantity:<#>) (unlimit_stack_size) (to:<inventory>) (slot:<slot>) (allowed_slots:<slot-matcher>) (ignore_leftovers)
Gives the player an item or xp.
Gives the linked player items.
Optionally specify a slot to put the items into. If the slot is already filled, the next available slot will be used.
If the inventory is full, the items will be dropped on the ground at the inventory's location.
For player inventories, only the storage contents are valid - to equip armor or an offhand item, use !command equip.
Specifying "unlimit_stack_size" will allow an item to stack up to 64. This is useful for stacking items
with a max stack size that...
!c take
item
take [iteminhand/cursoritem/bydisplay:<name>/bycover:<title>|<author>/slot:<slot>/flagged:<flag>/item:<matcher>] (quantity:<#>) (from:<inventory>)
Takes an item from the player.
Takes items from a player or inventory.
If the player or inventory does not have the item being taken, nothing happens.
Using 'slot:' will take the items from that specific slot.
Using 'flagged:' with a flag name will take items with the specified flag name, see !language flag system.
Using 'iteminhand' will take from the player's held item slot.
Using 'cursoritem' will take from the player's held cursor item (as in, one that's actively being picked up and moved in an inventory scree...
give slot:# take slot:#
Id have to do this for every slot though. I guess I can loop it though
I want to be able to switch between inventories, including the hotbar
So lets say a player is holding a backpack item, I want their entire inventory to switch when it's rightclicked in their hand
They can then move stuff and select stuff and right click the backpack in their hand again to switch back
oh well if you just want to swap entire inventories just use the inventory command
!c inventory
item
inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
Edits the inventory of a player, NPC, or chest.
Use this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.
If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.
Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.
Using "open", "clear", or "update" only require a destination.
"Update" also req...
inventory set d:<player.inventory> o:<someotherinventory>
Im having trouble specifying the correct inventory. Im using a custom one though no matter what I try it wont work.
- inventory set d:<forcepowers_inventory> o:<player.inventory>```
forcepowers_inventory:
type: inventory
inventory: chest
title: <&9><bold>Force Powers
gui: true```
I also tried <inventory[forcepowers_inventory]> and <[forcepowers_inventory]>
air|i@stone|;holder=s@forcepowers_inventory;size=27;title=Force
Powers;uniquifier=9]'
[09:02:25 INFO]: ERROR in script 'forcepower_input_script' in queue 'FORCEPOWER_INPUT_SCRIPT_343_DerekMention' while executing command 'INVENTORY' in file '\scripts\Forcepowers.dsc' on line '36' with player 'JustinS_2006'!
Error Message: Woah! An exception has been called with this command!
[09:02:25 INFO]: Additional Error Info: Internal exception was thrown!
[Error Continued] java.lang.ArrayIndexOutOfBoundsException
[09:02:25 INFO]: +> [CommandExecutor] (Attempted: INVENTORY set d:<inventory[forcepowers_inventory]> o:<player.inventory>)```
!debug
If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!
I changed it to - if <player.inventory> == forcepowers_inventory: - inventory set d:<player.inventory> o:forcepowers_inventory - else: - inventory set d:forcepowers_inventory o:<player.inventory>
though I still get the same error
(JustinS) Switching between hotbars and inventories
The player's inventory is an InventoryTag and you're comparing it to text, it'll never be equal
But in this case, if you just want to swap them every time, I think you can just - inventory swap?
!c inventory
item
inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
Edits the inventory of a player, NPC, or chest.
Use this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.
If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.
Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.
Using "open", "clear", or "update" only require a destination.
"Update" also req...
Then what do I compare it with instead?
^ if they should just be swapped every time, don't think you would need to compare them?
The swap command asks for a destination and origin
So if you set the destination to the players inventory and the origin to the other inventory, then it will only switch that way right?
it wont just switch the other way because the destination and origin are the wrong way around
And even with the swap command, how do I specify the other inventory, because Im pretty sure thats what was giving the error
Also this wont give each player their own editable extra inventory right?
Well, no, it's a swap - the items in the 2 inventories will be swapped no matter the order they're specified in
For the other inventory, assuming this is per-player thing, you'd need to make it per-player in some way - I.e. a note with the player's UUID, a flag on the player, etc.
why is this so confusing 😕
So I need to:
- Check if the player has a backpack inventory
- If not, make a new empty backpack and note it to that player
- Swap the players inventory with the backpack inventory, but keep the backpack item in the first slot in the backpack inventory, and keep it in the same slot that it was previously in, in the player inventory
Can anyone please help with this?
I tried doing it ingame instead:
/ex inventory swap origin:<player.inventory> d:forcepowers_inv<player.uuid> this does something. I see some items in my inventory flickering when running this, though nothing changes.
When I reverse it:
/ex inventory swap origin:forcepowers_inv<player.uuid> d:<player.inventory> it says Im missing the origin????
Error Message: Woah! Invalid arguments were specified!
Missing origin argument!
[12:43:26 INFO]: +> [CommandExecutor] Usage: inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
[12:43:26 INFO]: +> [CommandExecutor] (Attempted: INVENTORY swap origin:forcepowers_inv<player.uuid> d:<player.inventory>)```
forcepowers_inv was noted with - note <inventory[forcepowers_inventory]> as:forcepowers_inv<player.uuid>
type: inventory
inventory: chest
title: <&9><bold>Force Powers
gui: false
slots:
- [][][][][][][][][]
- [][][][][][][][][]
- [][][][][][][][][]
- [][][][][][][][][]```
This thread is too chaotic Ill start a new one