We've split up the commands, scripting and mods, and add ons category! Please be sure you get your thread in the right place.

19

Adding Variables to Command Blocks

2 Comments

Please sign in to leave a comment.

Sorted by oldest
  • 0
    Registered User commented
    Comment actions Permalink

    Variables and data storage are already available in a variety of forms—it's up to you to decide which is the best for the job.

    For numerical formats, scoreboards are the best tool because they support mathematical operations like +, , ×,÷, and modulus (%).

    If you need to store strings, the probably best way is to use Minecraft's built in free store:

    /data merge storage namespace:myarea {MyString:'this is a test string'}

    There are probably other ways to store data too, like by setting blocks in your world, or modifying item data.

  • 2
    Registered User commented
    Comment actions Permalink

    yah but why can't we have specific variables that can be directly put into the place of numbers like  in /tp @p 10 75 variable name to make the player teleport to 10 75 and then to the variables value as the Z value