이해도 | 초보자 |
---|---|
게임버전 (JE) | 1.20.1 |
게임버전 (BE) | 관련없음 |
command /상점:
trigger:
open chest with 6 row named "상점" to player
set {_slot} to 0
loop 54 times:
set slot {_slot} of current inventory of player to black stained glass pane
add 1 to {_slot}
set slot 0 of current inventory of player to bread with lore "&c판매가:100원"
on inventory click:
if inventory name is "상점":
cancel event
if click type is left mouse button:
if clicked raw slot is smaller than 54:
set {_lore} to uncolored line 1 of lore of clicked item
replace all "가격" and ":" and " " and "원" with "" in {_lore}
set {_lore} to {_lore} parsed as integer
if {돈::%uuid of player%} is smaller than {_lore}:
send "돈이 부족합니다" to player
else:
set {_item} to clicked item
delete lore of {_item}
if player has enough space for {_item} :
give {_item} to player
subtract {_lore} from {돈::%uuid of player%}
else:
send "인벤토리에 충분한 공간이 없습니다!" to player
이런식으로 적어놨는데 /상점을 입력해서 아이템을 사면 아이템은 사지고 돈은 안빠져 나갑니다 뭐가 문제인가요?
슈퍼레몬
2024.02.03replace 부분에는 가격을 "" 로 바꾸지만 실제 로어에는 판매가가 들어가 있습니다.