Minecraft Function Tree Generator

Sometimes, we want to make Minecraft functions dependent on a value, however the game doesn’t let us use it like a variable in selectors. You can’t teleport a player in a direction as many blocks away as their score using just one command, and you can’t easily read which way they’re looking. If you know that the number of possible input values is low enough, you can solve the problem by hardcoding each value with a corresponding command. If someone were to, for example, implement a sine function with an accuracy of one degree, they could calculate the values for it with another program and write down 360 commands. This solution is, unfortunately, very inefficient, since too many commands is being run for no reason. Fortunately, the generator in this article allows for very good optimalisation in such situations.

Function tree generator:

Path: File name prefix: Commands:

How to use:

  1. In the “Path” textfield, provide the location where you want to keep your generated function files. The namespace folder should be separated with a colon (:) and subfolders should be separated with slashes (/). Just like in Minecraft’s /function command.
  2. You can define the prefix that will be used to generate function names in the “Prefix” section. For example if you were to input “abc” then one of the generated functions  could get a name “abc_0_0” (if there are commands for something to happen at zero score).
  3. In the “Commands” section, list all commands that you want to search through. Every command should have a selector with two arguments that both have the same value e.g. @s[rxm=3,rx=3], @s[score_a_min=1,score_a=1] etc.
    • Remember to put the lower limit first inside the selector! @s[rx=3,rxm=3] will generate invalid commands.
    • The generator doesn’t check if your commands are valid.
    • An example list of commands you could paste into the generator:
      execute @s[score_a_min=0,score_a=0] ~ ~ ~ say I have a zero in objective a
      execute @s[score_a_min=1,score_a=1] ~ ~ ~ say I have a one in objective a
      execute @s[score_a_min=2,score_a=2] ~ ~ ~ say I have a two in objective a
      execute @s[score_a_min=5,score_a=5] ~ ~ ~ say I have a five in objective a, and the order doesn't matter
      execute @s[score_a_min=3,score_a=3] ~ ~ ~ say I have a three in objective a
      execute @s[score_a_min=4,score_a=4] ~ ~ ~ say I have a four in objective a
      execute @s[score_a_min=4,score_a=4] ~ ~ ~ say I run two commands when I have a four in objective a
  4. Press “Submit” when you’re ready to download your function tree.
  5. In order to use the function tree in your commands, call the function with the lowest and highest number in its name. That function would be called file_prefix_0_5 after generating for the example list of commands above.

Komentarze do “Minecraft Function Tree Generator” (1)

  1. Chciałbym podziękować SecondLifePL za szybkie i umiejętne umieszczenie tego skryptu na naszej stronie 😀

Leave a Reply

Your email address will not be published. Required fields are marked *