This give me no errors, my economy script can be added, subtracted, etc. So my economy is parsed correctly but these functions don't do anything. I can pull up the GUI with lore but nothing in it works. Running 2.2 fixes v8b
code_language.skript:
function purchaseItem(p: Player, cost: integer, i: item):
if {bean.money.%{_p}%} >= {_cost}:
remove {_cost} parsed as integer from {bean.money.%{_p}%}
give {_item} parsed as item to {_p}
else:
broadcast "{@p}You cannot afford this item!"
function sellItem(p: Player, earn: integer, i: item):
if {_p} has {_item}:
remove {_item} from {_p}'s inventory
add {_earn} to {bean.money.%{_p}%}
on rightclick on villager:
cancel event
if name of player's target entity contains "&aBlacksmith":
wait 1 tick
open virtual chest inventory with size 6 named "&aShop" to player
wait 1 tick
set {_diamondHelm} to diamond helmet
set line 1 of lore of {_diamondHelm} to "&eLeft click to &aBuy 1"
set line 2 of lore of {_diamondHelm} to "&eCosts &f$2500"
set line 3 of lore of {_diamondHelm} to "&cRight click &aSell 1"
set line 4 of lore of {_diamondHelm} to "&eEarns &f$1250"
format gui slot 0 of player with {_diamondHelm} to run function purchaseItem(player, 2500, diamond helmet) with "left" click
format gui slot 0 of player with {_diamondHelm} to run function sellItem(player, 1250, diamond helmet) with "right" click