이해도 | 초보자(스크립트 구성요소나 기본문법은 알아요) |
---|---|
게임버전 (JE) | 1.17 |
스크립트 버전 | 2.6-beta2 |
스크립트 애드온 | Skellett, skRayFall, skUtilities, SkQuery, SkBee, SharpSK, QuarSk 사용중 |
안녕하세요 친구들과 소규모로 즐기기 위해서 친구들과 함께 서버를 만드는 중입니다!
기본적으로 서버에 8gb램을 할당하고 있습니다.
처음하면서 부족한 점이 많습니다. 최대한 오류를 찾아보았지만 현재 제 지식으로는 역부족이라서 이렇게 글을 작성해봅니다.
여러 검색과 참고를 통해서 스크립트를 작성하고 있는데, 도박시스템을 만들려고 여러곳에서 참고하여 작성하였습니다!
1번 문제점
작성한 스크립트를 불러오니 서버가 버티지 못하고 터졌습니다!
터진 후 재접속 해보니 시간 초과로 연결이 안되더군요.
그래서 스크립트 속에 넣은 tick과 wait n seconds를 모두 제거했습니다.
그 후에는 접속은 됩니다. 그런데 얼마 지나지 않아 서버는 다시 터집니다.
2번 문제점
구상은 칩셋 교환원을 클릭시 칩셋 교환소 컨테이너가 열리고 구매와 판매 선택지가 나온 후
구매와 판매 선택지를 클릭시 각 칩셋을 구입 및 판매하는 npc를 구상하였습니다.
하지만 칩셋 교환원 npc를 클릭했을 때, 스크립트가 구상한 대로 정상적으로 작동하지 않습니다.
아래에 구문을 적어봅니다. 오류를 찾고 수정할 수 있도록 도와주세요 ㅠㅠ
on right click on entity:
if entity's name is "칩셋 교환원":
open chest with 3 rows named "칩셋 교환소" to player
while inventory name of current inventory of player is "칩셋 교환소":
set {_a} to 0
set {_b} to 17
loop 10 times:
set slot {_a} of current inventory of player to white stained glass pane
set slot {_b} of current inventory of player to white stained glass pane
add 1 to {_a}
add 1 to {_b}
set {_c} to 10
set slot 13 of current inventory of player to book named "&f[&6칩셋 구매하기&f]" with lore "구매를 원하시면 클릭해주세요!"
set slot 15 of current inventory of player to book named "&f[&6칩셋 판매하기&f]" with lore "판매를 원하시면 클릭해주세요!"
on inventory click:
if inventory name of current inventory of player contains "칩셋 교환소":
if clicked raw slot is 13:
open chest with 3 rows named "칩셋 구매소" to player
while inventory name of current inventory of player is "칩셋 구매소":
set {_a} to 0
set {_b} to 17
loop 10 times:
set slot {_a} of current inventory of player to white stained glass pane
set slot {_b} of current inventory of player to white stained glass pane
add 1 to {_a}
add 1 to {_b}
set {_c} to 10
set slot 12 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
set slot 13 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
set slot 14 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
set slot 15 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
set slot 16 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
if clicked raw slot is 15:
open chest with 3 rows named "칩셋 판매소" to player
while inventory name of current inventory of player is "칩셋 판매소":
set {_a} to 0
set {_b} to 17
loop 10 times:
set slot {_a} of current inventory of player to white stained glass pane
set slot {_b} of current inventory of player to white stained glass pane
add 1 to {_a}
add 1 to {_b}
set {_c} to 10
set slot 12 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
set slot 13 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
set slot 14 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
set slot 15 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
set slot 16 of current inventory of player to paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
on inventory click:
if inventory name of current inventory of player contains "칩셋 구매소":
if clicked raw slot is 12:
if {돈.%uuid of player%} >= 1000:
subtract 1000 from {돈.%uuid of player%}
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
if clicked raw slot is 13:
if {돈.%uuid of player%} >= 10000:
subtract 10000 from {돈.%uuid of player%}
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
if clicked raw slot is 14:
if {돈.%uuid of player%} >= 100000:
subtract 100000 from {돈.%uuid of player%}
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
if clicked raw slot is 15:
if {돈.%uuid of player%} >= 1000000:
subtract 1000000 from {돈.%uuid of player%}
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
if clicked raw slot is 16:
if {돈.%uuid of player%} >= 10000000:
subtract 10000000 from {돈.%uuid of player%}
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
if inventory name of current inventory of player contains "칩셋 판매소":
if clicked raw slot is 12:
add 1000 to {돈.%uuid of player%}
remove 1 of paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋" from player's inventory
if clicked raw slot is 13:
add 10000 to {돈.%uuid of player%}
remove 1 of paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋" from player's inventory
if clicked raw slot is 14:
add 100000 to {돈.%uuid of player%}
remove 1 of paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋" from player's inventory
if clicked raw slot is 15:
add 1000000 to {돈.%uuid of player%}
remove 1 of paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋" from player's inventory
if clicked raw slot is 16:
add 10000000 to {돈.%uuid of player%}
remove 1 of paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋" from player's inventory
else:
cancel event
on right click on sign:
if name of player's tool contains "&f[&6랜덤룰렛용 칩셋&f]":
if lore of player's tool contains "1000원 칩셋":
remove 1 of player's tool from player's tool
message "&f&1[ &a&1■□□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■■■ &f&1]" to player
wait 1 tick
chance of 20%:
message "&e&1[ &f&1성공 &f&1] 2배" to player
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
chance of 10%:
message "&e&1[ &f&1성공 &f&1] 3배" to player
give player 3 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
chance of 1%:
message "&e&1[ &f&1성공 &f&1] 5배" to player
give player 5 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000원 칩셋"
else:
message "&c&1[ &f&1실패 &c&1]" to player
if lore of player's tool contains "10000원 칩셋":
remove 1 of player's tool from player's tool
message "&f&1[ &a&1■□□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■■■ &f&1]" to player
wait 1 tick
chance of 20%:
message "&e&1[ &f&1성공 &f&1] 2배" to player
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
chance of 10%:
message "&e&1[ &f&1성공 &f&1] 3배" to player
give player 3 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
chance of 1%:
message "&e&1[ &f&1성공 &f&1] 5배" to player
give player 5 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000원 칩셋"
else:
message "&c&1[ &f&1실패 &c&1]" to player
if lore of player's tool contains "100000원 칩셋":
remove 1 of player's tool from player's tool
message "&f&1[ &a&1■□□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■■■ &f&1]" to player
wait 1 tick
chance of 20%:
message "&e&1[ &f&1성공 &f&1] 2배" to player
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
chance of 10%:
message "&e&1[ &f&1성공 &f&1] 3배" to player
give player 3 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
chance of 1%:
message "&e&1[ &f&1성공 &f&1] 5배" to player
give player 5 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "100000원 칩셋"
else:
message "&c&1[ &f&1실패 &c&1]" to player
if lore of player's tool contains "1000000원 칩셋":
remove 1 of player's tool from player's tool
message "&f&1[ &a&1■□□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■■■ &f&1]" to player
wait 1 tick
chance of 20%:
message "&e&1[ &f&1성공 &f&1] 2배" to player
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
chance of 10%:
message "&e&1[ &f&1성공 &f&1] 3배" to player
give player 3 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
chance of 1%:
message "&e&1[ &f&1성공 &f&1] 5배" to player
give player 5 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "1000000원 칩셋"
else:
message "&c&1[ &f&1실패 &c&1]" to player
if lore of player's tool contains "10000000원 칩셋":
remove 1 of player's tool from player's tool
message "&f&1[ &a&1■□□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■□□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■□□□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■□□ &f&1]" to player
wait 1 tick
message "&f&1[ &a&1■■■■■■■ &f&1]" to player
wait 1 tick
chance of 20%:
message "&e&1[ &f&1성공 &f&1] 2배" to player
give player 1 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
chance of 10%:
message "&e&1[ &f&1성공 &f&1] 3배" to player
give player 3 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
chance of 1%:
message "&e&1[ &f&1성공 &f&1] 5배" to player
give player 5 paper named "&f[&6랜덤룰렛용 칩셋&f]" with lore "10000000원 칩셋"
else:
message "&c&1[ &f&1실패 &c&1]" to player
else:
message "[시스템] 코인을 인식 할 수 없습니다. 코인을 들고 있는지 확인해주세요!"
코코냐
2021.08.30서버가 아예 터져버린다면, 스크립트 외의 문제일 수도 있습니다. crash-report 폴더가 있다면 해당 경로의 충돌 리포트를, 없다면 logs 폴더의 latest.log 파일로 확인을 진행해야합니다.
스크립터브혼
2021.08.31while에서 무한루프에 빠지는 것으로 판단됩니다.
while에 지연시간을 넣지않으면 작업 대기열이 꽉차서 서버가 다운되게 됩니다.
거너아나
2021.09.01clicked entity's name 아닌가요
entity로 하면 감지 안 될 겁니다