I'm going bald over a function I'm trying to create, I've seen so many errors along the way but now there's NO ERROR with the code but it's still not working.
What I want to happen:
A player mines deepslate redstone ore and receives money for it unless the player is using a pickaxe with silk touch.
What happens:
Nothing happens. No errors while loading the script.
This code works:
[doublepost=1670970849,1670963669][/doublepost]Solved via Discord: Was using wrong types.
What I want to happen:
A player mines deepslate redstone ore and receives money for it unless the player is using a pickaxe with silk touch.
What happens:
Nothing happens. No errors while loading the script.
Code:
options:
deepslate_redstone: random number between 0.75 and 1.25
function minemoney(p: player, b: block, ore: text, opt: text):
if {_b} is {_ore}:
if {_p}'s tool is enchanted with silk touch:
send action bar "&5 No money due to using &fsilk touch" to {_p}
else:
set {_1} to {_opt}
add {_1} to balance of {_p}
send action bar "&d You got &f$%{_1}% &dfrom mining gold ore." to {_p}
on block break:
minemoney(player, event-block, "deepslate_redstone_ore", "{@deepslate_redstone}")
This code works:
Code:
options:
copper: random number between 0.2 and 0.5
on block break:
if event-block is copper_ore:
if player's tool is enchanted with silk touch:
send action bar "&5 No money due to using &fsilk touch" to player
else:
set {_copper} to {@copper}
add {_copper} to balance of player
send action bar "&d You got &f$%{_copper}% &dfrom mining copper ore." to player