이해도 | 1.12 |
---|---|
게임버전 (JE) | 모드버킷 |
스크립트 버전 | 기본문법은 알아요) |
스크립트 애드온 | 2.2-dev37 |
물건 등록시 lore 안뜨는 문제랑 판/구매가 안되는 문제가 있는데 어딜 수정해야할지 잘 모르겠어서 질문드립니다.
아래쪽은 구문입니다.
options:
c: &e[ &f범포서버 &e]
on right click on entity:
loop {npcshop.list} times:
add 1 to {_상점}
set {_npc} to uncolored {npcshop::%{_상점}%}
if entity's name contains "%{npcshop::%{_상점}%}%":
run player cmd "/상점 열기 %{npcshop::%{_상점}%}%" as op
command /상점 [<text>] [<text>]:
trigger:
if arg 1 is not set:
message ""
message "{@c} &f/상점 &e열기 &c[&f이름&c] &f- 당신은 &c[&f이름&c] &f(이)라는 상점을 &e오픈&f합니다."
message ""
stop
if arg 1 is "열기":
if arg 2 is set:
loop {npcshop::*}:
if "%loop-value%" is "%arg 2%":
open chest with 6 row named "{@c} &f%arg-2%" to player
set slot 36 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 37 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 38 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 39 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 40 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 41 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 42 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 43 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 44 of current inventory of player to iron bars named "&8[ &f구분선 &8]"
set slot 45 of current inventory of player to sign named "&c[ &f도움말 &c]"
set line 1 of lore of slot 45 of current inventory of player to "&cㄴ &f좌클릭 시 &e구매&f합니다."
set line 2 of lore of slot 45 of current inventory of player to "&cㄴ &f우클릭 시 &e판매&f합니다."
set line 3 of lore of slot 45 of current inventory of player to "&cㄴ &f쉬프트+좌클릭 시 &c한세트&f를 &e구매&f합니다."
set line 4 of lore of slot 45 of current inventory of player to "&cㄴ &f쉬프트+우클릭 시 &c아이템 &f전부를 &e판매&f합니다."
set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]"
set line 1 of lore of slot 53 of current inventory of player to "&cㄴ &f%{money::%player%}% &c원"
loop {npcshop.%arg-2%} times:
add 1 to {_슬롯}
add 1 to {_상점아이템}
set slot {_슬롯}-1 of current inventory of player to {npcshop.%arg-2%::%{_상점아이템}%}
set line 1 of lore of slot {_슬롯} of current inventory of player to ""
set line 2 of lore of slot {_슬롯} of current inventory of player to "&e[ &f구매가격 &e] &f%{npcshop.%arg-2%.Price1::%{_상점아이템}%}% &c원"
set line 3 of lore of slot {_슬롯} of current inventory of player to "&e[ &f판매가격 &e] &f%{npcshop.%arg-2%.Price2::%{_상점아이템}%}/2% &c원"
set line 4 of lore of slot {_슬롯} of current inventory of player to ""
set line 5 of lore of slot {_슬롯} of current inventory of player to "&e[ &c한세트 &f구매가격 &e] &f%{npcshop.%arg-2%.Price1::%{_상점아이템}%}*64% &c원"
else:
message ""
message "{@c} &f/상점 &e열기 &c[&f이름&c] &f- 당신은 &c[&f이름&c] &f(이)라는 상점을 &e오픈&f합니다."
message ""
stop
command /상점설정 [<text>] [<text>] [<integer>] [<integer>]:
permission: shop.op
trigger:
if arg 1 is not set:
message ""
message "{@c} &f/상점설정 &e생성 &c[&f이름&c] &f- &c[&f이름&c] &f이라는 상점을 &e생성&f합니다."
message "{@c} &f/상점설정 &e목록 &f- 지금까지 만든 &c상점&f들의 &e목록&f을 확인합니다."
message "{@c} &f/상점설정 &e추가 &c[&f이름&c] [&f구매가격&c] [&f판매가격&c] &f- 손에 든 아이템을 &c[&f이름&c] &f(이)라는 아이템을 &e추가&f합니다."
message "{@c} &f/상점설정 &e제거 &c[&f이름&c] [&f슬롯&c] &f- &c[&f이름&c] &f(이)라는 상점의 &c[&f슬롯&c] &f만 &e제거&f합니다."
message "{@c} &f/상점설정 &e초기화 &c[&f이름&c] &f- &c[&f이름&c] &f(이)라는 상점을 &e초기화&f합니다."
message ""
stop
if arg 1 is "생성":
if arg 2 is set:
if "%{npcshop::*}%" contains "%arg-2%":
message ""
message "{@c} &f당신은 이미 &c%arg-2% &f(이)라는 상점을 &e생성&f하셨습니다."
message ""
stop
else:
add 1 to {npcshop.list}
add arg-2 to {npcshop::*}
message ""
message "{@c} &f당신은 &c%arg-2% &f(이)라는 상점을 &e생성&f하셨습니다."
message ""
stop
if arg 1 is "추가":
if arg 2 is set:
if arg 3 is set:
if arg 4 is set:
if "%{npcshop::*}%" contains "%arg-2%":
add player's tool to {npcshop.%arg-2%::*}
add arg 3 to {npcshop.%arg-2%.Price1::*}
add arg 4 to {npcshop.%arg-2%.Price2::*}
add 1 to {npcshop.%arg-2%}
message ""
message "{@c} &f당신은 &c%player's tool% &f(이)라는 아이템을 &e%arg-2% &f상점에 &e추가&f하였습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 이미 &c%arg-2% &f(이)라는 상점을 &e생성&f하셨습니다."
message ""
stop
else:
message ""
message "{@c} &f/상점설정 &e추가 &c[&f이름&c] [&f가격&c] &f- 손에 든 아이템을 &c[&f이름&c] &f(이)라는 상점에 &c[&f가격&c] &f(이)라는 가격에 &e추가&f합니다."
message ""
stop
else:
message ""
message "{@c} &f/상점설정 &e추가 &c[&f이름&c] [&f가격&c] &f- 손에 든 아이템을 &c[&f이름&c] &f(이)라는 상점에 &c[&f가격&c] &f(이)라는 가격에 &e추가&f합니다."
message ""
stop
if arg 1 is "제거":
if arg 2 is set:
if arg 3 is set:
if "%{npcshop::*}%" contains "%arg-2%":
if {npcshop.%arg-2%} > 0:
remove 1 from {npcshop.%arg-2%}
delete {npcshop.%arg-2%::%arg-3%}
set {npcshop.%arg-2%::*} to {npcshop.%arg-2%::*}
delete {npcshop.%arg-2%.Price1::%arg-3%}
set {npcshop.%arg-2%.Price1::*} to {npcshop.%arg-2%.Price1::*}
delete {npcshop.%arg-2%.Price2::%arg-3%}
set {npcshop.%arg-2%.Price2::*} to {npcshop.%arg-2%.Price2::*}
message ""
message "{@c} &f당신은 &e%arg-2% &f상점에 &c%arg-3%&f번 슬롯을 &e제거&f하였습니다."
message ""
stop
if arg 1 is "목록":
if {npcshop.list} > 0:
message ""
loop {npcshop.list} times:
add 1 to {_목록}
message "{@c} &a[ &f%{_목록}% &a] &c%{npcshop::%{_목록}%}%"
message ""
else:
message ""
message "{@c} &f당신은 &e아직 &f만든 &c상점&f이 없습니다."
message ""
if arg 1 is "초기화":
if arg 2 is set:
if "%{npcshop::*}%" contains "%arg-2%":
remove "%arg-2%" from {npcshop::*}
set {npcshop::*} to {npcshop::*}
delete {npcshop.%arg-2%}
delete {npcshop.%arg-2%::*}
delete {npcshop.%arg-2%.Price1::*}
delete {npcshop.%arg-2%.Price2::*}
remove 1 from {npcshop.list}
message ""
message "{@c} &f당신은 &c%arg-2% &f(이)라는 상점을 &e초기화&f하였습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 이미 &c%arg-2% &f(이)라는 상점을 &e초기화&f하셨습니다."
message ""
stop
else:
message ""
message "{@c} &f/상점설정 &e제거 &c[&f이름&c] &f- &c[&f이름&c] &f(이)라는 상점을 &e제거&f합니다."
message ""
stop
on inventory click:
if inventory name of current inventory of player contains "{@c}":
cancel event
set {_shop} to inventory name of player's current inventory
replace all "[" and "범포" and "서버" and "]" and " " with "" in {_shop}
set {_shop} to uncolored {_shop} parsed as text
if raw slot < 36:
if click item is not air:
if clicked type is left mouse button:
if number of air in the player's inventory >= 1:
set {_lore::*} to lore of click item split by "||"
set {money} to uncolored {_lore::2}
replace all "[" and "구매" and "가격" and "]" and " " and "원" with "" in {money}
set {money} to uncolored {money} parsed as integer
if {money} is 0:
message ""
message "{@c} &f이 아이템은 &e구매&f하실 수 없습니다."
message ""
stop
if {money::%player%} >= {money}:
subtract {money} from {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]"
set line 1 of lore of slot 53 of current inventory of player to "&cㄴ &f%{money::%player%}% &c원"
give 1 of {npcshop.%{_shop}%::%clicked slot+1%} to player
message ""
message "{@c} &f당신은 &c%{money}% &f원을 사용하여 &e%{_shop}% &f상점에서 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 구매하셨습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 &c%{money}% &f원이 없으므로 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &e구매&f하실 수 없습니다."
message ""
stop
else:
message ""
message "{@c} &f당신의 &e인벤토리&f가 부족하여 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &e구매&f하실 수 없습니다."
message ""
stop
if clicked type is right mouse button:
if player has 1 of {npcshop.%{_shop}%::%clicked slot+1%}:
set {_lore::*} to lore of click item split by "||"
set {money} to uncolored {_lore::3}
replace all "[" and "판매" and "가격" and "]" and " " and "원" with "" in {money}
set {money} to uncolored {money} parsed as integer
if {money} is 0:
message ""
message "{@c} &f이 아이템은 &e판매&f하실 수 없습니다."
message ""
stop
remove 1 of {npcshop.%{_shop}%::%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]"
set line 1 of lore of slot 53 of current inventory of player to "&cㄴ &f%{money::%player%}% &c원"
message ""
message "{@c} &f당신은 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &e판매&f하여 &c%{money}% &f원을 얻었습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 &e판매&f할 &c아이템&f이 없습니다."
message ""
stop
if clicked type is left mouse button with shift:
if number of air in the player's inventory >= 1:
set {_lore::*} to lore of click item split by "||"
set {money} to uncolored {_lore::5}
replace all "[" and "구매" and "가격" and "한세트" and "]" and " " and "원" with "" in {money}
set {money} to uncolored {money} parsed as integer
if {money} is 0:
message ""
message "{@c} &f이 아이템은 &e구매&f하실 수 없습니다."
message ""
stop
if {money::%player%} >= {money}:
subtract {money} from {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]"
set line 1 of lore of slot 53 of current inventory of player to "&cㄴ &f%{money::%player%}% &c원"
give 64 of {npcshop.%{_shop}%::%clicked slot+1%} to player
message ""
message "{@c} &f당신은 &c%{money}% &f원을 사용하여 &e%{_shop}% &f상점에서 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &c한세트 &f구매하셨습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 &c%{money}% &f원이 없으므로 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &e구매&f하실 수 없습니다."
message ""
stop
else:
message ""
message "{@c} &f당신의 &e인벤토리&f가 부족하여 &c%{npcshop.%{_shop}%::%clicked slot+1%}% &f(을)를 &e구매&f하실 수 없습니다."
message ""
stop
if clicked type is right mouse button with shift:
if number of {npcshop.%{_shop}%::%clicked slot+1%} in the player's inventory >= 2:
set {_amount} to amount of {npcshop.%{_shop}%::%clicked slot+1%} in player's inventory
set {_lore::*} to lore of click item split by "||"
set {money} to uncolored {_lore::3}
replace all "[" and "판매" and "가격" and "]" and " " and "원" with "" in {money}
set {money} to uncolored {money} parsed as number
if {money} is 0:
message ""
message "{@c} &f이 아이템은 &e판매&f하실 수 없습니다."
message ""
stop
remove {_amount} of {npcshop.%{_shop}%::%clicked slot+1%} from player's inventory
add {money}*{_amount} to {money::%player%}
set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]"
set line 1 of lore of slot 53 of current inventory of player to "&cㄴ &f%{money::%player%}% &c원"
message ""
message "{@c} &f당신은 &c아이템 전부&f(을)를 &e판매&f하여 &c%{money}*{_amount}% &f원을 얻었습니다."
message ""
stop
else:
message ""
message "{@c} &f당신은 판매할 &e아이템&f이 없어서 &c판매&f하실 수 없습니다."
message ""
stop
구문들 중에 lore가 안뜨는 것은
loop {npcshop.%arg-2%} times:
add 1 to {_슬롯}
add 1 to {_상점아이템}
set slot {_슬롯}-1 of current inventory of player to {npcshop.%arg-2%::%{_상점아이템}%}
set line 1 of lore of slot {_슬롯} of current inventory of player to ""
set line 2 of lore of slot {_슬롯} of current inventory of player to "&e[ &f구매가격 &e] &f%{npcshop.%arg-2%.Price1::%{_상점아이템}%}% &c원"
set line 3 of lore of slot {_슬롯} of current inventory of player to "&e[ &f판매가격 &e] &f%{npcshop.%arg-2%.Price2::%{_상점아이템}%}/2% &c원"
set line 4 of lore of slot {_슬롯} of current inventory of player to ""
set line 5 of lore of slot {_슬롯} of current inventory of player t
o "&e[ &c한세트 &f구매가격 &e] &f%{npcshop.%arg-2%.Price1::%{_상점아이템}%}*64% &c원"
스크립터브혼
2021.01.24https://www.koreaminecraft.net/scriptqna/2149827
본문 수정 바랍니다.
굼굼
2021.01.24댓글 작성된 글은 수정이 불가능하다고 뜨네요
스크립터브혼
2021.01.25덧글에서도 에디터 모드에서 똑같은 기능을 사용할수 있어요.