So im trying to make a skript. That a GUI will popup. And u can dump ur stuff in. And it will automaticly sell. So i made a start. But im stuck at something. When i put 10 cobblestone to the GUI
so "add "%item%" to {inventory.%player%::*}". The value that will be added to {inventory.%player%::*} is 10 cobble_stone. Im trying to have all values of the blocks in a yml file like: "cobble_stone: 2". But the value that gets added is "10 cobble_stone" So i was wondering. How i can take the 10 away from the cobble_stone. And set the "10" to a local variable. That will loop how much the items has to be sold. And that a local variable is "cobble_stone" that i can read from the yml.
Thanks for reading.
Sorry for the wurst english ever btw o3o
so "add "%item%" to {inventory.%player%::*}". The value that will be added to {inventory.%player%::*} is 10 cobble_stone. Im trying to have all values of the blocks in a yml file like: "cobble_stone: 2". But the value that gets added is "10 cobble_stone" So i was wondering. How i can take the 10 away from the cobble_stone. And set the "10" to a local variable. That will loop how much the items has to be sold. And that a local variable is "cobble_stone" that i can read from the yml.
code_language.skript:
command /sellgui:
trigger:
wait 2 tick
open chest with 6 rows named "Sell GUI" to player
file "plugins/Skript/Files/ItemPrices.yml"'s line 3
on store:
if name of player's current inventory contains "Sell GUI":
add "%item%" to {inventory.%player%::*}
on unstore:
if name of player's current inventory contains "Sell GUI":
loop {inventory.%player%::*}:
set {_item} to loop-value
if {_item} = "%loop-value%":
remove "%item%" from {inventory.%player%::*}
On Inventory Close:
loop {inventory.%player%::*}:
broadcast "%loop-value%"
set {_MoneySell} to single value "%loop-value%" get of "plugins/Skript/Files/ItemPrices.yml"
broadcast "%{_MoneySell}%"
remove loop-value from {inventory.%player%::*}
reset {inventory.%player%::*}
Thanks for reading.
Sorry for the wurst english ever btw o3o