Finally, variables came into commands! They said commands are not programming language but here's how it goes. If they add inline operation it would be much easier to implement data packs.
This and /random are such great features. Minecraft is going to thrive as a platform for easy game creation instead of an actual game in a couple of years just you wait
I just finished programming a method to do exactly this with TP commands in the current version. AND I’ve been doing work around methods for tons of things solved by the /random command coming. I mean this are SO useful, but fates really spitting on my work here 😭
It is important to know that this also copies the suffix (Unbreakable:1b for example) and that "b" letter will mess up your code. You need to use a command to remove that suffix and convert the value into a string. This happened to me while I was working on combining it with /damage command and had to remove the float suffix.
oh thats neat observation. I always respected letters at the end as it always messes somewhere with item properties, attributes and so on. I often see people don't even use them like "Im gonna set Unbreakeble:0 nbt instead 0b cause it sdoesn't seem to effect anything" but when it comes about var types and how they cannot collide with each other than it as a wack
I mentioned it in the video. If you have the type the destination must use the same type. Otw u need to represent it as a string so u often need to do the conversion manually
How exactly do you remove the suffix? I'm trying to replace an old movement_speed attribute search tree that uses a score scaled by 1000, but I'm not sure how to remove the float ('f') suffix when I convert it into nbt. Do I have to store it as a string and use one of those parser datapacks?
I am so excited about the possibilities this provides! I have wanted function arguments for SO long now, and we seem to finally be getting them! They actually made it easier to translate a scoreboard into a dynamic value then I thought. I thought you would have to stringify the scoreboard first.
The main reason I never got much into command blocks and datapacks are the crazy workarounds necessary for even the most basic things I wanted to do. I always wondered why it was made to be so difficult that even universally useful concepts like variable inputs were passed up on. Glad they're finally improving it so I can finally wrap my brain around it and get into it.
can't wait to see how macro techniques evolve over time! knowing how powerful they are in C++, we should see some interesting discoveries here as well very soon
I'm already using this to finish a datapack I've had in mind for a while. It *technically* would have been possible without macros, but it would have been really annoying and taken longer than just being able to do this. The current plan for this is to have players sign a book and quill containing the game rules at the start. When the book is signed, the datapack can take and store the author's username into the page of a NEW written book given to all players. The pages in this new written book are used for the mechanic of executing commands targeting those specific players, but it should be designed so that you can target a particular player by-username without typing ANY additional commands, and while still restricting the commands which can be run. Basically every player has a page with command links that target them and only them. The villager changes are abysmal, but I'll give them credit- this and the random command are the greatest changes made to datapacks/command functionality since /execute store
I had a datapack where you loose a max heart every time you die but could craft new ones and now I can set the max health way easier! I can't wait to struggle to change it for a few hours and then figure out that a misspelling was the problem!
i didn't realize that you could inject entire commands into the functions. There is probably something fancy you can use that for like randomizing the order of command executions in a function.
hi! thanks for making this very informational video this quickly. any idea on how negatively it impacts performance to recompile functions? (for example, how deep can a binary tree go with its performance still being better than macros?)
I used this in combination with the random command to set a damage range for a custom weapon! Super useful. I have random roll $(min_dmg)..$(max_dmg) The weapon itself has the variable values, then I just run function with entity @s SelectedItem.tag everytime the wepon is triggered (in this case via clicking)
The data that function uses is mixed with the code in the function, this may lead some injection issues (works like SQL injection). luckily normal players don't have permission to run function command by default, otherwise it will cause lots of chaos.
I sent all day on my new datapack project with macros. Unfortunetally, my other project, which is my biggest, uses a lot A LOT of string concatination. Now with macros i can compact that datapack massively, but i did do all that work for nothing :(
Can you show how to copy text from a book to store in a Macro? I have been trying to figure it out but have been having no luck (it does not help that I don't really understand how to store data and use it elsewhere)
I'm trying to make incremental max hp using /attribute; I'm close but I get the error Invalid Argument Type: FLOAT, expected compound; do you know a way to fix this ? I'm using a scoreboard to track the max health of an entity; I remove 1 then store in into a storage, and pass it into a function macro
if it helps, as far as i know, bossbar system is not that flexible when comes to multiplayer at least how i have it, you need to do a custom bossbar for each player, I think cloudwokf have a video about that
No they are macros. Function parameters are something that can be changed after compile time in coding and u can pass by reference meaning the function can often change the input value but macro inputs cannot be changed during a function it is compiled to be what the input is
@@Cl0udWolf Oh, sorry i totally missed the compile time thing, yea then sure. Man I need to watch these vides more times XD commands are starting to get more and more like a modern programming language
Thanks a lot for your video, I don't know how you find that and have you a wiki for seen specific think like how mob spawn function is use in the game... Thanks you in advance for your reply.
@@Cl0udWolf I know this website but I search a better wiki that fandom, for exemple, what is the patern of mob spawn or as carpet, how many time villager take to spawn a irongolem, what is the function of spawning mob for the high 0 to 320 every tick... Because I only find this ressources on youtube videos.
I'm trying to make a stats function that shows your stats in chat, based on a scoreboard. How would I use macros to make them work for several stats/scoreboards?
like i said this is one of those cases where macros are not necessary and are hurtful for new players. you can print scoreboards in teh chat using standard /tellraw commands. look up a minecraft tellraw generator it will have the ability to display scores
Yeah but 99% of ppl that ask me if they can combine strings don’t need to combine strings and just don’t know how nbt formatted text works with “interpret”
Is there a way to make the "variable" a piece of text? I'm trying to make a looping music using the /schedule command but i want to find a way to stop the track without having to add several lines of code.
@@thiagokawano1618 idk what u tried but my comments aren’t a help chat. It’s 100% possible using /data to copy the string to whatever macro variable you want to use.
@@Quogle issue with that would be it probably affects other players nearby, so not super useful in multiplayer. no idea how it works in practice tho so might be talking out my ass
No it is compatible there r other problems with it tho. Only problem current is that A) quite a few commands happening and B) when u use it there is a little flash of frames which show where u are teleported to temporarily in this case the world spawn
Depends on what ur vision for it is. Ppl have been doing jump scares for over a decade. /tp an entity in the players face, given them a map which has a creepy picture, put a pumpkin on head with a custom texture for the overlay, etc
Wait so you’re telling me that my whole teleport to scoreboard values system I created a few months ago was pointless and I could have just used macros
yeah but I was facing chunk loading issues trying to get it to work when I went tens of thousands of blocks away . At least now I dont have to worry about markers and all that. Anyway thank you for teaching me how to use macros because they're very useful!
@@Cl0udWolf inserting, compiling, recompiling, are not terms I use in datapacks, although I understand it's used in more complex programing. Macro term I've only used in regards to key binding. I've barely scratched the surface on using data storage. As much as I want to understand, I'm not seeing the command connections or file structure you do.
Fans: Can we have variables that aren't scoreboard values, equations and logic to do complex calculations, or anything else that resembles a normal programming language? Mojang: Ooh no. Here is a complex feature to add on top of the already nonsensical system. Fans: Thanks... I understand they are trying to make things easier, but why not just add things people are already familiar with? At least this is a step in the right direction, and it will make things just that little bit easier.
My thoughts exactly. Getting into minecraft commands is a pain. Prior programming knowledge doesn't really help you all that much, And once you learn it, You can't really apply those skills anywhere else. If we had something like Scarpet in vanilla, I think that would be a much better system for everyone. Especially when moving too and from more traditional programming languages.