이해도 | 초보자(스크립트 구성요소나 기본문법은 알아요) |
---|---|
게임버전 (JE) | 관련없음 |
게임버전 (BE) | 관련없음 |
스크립트 버전 | 최신버전 |
on inventory click:
if inventory name of current inventory of player is "{@s}":
cancel event
if raw slot < 36:
if click item is not air:
if click type is left mouse button:
if number of air in the player's inventory >= 1:
set {_lore::*} to lore of click item
set {_money} to uncolored {_lore::2}
replace all "[" and "가격" and "]" and " " and "원" with "" in {_money}
set {_money} to uncolored {_money} parsed as integer
if {money::%player%} >= {_money}:
remove {_money} from {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f원 &e]" with lore "&f%{money::%player%}% &c원"
give 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%" to player
message ""
message "{@s} &f당신은 &e%{_money}% &f원을 사용하여 %{stock::%clicked slot+1%}% &f을 &c구매&f하였습니다."
message ""
stop
else:
message ""
message "{@s} &f당신의 &e인벤토리&f가 비어있는지 &c확인&f해주시기 바랍니다."
message ""
stop
if click type is right mouse button:
if player has 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%":
set {_lore::*} to lore of click item
set {_money} to uncolored {_lore::2}
replace all "[" and "가격" and "]" and " " and "원" with "" in {_money}
set {_money} to uncolored {_money} parsed as integer
remove 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%" from player's inventory
add {_money} to {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f원 &e]" with lore "&cㄴ &f%{money::%player%}% &c원"
message ""
message "{@s} &f당신은 %{stock::%clicked slot+1%}% &f을 &c판매&f하여 &e%{_money}% &f를 얻었습니다."
message ""
stop
오류는 여기서 났다고 떠요
give 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%" to player
message "{@s} &f당신은 &e%{_money}% &f원을 사용하여 %{stock::%clicked slot+1%}% &f을 &c구매&f하였습니다."
if player has 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%":
제 생각에는 %{stock::%clicked slot+1%}% 이게 문제인거 같은데 어떻게 고쳐야될지 모르겠습니다
스크립터브혼
2021.11.18clicked slot 은 아이템입니다. 슬롯 번호는 index of clicked slot 입니다.
장가네안방
2021.11.18n inventory click:
if inventory name of current inventory of player is "{@s}":
cancel event
if raw slot < 36:
if click item is not air:
if click type is left mouse button:
if number of air in the player's inventory >= 1:
set {_lore::*} to lore of click item
set {_money} to uncolored {_lore::2}
replace all "[" and "가격" and "]" and " " and "벨" with "" in {_money}
set {_money} to uncolored {_money} parsed as integer
if {money::%player%} >= {_money}:
remove {_money} from {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f벨 &e]" with lore "&f%{money::%player%}% &c벨"
set {_slot} to index of clicked slot
set {_slot} to {_slot} parsed as number
set {_slot} to {_slot} + 1
give 1 of {stockitem::%{_slot}%} named "%{stock::%{_slot}%}%" to player
message ""
message "{@s} &f당신은 &e%{_money}% &f벨을 사용하여 %{stock::%{_slot}%}% &f을 &c구매&f하였습니다."
message ""
stop
else:
message ""
message "{@s} &f당신의 &e인벤토리&f가 비어있는지 &c확인&f해주시기 바랍니다."
message ""
stop
if click type is right mouse button:
if player has 1 of {stockitem::%{_slot}%}:
set {_lore::*} to lore of click item
set {_money} to uncolored {_lore::2}
replace all "[" and "가격" and "]" and " " and "벨" with "" in {_money}
set {_money} to uncolored {_money} parsed as integer
remove 1 of {stockitem::%{_slot}%} named "%{stock::%{_slot}%}%" from player's inventory
add {_money} to {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f벨 &e]" with lore "&cㄴ &f%{money::%player%}% &c벨"
message ""
message "{@s} &f당신은 %{stock::%{_slot}%}% &f을 &c판매&f하여 &e%{_money}% &f를 얻었습니다."
message ""
stop
장가네안방
2021.11.18이렇게 수정하였는데도 구매와 판매가 안됩니다
스크립터브혼
2021.11.20들여쓰기 맞춰주세요
https://www.koreaminecraft.net/review/2149827