#Dynamic Book Creation

1 messages · Page 1 of 1 (latest)

proven crow
#

TLDR question: Can I dynamically make a written book update using commands?

Long winded explanation and random thoughts:

I am making the 3rd iteration of my spell system. I am mulling over different ways to implement the levelling system. In my previous system, I used books to unlock spells and level up the player. The issue with that is that the books were always static and I had to type like 40 of them to make the system work. For this system, I am aiming to make everything way more dynamic and formulaic. So I am wondering if making dynamic custom books is possible before I dig into making it.

The way the player gets the book is through the /trigger help menu. However, before, where I just had a bunch of premade books, I want to have 1 book and maybe I could, instead of using the give command, I summon the book as an item at the player's feet and then in the same function, I could run a BUNCH of data modify commands that basically build the book based off of the player's tags.
This way, if the player has unlocked certain things, I can disable the unlock scripts and color them differently.

The only problem I can see is tracking the inserts in the data modify... I would assume that every page is going to have at least 8 entries on it. So the data modify command cannot interfere with what was previously put in there on the page. Is that possible?

errant dawnBOT
#

<@&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:1722374428: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

#
⚠️ You already have a question open!

Don't forget to close or resolve your old questions once you're done with them. It makes our lives much easier! :D

Open question: #1264942404688019551

humble mirage
#

It's definitely possible

#

I'm not sure exactly the best way to go about it, depending on how the system works

proven crow
#

Give me one second

#

I will provide an example

#

This is a page from thecurrent spell system.

#

Basically, What I'm looking to do is go line by line and verify if the player has the unlock tag for these and change what is typed on that line.

humble mirage
#

Yeah ok

proven crow
#

the book would refresh if it's thrown out or a button is pressed.

humble mirage
#

You'll probably need to use some macros to do string concatenation

#

The only problem I can see with this is detecting where to break the page

proven crow
#

oh shoot macros

#

I have never used them...

humble mirage
humble mirage
proven crow
#

Can you direct me to a guide? 😅
The more tools I have the better the datapack will be!

humble mirage
#

Unfortunately there's no real guide to macros that I know of; the resources for datapacking are somewhat limited (we're working on it!).
You could take a look at the Minecraft wiki page on functions and macros, or if you prefer video format, there this. I haven't watched it myself, but it should be informative.

We cover how to use macros to make dynamic commands!

🔵 Discord & Other Links: https://linktr.ee/CloudWolfMC
💻 Website: https://cloudwolfyt.github.io

▶ Play video
Minecraft Wiki

Functions are data pack files, allowing players to run lists of commands. Being text files, they are easily modifiable and less likely than command blocks to induce lag when used in large quantities.
This page covers how functions are defined and invoked in Java Edition.

proven crow
#

Well it's a really good start, Thank you so much! I'll read up on them!