Variables don't exist in Minecraft commands; scoreboards are as close as we've got. What I'm suggesting is the ability to put in variables as a replacement for a value in a command. This could work by taking the score the player it's executed as and used when put inside of two % symbols. Maybe I have a score constantly being incremented by .01 until getting to 360 in which it resets, and I want to use this output to rotate an Armour stand. So, I put this:
execute as @e[tag=example-entity,limit=1] data merge entity @s {Rotation:[%example-score%f, 0.0f]}
in a repeating command block and set it to always active. This would make the Armour stand begin to spin, which is the best solution to the theoretical problem, at least in command blocks. Outside of the data command, this could be used in:
- Tellraw & Title Commands. (Example: tellraw @p {"text":"You got %score% points!","color":"red"} )
- Give Commands. (Example: give @s oak_boat %amount% )
- Setblock or Fill Commands. (Example: setblock %x% 0 %z% )
- Execute Commands. (Example: execute if block %x% %y% %z% dirt run say "I'm an example!" )
- Summon Commands. (Example: summon skeleton ~ ~ ~ {Rotation:[%r%f, 0.0f]} )
And the list goes on. This would be incredibly useful for command block users and make so many projects become significantly easier to design. With that said, I do think there should be limits for this. You should not be able to use it for assigning things. For example, you should not be able to make a tag named a score. That's all!
Please sign in to leave a comment.
0 Comments