#(yriokiri) Creating custom inventory for upgrading custom items.

416 messages ยท Page 1 of 1 (latest)

vapid ether
#

as the title say i wanted to create a custom inventory to let players upgrade custom items.

the functions would be : player put item in specific slot. then put materials in specific slots. player click upgrade button. then mats get consumed and item upgraded (statistics like durability, critical powe ecc...) so nbt data modification.

i kinda figured out how to create a custom inventory. but the rest is a bit unclear. any tips or links that could help me understand better what i need to do to create this?

floral valleyBOT
#

(yriokiri) Creating custom inventory for upgrading custom items.

floral valleyBOT
#

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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

proud stone
#

When you say custom inventory, do you mean any of the existing inventories, i.e. Smithing table, Furnace, Blast Furnace; or do you want a chest inventory with any number of slots (at least a multiple of 9), that players will put items into?

For the former, you can use item type containers, and specify their recipes, i.e. smelting gravel into an egg.

upbeat wren
#

!guide inventory gui

vapid ether
#

i mean a chest so custom buttons ecc... as i sain i figured out the process of creation of it but i don't get how to do the rest.

upbeat wren
#

read the guide page, it explains how to do that

vapid ether
#

so if i understand correctly. i sould create an inventory but with the option GUI:false so i can place items. then make manually the gui modification protection system so players can't move the buttons. correct?

#

or is there a way to maintain the gui: true and uncancel the protection for only certain slots?

#

sorry for all the questions but i'm completly new to denizen usage ๐ŸŸ

dense kettleBOT
vapid ether
upbeat wren
#

!e clicks in inventory

upper dawnBOT
# upbeat wren !e clicks in inventory
Group

Player

Event Lines

player (<click_type>) clicks (<item>) in <inventory>

Switches

with:<item> to only process the event if a specified cursor item was used.
in_area:<area> replaces the default 'in:<area>' for this event.
action:<action> to only process the event if a specified action occurred.
slot:<slot> to only process the event if a specified slot or slot_type was clicked. For slot input options, see !language Slot Inputs.

Triggers

when a player clicks in an inventory. Note that you likely will also want to listen to !event player drags in inventory.

Has Player

Always. - this adds switches flagged:<flag name> + permission:<node>, in addition to the <player> link.

Context

<context.item> returns the ItemTag the player has clicked on.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.cursor_item> returns the item the Player is clicking with.
<context.click> returns an ElementTag with the name of the click type. Click type list: <@link url...
<context.slot_type> returns an ElementTag with the name of the slot type that was clicked. Slot ty...
<context.slot> returns an ElementTag with the number of the slot that was clicked.
<context.raw_slot> returns an ElementTag with the raw number of the slot that was clicked.
<context.is_shift_click> returns true if 'shift' was used while clicking.
<context.action> returns the inventory_action. See <@link language Inventory Actions>.
... and 1 more.

Determine

ItemTag to set the current item for the event.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

upbeat wren
#

its this one

vapid ether
#

oh it's the one i was already using but can't figure how to make it work

uncancel_inventory_world: type: world debug: false events: on player clicks in Upgrader_GUI bukkit_priority:HIGHEST: - if <context.slot> == 21: - determine cancelled:false

tried that but the item can't be placed in the slot. it return on the mouse.

upbeat wren
#

you can do on player clicks in Upgrader_GUI slot:21

hybrid niche
#

(still yriokiri but differenti account)

crude terrace
#

huh why do you need an alt

upper dawnBOT
crude terrace
#

can you show full script

crude terrace
#

:false is also not neccessary

native shale
upbeat wren
vapid ether
vapid ether
#

correction . it works for both.

#

but i still can't place the items in the custom gui

native shale
#

Other then that, that seems to be slot 25 for me, should make sure 21 is actually the correct slot

#

And also, you probably want a check to make sure the click was in the custom GUI and not your inventory, can do that by comparing <context.clicked_inventory> and <context.inventory>

#

(I.e. whether the inventory you clicked in is the top inventory)

hybrid niche
#

It Is correct, i added a chat message and that work

#

The slot

#

Thx later Will try what you said upvote_green

vapid ether
#

oops sorry forgot to disable ping

vapid ether
vapid ether
#

i tried this since the script say that - determine ignorecancelled:true is wrong.

uncancel_inventory_world: type: world debug: true events: on player clicks in Upgrader_GUI slot:21 ignorecancelled:true: - if <context.clicked_inventory> == <context.inventory>: - announce "the click do things - click"

#

but still not doing what i wanted to do

#

maybe i'm not understanding where to use the ignorecancelled:true ?

vapid ether
#

since i had problem uncancelling the actions i tried this and it seems to work

#

i putted gui = false and made the click protection from 0

#

did i miss some sort of protection? i cancelled shift-click, drag and click

vapid ether
#

how do i check if i have a certain item in the container slot? ex. i click slot 25 to trigger the action, i want to check if in slot 21 there is coal.

hearty depot
#

!t inventory.slot

upper dawnBOT
hybrid niche
hearty depot
#

!guide tags

upper dawnBOT
# hearty depot !guide tags
Cannot Specify Searched GuidePage

Multiple possible guidepages: Your First Tags, Blurring The Line Between Commands And Tags: Procedure Scripts.

hearty depot
#

!guide first tags

upper dawnBOT
hearty depot
#

works similarly to all other tags

vapid ether
# hearty depot works similarly to all other tags

ok i think i understand now. another thing

- if <context.clicked_inventory> == <context.inventory> && <context.slot> != 21: - announce "click cancelled" - determine cancelled

how can i make here that i can specify multiple ignored slot ? i tried

- if <context.clicked_inventory> == <context.inventory> && <context.slot> != 21 || !=25: - announce "click cancelled" - determine cancelled

or

- if <context.clicked_inventory> == <context.inventory> && <context.slot> != 21 || <context.slot> !=25: - announce "click cancelled" - determine cancelled

but it won't work

#

full script

hearty depot
#

mixing || and && in the same statement will likely not do what you want
you need to use () to seperate out the different sections
ie if a && ( b || c ) or if ( a && b ) || c are 2 different things

the 2nd one you put there is closer but you missed a space
all opperator bits need to be surrounded by a space

upbeat wren
opal heart
#

(can also escape them if you don't like the code block)

native shale
opal heart
#

||this||

hearty depot
#

<.< yes i fix already..

vapid ether
# hearty depot mixing \|\| and && in the same statement will likely not do what you want you ne...

ok so, following what you told me i tried this


       on player clicks in Upgrader_GUI:
       - if <context.clicked_inventory> == <context.inventory> && ( <context.slot> != 21 || <context.slot> != 25 ):
           - announce "click cancelled"
           - determine cancelled

or even this

        on player clicks in Upgrader_GUI:
        - if <context.clicked_inventory> == <context.inventory> && ( <context.slot> != 21 || != 25 ):
            - announce "click cancelled"
            - determine cancelled

but with little success.

#

is there a way to compare a condition with an array of values? so something like this? if <context.slot> != <array of slots>

#

because i need to have multiple input slots in the gui

upper dawnBOT
# crude terrace !object list

A ListTag is a list of any data. It can hold any number of objects in any order.
The objects can be of any Denizen object type, including another list.

List indices start at 1 (so, the tag 'get[1]' gets the very first entry)
and extend to however many entries the list has (so, if a list has 15 entries, the tag 'get[15]' gets the very last entry).

Inputs that accept list indices will generally accept 'first' to mean '1', 'last' to mean the last entry in the list,
or negative numbers to automati...

Prefix

li

Base Type

ElementTag

Format

The identity format for ListTags is each item, one after the other, in order, separated by a pipe '|' symbol.
For example, for a list of 'taco', 'potatoes', and 'cheese', it would be 'li@taco|potatoes|cheese|'
A list with zero items in it is simply 'li@',
and a list with one item is just the one item and a pipe on the end.

If the pipe symbol "|" appears in a list entry, it will be replaced by "&pipe",
similarly if an ampersand "&" appears in a list entry, it will be replaced by "&amp".
This is a subset of Denizen standard escaping, see !language Escaping System.

crude terrace
#

and compare it against that

vapid ether
#

ok now i'm confused

#

why this work

#

on player clicks in Upgrader_GUI:
- if <context.slot> == 21 or <context.slot> == 22 or <context.slot> == 23:
- announce "click cancelled"
- determine cancelled

#

but this not

crude terrace
#

not or

#

||

#

!l operators

upper dawnBOT
#
Possible Confusion

Did you mean to search for operator?

upper dawnBOT
# crude terrace !l operators

An operator is a tool for comparing values, used by commands like !command if, !command while, !command waituntil, ... and tags like !tag ObjectTag.is.than

Available Operators include:
"Equals" is written as "==" or "equals".
"Does not equal" is written as "!=".
"Is more than" is written as ">" or "more".
"Is less than" is written as "<" or "less".
"Is more than or equal to" is written as ">=" or "or_more".
"Is less than or equal to" is written as "<=" or "or_less".
"does this list or map contain" is written as "contains". For example, "- if a|b|c contains b:" or "- if [a=1;b=2] contains b:"
"is this in the list or map" is written as "in". For example, "- if b in a|b|c:", or "- if [a=1;b=2] contains b:"
"does this object or text match an advanced matcher" is wr...

Group

Comparables

crude terrace
#

uhh

vapid ether
#

wait i haven finished lul

crude terrace
#

wromg one?

#

oh

vapid ether
#

senjt it for error lul

crude terrace
#

it would be if condition == something || condition == another thing

vapid ether
#

this work

on player clicks in Upgrader_GUI:
- if <context.slot> == 21 or <context.slot> == 22 or <context.slot> == 23:
- announce "click cancelled"
- determine cancelled

but not this

on player clicks in Upgrader_GUI:
- if <context.slot> != 21 or <context.slot> != 22 or <context.slot> != 23:
- announce "click cancelled"
- determine cancelled

crude terrace
#

wha

crude terrace
#

!debug

upper dawnBOT
# crude terrace !debug
Info: 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!

crude terrace
#

!haste

upper dawnBOT
vapid ether
#

when i click slot 21

#

that sould not be cancelled using the second one

vapid ether
#

made it working doing this

#
        on player clicks in Upgrader_GUI:
        - if <context.clicked_inventory> == <context.inventory>:
            - if <context.slot> == 21 or <context.slot> == 22 or <context.slot> == 23:
                - announce "click correct slot"
            - else:
                - if <context.slot> == 25:
                    - narrate "<&[base]>upgrade button clicked! - <context.inventory.slot[21]>"
                    - determine cancelled
                - else:
                    - narrate "click cancelled"
                    - determine cancelled
#

added a secondary if

#

there is a better way to do it? surely but it works at least

urban musk
#

I will read through what you're trying to do and take a crack for fun though

vapid ether
#

for now i'm jsut trying to make a functioning gui lul

urban musk
#

Do you wanna give me the mission brief? Don't tell me how any of it works code wise, just what you're trying to have happen

vapid ether
#

at the start i was trying using GUI= true but couldn't figure out how to un-cancel the actions

#

i'm planning to make an upgrader for custom items

#

that uses resources to upgrade stats

dense kettleBOT
vapid ether
#

i don't like how the base plugin i use handle it and i want to make my own

urban musk
#

You don't need to un-cancel, you need to tell the game what to do when they do click something in a gui inventory. If what the player clicked on doesn't have any other possible action and gui: true, it just auto determine cancelled

#

so let's say I have a menu item at slot 2 in a gui menu

#

i just write a world script and throw this in as an event:

on player clicks menu_item in gui_menu:
- run my_script def.player:<player>
on player clicks close_menu_item in gui_menu:
- inventory close
#

Next i'll cover how you get items sorted, I just read you're having trouble with that

#

Because we're not creating a single inventory that acts as a menu, we're providing instructions on how to create an inventory menu each time it's opened

#

we can provide the contents via script, instead of adding them in game like you were describing

#

this is an item script. like an inventory script, it's instructions on how to create this item, not an actual item itself.

menu_item:
    type: item
    material: lever
    display name: <&e>Example Menu!
    lore:
    - <&8>
    - <&a>Click to open the Example Menu!
#

and then the inventory itself in it's simplest form can just take the item above like so

GUI_menu:
    type: inventory
    inventory: hopper
    gui: true
    size: 5
    slots:
    - [] [] [menu_item] [] [close_menu_item]
#

now, when you have the player open this inventory through whatever means you're using, clicking on the items inside the menu now have events that run scripted tasks, but clicking on anything else does nothing

hybrid niche
#

Thx for the info, later When i come home Will look into that

urban musk
#

๐Ÿ‘‰

vapid ether
# urban musk ๐Ÿ‘‰

so from what i understood i need to write a script that take the items that the player clicked on the slot and then add them there?

#

to be able to do what i want using gui=true

#

correct?

wary lodge
#

Please post a debug record.

#

!debug

upper dawnBOT
# wary lodge !debug
Info: 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!

vapid ether
#

will post one later when i can go back to it

wary lodge
#

I just tested your script and it worked fine. Heh

vapid ether
#

you can palce items in the gui?

#

then could it be a plugin that is interfering with denizen gui option?

wary lodge
vapid ether
#

nono

#

i need to place items in the gui

#

at the end of the day it does the same thing sooo

#

now i need to do all the item upgrade logic pikasurprise

#

and since i'm here i would like to ask for advice.

i have a lot of different items with different stats. how can i make that only certain stats of an item get upgraded.? for example this

wary lodge
vapid ether
#

for example i want that only attack, and physical damage get upgraded by a certain margin. but on the other had i have another item that has totally different stats

wary lodge
#

within the script

#

That's probably easier for you doing in that way ^, so you don't need all the logic shite.

vapid ether
#

to get stats if i'm not wrong i need to manipulate certain nbt data of the item

#

will surely try later thx

wary lodge
vapid ether
#

it's mmoitems

wary lodge
#

:(

vapid ether
#

don't judge me pls

#

i know

#

but i'm too lazy to make all of them from scratch in denizen

#

and don't have too much time

wary lodge
#

I don't judge, just sad because it complicates everything and makes it harder. :(

vapid ether
#

the other reason i use that is because of mmocore and all the magic system i have linked wih it

wary lodge
#

Hold an item in your hand and run /ex narrate <player.item_in_hand.raw_nbt>

vapid ether
#

let me get to pc where i have mc

#

sec

wary lodge
#

!debug

upper dawnBOT
# wary lodge !debug
Info: 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!

wary lodge
#

Also start the debug recorder before doing that

#

So you can share the outcome

vapid ether
wary lodge
#

Could you

native shale
#

That's not a deubg

wary lodge
#

Please use the debug command

native shale
# upper dawn

^ Please follow the instructions in the info message

vapid ether
#

oh wati sorry lul

wary lodge
#

That's better. As you can see it returns a Denizen map of your data you attached on the mmoitem. A denizen map is similar to a dictionary in other programming languages.

#

If you want to modify that data you have to use

#

!m item.raw_nbt

upper dawnBOT
# wary lodge !m item.raw_nbt

Sets the given map of raw NBT keys onto this item.
Note that the input format must be strictly perfect.
Refer to !language Raw NBT Encoding for explanation of the input format.

Object

ItemTag

Input

MapTag

Tags

<ItemTag.raw_nbt> Returns a map of all non-default raw NBT on this item. Refer to format details a...
<ItemTag.all_raw_nbt> Returns a map of all raw NBT on this item, including default values. Refer t...

wary lodge
#

To modify the data you'd have to use MapTags.

#

As example;

upper dawnBOT
# wary lodge !t map.with.as

Returns a copy of the map, with the specified key set to the specified value.
Matching keys will be overridden.

Returns

MapTag

Examples
# Narrates a map of '[a=1;b=2;c=3;d=4]'
- narrate <map[a=1;b=2;c=3].with[d].as[4]>
# Demonstrates matching key overriding - narrates a map of '[a=1;b=2;c=4]'
- narrate <map[a=1;b=2;c=3].with[c].as[4]>
wary lodge
#

And that within the inventory adjust command.

#

!c inventory

upper dawnBOT
# wary lodge !c inventory
Group

item

Syntax

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>)

Short Description

Edits the inventory of a player, NPC, or chest.

Description

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...

wary lodge
#

!guide mechanisms

upper dawnBOT
wary lodge
#

Here's the guide page which explains how mechanisms work.

vapid ether
#

thx for the help, now i need to just find a good loginc to follow for this. for example i could use something like this

if <item> has <attack power> upgrade stat
if <item> has <magic power> upgrade stat
ecc...

but i need to think it well since i want to make it a bit complex and not just simple as plain stat augmentation.

#

will update the post after find a good one ๐Ÿ˜„

#

thx for the help ๐Ÿ˜„

vapid ether
#

question, i'm trying to run a script via the - run mechanic.

but it seems i'm missing something. it's like data are not being passed.

https://paste.denizenscript.com/View/105523

#

i run the upgrader_process_logic script at line 13. i pass the <context.inventory> to the new script and then i check the nbt data of the item

#

but it return false and empty when done using the script upgrader_process_logic but true if executed in the script on player clicks in Upgrader_GUI

proud stone
#

Not 100%, but remove the space after def:

#

Otherwise, provide a debug so we can see what's happening.

#

!debug

upper dawnBOT
# proud stone !debug
Info: 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!

vapid ether
#

it seems the tag return null

#

ah found the problem. the definition get saved as [1] when passed in the -run mechanic

#

now another question. the value get output like this: double:0.3

is possible to make it output just the value and not the variable type?

proud stone
#

You can apply the definitions key to your task script, and pre-define what the variable name is going to be.

#

As for the context, it's what-ever it is. What-ever you put in, you get back out. You could change it via ObjectTag.as[type]

upper dawnBOT
# proud stone !t objecttag.as

Returns the object, automatically converted to the named object type.
Type names can be of the long form, like "ListTag", "MapTag", "ElementTag", ... or the short form, like "List", "Map", "Element", ...
Type name input is not case-sensitive, so "List" or "list" are the same.

Returns

ObjectTag

Examples
my_example:
    type: task
    # Some input can be any raw object type, but will be forced to a list using 'as[list]' below
    definitions: some_input
    script:
    - narrate "Input list has size <[some_input].as[list].size>"
proud stone
#

Convert it to an element, or whatever you need.

vapid ether
#

i quite don't understand how to make it work. if i put element it continue to say double:0.3

#

- narrate "physical damage = <[phy_dmg].as[element]>"

proud stone
#

Ok, so, double:0.3 is an element. I can see MMOITEMS_PHYSICAL_DAMAGE=double:0.3 as a key/value for one of the items.

hybrid niche
#

So how can i get only the 0.3?

proud stone
#

Assuming this is how mmoitems configure their items, I don't see a mmoitem set of tags for Denizen. So, I can only offer a quick-and-dirty hack solution in the form of <[phy_dmg].replace[double:].with[]> -- assuming you need 0.3 returned.

Perhaps mmoitems could receive Depenizen integration?

#

I will leave it up to others to validate this as a feature suggestion, though.

hybrid niche
#

K later Will try

vapid ether
#

k thx it works ๐Ÿ˜„

#

now i need to figure out how to modify it using a math expression.

#

tried using .add[N] but i does not like it because it's a string and not a number.

hearty depot
#

there is no difference between elements with numbers and elements without numbers functionally. when you put it in to the tags it figures out if its valid at that point

#

!debug

upper dawnBOT
# hearty depot !debug
Info: 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!

vapid ether
hearty depot
#

you didnt do the replace part sugested above...

vapid ether
#

oh wrong debug sorry will recreate another one

#

i trier in various ways

#

oh i think i misstyped something then now that i wrote if again it works. sorry LUL

#

i assume that to make it work again i need to add the double: back when applying the changes to the item?

native shale
#

Could you

#

!paste

upper dawnBOT
native shale
#

Your current script?

vapid ether
#

yes

#

just for context i need to " upgrade " the stats of items from mmoitems

native shale
#

Alright so, you want to set the item's MMOITEMS_PHYSICAL_DAMAGE NBT to a new value, and the item you want to change is in slot 21, I'd do something like this:

hearty depot
#

(also, as a note you were given the wrong tag for replacing text, it should be simply <[phy_dmg].replace_text[double:]> without the with)

native shale
#
- define NBT <[the_item].raw_nbt>
- if the item doesn't have MMOITEMS_PHYSICAL_DAMAGE:
  - stop
- define new_value <[NBT].get[...].add[...]>
- inventory adjust slot:21 raw_nbt:<[NBT].with[MMOITEMS_PHYSICAL_DAMAGE].as[<[new_value]>]>
#

Note that this is just pseudo code, but something like that should work

native shale
#

!t after

upper dawnBOT
# native shale !t after
Cannot Specify Searched Tag

Multiple possible tags: <ElementTag.after[<element>]>, <TimeTag.is_after[<time>]>, <ElementTag.after_last[<element>]>.

native shale
#

!t ElementTag.after

upper dawnBOT
vapid ether
#

ohh using the after is much better for this case thx

vapid ether
#

tried this but not working it seems? posting debug in a sec

proud stone
vapid ether
#

tried like this

dense kettleBOT
vapid ether
#

but still can't make it work

#

and after adjus ( tried with command for item in my inventory to test) i noticed that the double: disappear completly. how can i combine 2 values and then adjust the nbt_tag?

native shale
#
        - define phy_dmg <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE].after[double:]>
        - define phy_dmg2 <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE]>
        - if <[inv].slot[21].raw_nbt.contains[MMOITEMS_PHYSICAL_DAMAGE]>:

You are defining the NBT data before making sure the item has it

#

And also - inventory adjust <[inv].slot[21]> raw_nbt:<[nbt].with[MMOITEMS_PHYSICAL_DAMAGE].as[double:2.3]>

#

!c inventory u

upper dawnBOT
# native shale !c inventory u
Group

item

Syntax

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>)

Short Description

Edits the inventory of a player, NPC, or chest.

Use to open a chest inventory, at a location.
- inventory open d:<context.location>
Use to open a virtual inventory with a title and some items.
- inventory open d:generic[size=27;title=BestInventory;contents=snowball|stick]
Use to open another player's inventory.
- inventory open d:<[player].inventory>
Use to remove all items from a chest, except any items in the specified list.
- inventory keep d:<context.location.inventory> o:snowball|ItemScript
Use to remove all sticks and stones from the player's inventory.
- inventory exclude origin:stick|stone
Additional Usage Examples

... and 5 more.

native shale
#

See examples there ^

#

And also

#

!g adjust is not for

upper dawnBOT
#
Possible Confusion

Did you mean to search for common mistakes - the adjust command is not for items/materials/etc.?

native shale
#

An explanation on why inventory adjust is needed there ^

native shale
vapid ether
native shale
#

Also, you can define the new value as .after[double:].add, then have the double: prefix when setting it back into the map

vapid ether
#

[inv] is <context.inventory>

native shale
#

slot:<slot> it takes a slot, not an ItemTag, so what you had before as correct

#

And there's also destination:<inventory>

#

To specify which inventory to adjust

vapid ether
#

ahhh sorry had some difficulties understanding the docs

#

now everything works

native shale
#

Yay :D

limber rampartBOT
#

+> YAY!!!

native shale
#

Would you like some general feedback about your script as well?

#

If so, please paste you current script and we'd love to help with some suggestions:

#

!paste

upper dawnBOT
native shale
#

Otherwise -

restive idolBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please type </resolved:1028673926114594866> to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@vapid ether

vapid ether
#

for now no, i first need to clean in up and complete it. but most of the work is done since i now understand how to modify raw_nbt ecc..

#

just need to look how to modify specific lore parts now

native shale
#

Well, cleaning up is always good :p, but whatever you prefer ofc, can always do that later on - are you trying to modify the lore as it displays these stats?

restive idolBOT
#
Changed to Help/Support

Thread is now a Help/Support thread. A helper will check your thread when available.

vapid ether
#

this is the current item lore

#

i need to modify the values of the stats

native shale
#

Well, you can use the lore mechanism

#

!m ItemTag.lore

upper dawnBOT
native shale
#

Ideally MMOItems would have some way to update their items but seems like they only have a command to update the item you're holding

vapid ether
#

yes that's why i need to update them using the lore editing.

native shale
#

Can use that mech ^

vapid ether
#

ytes i'm trying something now

#

i'm encountering a problem. how can i adjust the lore modifying just the part i want? i can modify using the after but how can i apply it back? with the old lore?

native shale
#

It returns a list and each line is an item in the list

#

Just like with the NBT before - define it, modify the line you want to modify, and set it back

vapid ether
#

k will try to figure it out. will give an update after i succed or fail pikasurprise

hybrid niche
#

!m listtag

upper dawnBOT
#
Possible Confusion

Did you mean to search for sitting?

#
Possible Confusion

Did you mean to search for command light?

vapid ether
#

can't figure out how to do it. i just don't understand how lists work tried looking at the docs but nothing. i assume a list is something like an array but how can i edit just an element of that list

sharp coral
#

just remember this, from the guide

#

!tag itemtag.lore

upper dawnBOT
sharp coral
#

Returns
ListTag

#

!tag listta

upper dawnBOT
# sharp coral !tag listta
Cannot Specify Searched Tag

Multiple possible tags: <ListTag.last[(<#>)]>, <ListTag.first[(<#>)]>, <ListTag.filter[<tag>]>, <ListTag.size>, <ListTag.any>, <ListTag.set[...|...].at[<#>]>, <ListTag.get[<#>|...]>, <ListTag.get[<#>].to[<#>]>, <ListTag.find[<element>]>, <ListTag.count[<element>]>, <ListTag.sum>, <ListTag.lowest[(<tag>)]>, <ListTag.sort[<procedure>]>, <ListTag.sub_lists[<#>]>, <ListTag.to_map[(<separator>)]>, <ListTag.is_empty>, <ListTag.insert[...|...].at[<#>]>, <ListTag.remove[<#>|...]>, <ListTag.find_all[<element>]>, <ListTag.highest[(<tag>)]>, ...

sharp coral
#

there are lots of listtag tags available

#

if you want specific lines, get[#].to[#] works to receive another listtag of those lines

#

if you want a specific line as an element, you can just use get[#], or .first, or .last

#

if you're trying to adjust it, you'd just use the inventory adjust

#

!guide adjust command isn

upper dawnBOT
#
Possible Confusion

Did you mean to search for common mistakes - the adjust command is not for items/materials/etc.?

sharp coral
#

this section covers usage on that specifically

vapid ether
#

well i need to modify a certain line but that line is never the same. i just need to find the right tag to do it. the rest if think i already got answered and understood.

sharp coral
#

you probably want to use flags, then

#

it isn't good to read the lines of lore for the use of changing data

#

then you can just apply the lore all at once every time you want to change it after flagging the item's lore lines

#

or lore data, whatever you want to call it

native shale
#

It's an MMOItems item - they're trying to modify the stats MMOItems has in the item's lore

vapid ether
sharp coral
#

if you want to change the actual stats, you'd change the raw_nbt

#

if you want to change the lore, you'd just change the lore
but it's still significantly easier to use flags for lore, if you want to customize it

#

where are you stuck?

vapid ether
# sharp coral where are you stuck?

i already modified the raw_nbt and applied them. i can't figure out how to write the code for the - inventory adjust of the lore.

to modify it i assume is something like this

- define lore <[inv].slot[21].lore>
- define new_lore_value <[lore].after[Physical Damage: ].add[<[new_stat_value]>]>

but to apply it i can't really understand how to write it

sharp coral
#

if i explain how to do this without flags, it's either going to be long and complicated or very messy

#

i'd recommend taking the stats, putting them in flags, and formatting it based on the flags

#

- inventory flag item "stats.Attack Damage:15" that's going to flag the item stats.attack damage, like how you found the attack damage from the stats originally

#

where item is some kind of slot or

#

!command inventory

upper dawnBOT
# sharp coral !command inventory
Group

item

Syntax

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>)

Short Description

Edits the inventory of a player, NPC, or chest.

Description

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...

sharp coral
#

slot of some sort

native shale
#

I'm not sure if it's worth it for stats based on external plugins tbh - if MMOItems edits it's stats you'd have to update it every time either way

sharp coral
#

yeah, im getting a headache trying to format this remotely cleanly either way

native shale
#

Might be better to do the slightly hacky but less prone to break approach of finding the current line, modifying it, and setting the lore back

vapid ether
#

ok so i'v done some progress. i figured out how to edit jsut the index of the list i need. now, i0m having problems putting it back. the inventory adjust is giving me errors

native shale
#

!haste

upper dawnBOT
vapid ether
#

yes i need a sec. i'm, lagging and trying to get the log and the script

vapid ether
#

oh i forgot the " " now it works

#

but it just add another like with that text. hmm i need to find the right tag to first remove it i think

#

oh i was using the wrong tag. i used <ListTag.insert...|...].at[<#>]> instead of <ListTag.set[...|...].at[<#>]>

#

now it seems everything is fine in the stat upgrade part

sharp coral
#

is this resolved, then?

vapid ether
#

well the upgrade part was just a piece of the project. will update if i encounter more problems or i complete it

vapid ether
#

ok new question. i0m trying to modify the lore of the Durability but i have a problem.

#

the lore line is like this

Durability: 300 / 300

i need to change only the last number but the first value is dynamic. it changes since it's the current durability.

sharp coral
#

durability is not a part of the lore; do you mean the lore explicitly separately as a custom durability, or the actual item's durability?

vapid ether
#

it's a custom durability

#

still mmoitems

sharp coral
#

this correlates exactly to the same concept as the lore process as above

#

you're going to give yourself a headache working around MMOitems

vapid ether
#

well, to do that i wrote the lore manually

#

- define new_lore_value <[lore].set[ <&color[f]>ุ <&color[8]>ยป <&color[f]>Physical Damage: <&color[3]><&color[l]>+<[new_stat_value]>%].at[<[lore_loc]>]>

#

this was for before.

#

oh wait i have an idea

#

i could just max it out every upgrade

#

so it's the same value as max value

sharp coral
#

you have the answers you need at this point, unless you're confused on what tags we'd recommend you use

#

this isn't something we can really digress on without just writing it for you

vapid ether
#

nono problem solved. sorry for the trouble but i'm really getting an headache working on this with mmoitems pikasurprise

sharp coral
#

but i'm really getting an headache working on this with mmoitems
as i mentioned heh

#

we'd strongly recommend just... replacing it with Denizen at this point

vapid ether
#

the thing is i need it because i have the entire mmo suite.

#

i use it in combo with mmocore ecc..

sharp coral
#

i also own the entire mmo suite, CMI, and about twelve other premium plugins

#

i only use Denizen, Citizens, Depenizen, and Sentinel now

#

it's a decision to make on your own, but there are better decisions to make regardless of their price - depending on how much effort you're willing to put forward into it

vapid ether
#

it's something i was already thingking about but at this point i think i'm continuing like this we already spent almost 2 years working on this project.

#

but i plan to do a lot more with denizen since it's so handy and versatile

sharp coral
#

do as you wish, yeah

#

just learn to weigh the options and work towards the less stressful methods

vapid ether
#

๐Ÿ‘

vapid ether
#

question, i'm getting an error from a take mechanic but it seems to work.

wary lodge
#

!c take

upper dawnBOT
# wary lodge !c take
Group

item

Syntax

take [xp/iteminhand/cursoritem/bydisplay:<name>/bycover:<title>|<author>/slot:<slot>/flagged:<flag>/item:<matcher>] (quantity:<#>) (from:<inventory>)

Short Description

Takes an item from the player.

Description

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...

wary lodge
#

take item:paper from:<[inv]> slot:21
[xp/iteminhand/cursoritem/bydisplay:<name>/bycover:<title>|<author>/slot:<slot>/flagged:<flag>/item:<matcher>]
its only one of these ^

#

You can't have item and specify slot at the same time

vapid ether
#

thx ๐Ÿ˜„

vapid ether
#

about tags, is there one to work with percentage or i need to make the math expression manually?

#

for example augment a value by 10%

wary lodge
#

make your math manually

#

!t element.mul

upper dawnBOT
vapid ether
#

k thx.

restive idolBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please type </resolved:1028673926114594866> to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@vapid ether

vapid ether
#

will open a new one if more question arise

restive idolBOT
#
Resolved

Thread closed as resolved.