#(yyykilla_3) How to format map properly?
51 messages · Page 1 of 1 (latest)
(yyykilla_3) How to format map properly?
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.
the format best to use varies depending on how you want to actually use it in a script, or if you're just testing/one-time running things using /ex as you mentioned
if a command takes a maptag as input, you can just put [dashes=3;something=foobar]
but if you're using flags, you can also just use flag nodes in general
!command inventory usage
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.
- inventory open d:<context.location>
- inventory open d:generic[size=27;title=BestInventory;contents=snowball|stick]
- inventory open d:<[player].inventory>
- inventory keep d:<context.location.inventory> o:snowball|ItemScript
- inventory exclude origin:stick|stone
... and 5 more.
eg, /ex inventory flag slot:hand upm.dashes:3
but if you're using multiple nodes in a script, you can also use this to construct a maptag:
!tag definemap
Did you mean to search for plotsquaredplottag.denied?
queue
definemap [<name>] [<key>:<value> ...]
Creates a MapTag definition with key/value pairs constructed from the input arguments.
Creates a MapTag definition with key/value pairs constructed from the input arguments.
!guide definitions
View the guide page 'Short Term Memory: Definitions' at: https://guide.denizenscript.com/guides/basics/definitions.html
Data script containers are generic script containers for information that will be referenced by other scripts.
No part of a 'data' script container is ever run as commands.
There are no required keys.
Generally, data is read using the !tag ScriptTag.data_key tag.
data_script_name:
type: data
# Your data here
some_key: some value
some_list_key:
- some list value
some_map_key:
some_subkey: some value
Script Container System
or, you can use yaml
or, you can use existing flags
there are various ways to do what you're doing, it's vague without more clear information of what your goal is and what works best for your scripts
this is their internal representation, where are you seeing this?
With mod ComponentViewer, with .flag_map and etc
Its just unreadable
flag_map is only meant for debugging purposes
!t flag_map
!t FlaggableObject.flag_map
Returns a raw map of the objects internal flag data for the flags with the given flag name. Names must be root names (no '.').
Output is a MapTag wherein each key is a flag name, and each value is a MapTag, containing keys '__value' and '__expiration', where '__value' contains the real object value.
Output also may contain key '__clear', which is a ListTag of flags that were listed in input but weren't present in output.
Using this without a parameter to get ALL flags is allowed exclusively for debug/testing reasons, and should never be used in a real script.
See !language flag system.
MapTag
^ see the docs, it's a debugging tool that intentionally returns the internal Denizen format as opposed to the readable script format
!xy
Your question seems to be an XY Problem - you're asking about your attempted solution rather than your original problem.
Read in detail about the XY Problem here: http://xyproblem.info/
For an example of an XY Problem we've seen in Denizen, the question "how do I make an event for when a flag expires" has no answer, but the same question asked with full background detail will be something more like "I have this script: [LINK HERE], which sets a 3 minute cooldown flag on a player for when they use an ability. I want the player to be notified when the cooldown completes - how do I do this?" which we can then answer quite effectively (in this example, all that was needed was a simple wait command, no events or flag-listening or anything).
What are you trying to do that requires getting an object's flag map?
My post is about ugly formatting of said flag map.
Thing is, sometimes it looks like
map@[foo=map@[fofo=barbar]] and sometimes like this unreadable monstrocity
^
^
What are you trying to make that requires this tag?
Tbc, it's like that on purpose - the only real use case for this tag is e.g. debugging tools, where you would want the full internal data with the value, expiry, etc.
Which is why I'm pulling up !xy
reading flag map xd
to debug with readable format*
and to confirm that this is okay to have this format
If you want a readable map for debugging you could
Tag parse results for <map[key=value].to_yaml>: https://paste.denizenscript.com/View/136283
key: value
It's fine to use it for debugging purposes.
Yeah if you want it for debugging that's fine, in which case that format is good as you're getting the actual full flag data (including e.g. expiry durations)
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command 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.)
@paper sequoia
thanks guys, will try!