Add a new syntax that allows using data, scores, and return values in function macros without requiring the use of the "function ... with ..." command.
Syntax:
$command ${storage <resource_location> <path> [scale]}
$command ${entity <target> <path> [scale]}
$command ${block <xyz> <path> [scale]}
$command ${score <name> <objective> [scale]}
$command ${run <command>}
Even without the "run" syntax, these would save a lot of time, along with making functions more readable and self-contained.
Functions with this type of macro are evaluated line by line. The macro will be evaluated when the line is reached. I'm sure this will have performance costs, but I think the benefits outweigh the costs.
Functions without this type of macro can stay the same, so their performance won't be affected.
Usage example 1:
Currently, some situations require you to use two functions to use function macros:
#> dp:change_name
execute store result storage dp:temp name int 1 run scoreboard players get @s bounty
function dp:change_name_macro with storage dp:temp
#> dp:change_name_macro
$data modify entity @s CustomName set value '{"text":"$(name)","color":"gold"}'
#> dp:change_name
$data modify entity @s CustomName set value '{"text":"${score @s bounty}","color":"gold"}'
$tellraw @a "Your number is: ${run random value 1..10}"
$execute on controller run title @s actionbar "Vehicle health: ${entity @s Health}"
Please sign in to leave a comment.
0 Comments