Using macros for repeated code worth it?
---This is not necessarily a direct question but more of a general discussion.---
Is using a macro to replace repeated lines of code worth it? Although this won't always work depending on your scenario, it might clean up or abstract your code further. But I know macros must be recompiled every time, so using a lot of them is not ideal.
For example:
This line of code in my datapack is used very often:
Continue to help postexecute as @a if score @s playerid = $temp payeeid
. This allows you to find a player, if you input a player id into $temp
.
I can use a macro to abstract this:
find_payee
$execute as @a if score @s playerid = $temp_payee_id payeeid run $(action)
set_payee_id
json function justin:find_payee {"action":"scoreboard players set $bool_payee_found payeeid 1"}
"Action" is what will be added on to the end of the macro above.