#Using array and objects in macros

1 messages · Page 1 of 1 (latest)

olive novaBOT
#

I want to know if there is a way to access the array and object properties in macros, I tried as in the examples below but it did not work, is there any other way than extracting the value of the array or object and put it in another storage?

data merge storage namespace:main {values:[1, 2, 3],info:{x:1,y:2,x:3}}

function namspace:values with storage namespace:main
function namspace:info with storage namespace:main

values.mcfunction:

$say $(values[0])

info.mcfunction

$say $(info.x)
brisk kernelBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1739627692:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

swift kiln
#

No, that’s not possible

wraith sequoia
#

F

swift kiln
#

The second example is possible if you give info into it

#

You can add a path after the storage

wraith sequoia
swift kiln
#

In the function … with storage my:storage path

#

And if you just add info there, it works for the second example

#

But yeah, you always gotta do it like that first

wraith sequoia
#

I hope they add it in 1.21.5, sometimes even if I put the path, the path has values that are objects and I can't access them directly, but thanks for clarifying the doubt!

swift kiln
#

I doubt they will add anything to the macro system, it is meant as a band aid for stuff we can’t do otherwise

#

At which it is good but it’s nothing more ^^

wraith sequoia
#

of course, there were some things that were just impossible

#

pd: i lov ur datapacks