개인 자료란 (JE)

  서버 커뮤니티

Profile 김두한4012 대표칭호 없음
Profile

질문하기 스크립트

서버 상점 스크립트 관련 질문입니다

2022.02.09 조회 수 116 추천 수 0
이해도 중급자(필요한 애드온을 찾아서 만들 수 있어요) 
게임버전 (JE) 1.18.1 
게임버전 (BE) 관련없음 
스크립트 버전 2.6.1 
스크립트 애드온 InvSK, SKRayFall, SKUtilities, SKQuery 

서버에 상점 스크립트를 만들고 있습니다.

그런데 아이템이 너무 많아지면 구문이 너무 길어질거 같아서 특정 아이템을 눌렀을때

변수로 저장후 그 변수대로 상점이 열리게 만들고 싶었습니다.

하지만 변수를 저장했음에도 불구하고 다음과 같이 떴습니다.

beafd221a29ecfa1b9bb12888c426c96.png


코드는 아래에 있습니다.

(보기 불편하실거 같아서 파일 첨부했습니다)index.sk 

command /shop [<string>]:

    trigger:

        if arg 1 is "open":

            open chest with 3 rows named "%{_SHOP-NAME.%player%}%" to player

            set {GUI.%player%} to true

            set slot 10 of current inventory of player to lime wool named "&a&l판매 x64" with lore "&7+%{_SHOP-SELL.%player%}*64%¤"

            set slot 11 of current inventory of player to lime wool named "&a&l판매 x10" with lore "&7+%{_SHOP-SELL.%player%}*10%¤"

            set slot 12 of current inventory of player to lime wool named "&a&l판매 x1" with lore "&7+%{_SHOP-SELL.%player%}%¤"

            set slot 13 of current inventory of player to {_SHOP-ITEM.%player%} named "{_SHOP-NAME.%player%}"

            set slot 14 of current inventory of player to red wool named "&a&l구매 x1" with lore "&7-%{_SHOP-COST.%player%}%"

            set slot 15 of current inventory of player to red wool named "&a&l구매 x10" with lore "&7-%{_SHOP-COST.%player%}*10%¤"

            set slot 16 of current inventory of player to red wool named "&a&l구매 x64" with lore "&7-%{_SHOP-COST.%player%}*64%¤"

        else if arg 1 is "cave":

            open chest with 6 rows named "&5&l상점 [동굴 관련]" to player

            set {GUI.%player%} to true

            set slot 10 of current inventory of player to cobblestone named "&l&e조약돌" with lore "&a판메가 : 10¤%nl%&c구매가 : 12¤"

            set slot 11 of current inventory of player to stone named "&l&e돌" with lore "&a판메가 : 11¤%nl%&c구매가 : 14¤"

            set slot 12 of current inventory of player to cobbled deepslate named "&l&e심층암 조약돌" with lore "&a판메가 : 11¤%nl%&c구매가 : 14¤"

            set slot 13 of current inventory of player to deepslate named "&l&e심층암" with lore "&a판메가 : 13¤%nl%&c구매가 : 18¤"

        else:

            set {GUI.%player%} to true

            open chest with 3 rows named "&5&l상점 메뉴" to player

            set slot 10 of current inventory of player to stone named "&a&l동굴 관련 상점"

on inventory click:

    if inventory name of current inventory of player contains "&5&l상점 [동굴 관련]":

        if clicked slot is 10:

            cancel event

            set {GUI.%player%} to true

            set {_SHOP-NAME.%player%} to "&e&l조약돌"

            set {_SHOP-ITEM.%player%} to "cobblestone"

            set {_SHOP-SELL.%player%} to 10

            set {_SHOP-COST.%player%} to 12

            set {_SHOP-COST10.%player%} to {_SHOP.COST.%player%}*10

            set {_SHOP-COST64.%player%} to {_SHOP.COST.%player%}*64

            execute player command "/shop open"

on inventory click:

    if inventory name of current inventory of player contains "%{_SHOP-NAME.%player%}%":

        if clicked slot is 10:

            if amount of {_SHOP-ITEM.%player%} in inventory of player < 64:

                message "&7[&c!&7] %{_SHOP-NAME.%player%}%&f(이)가 충분하지 않습니다"

            else:

                execute console command "clear %player% %{_SHOP-ITEM.%player%}% 64"

                add {_SHOP-SELL.%player%}*64 to {monny.%player%}

                message "&7[&a+&7] &f%{_SHOP-SELL.%player%}*64%¤"

        else if clicked slot is 11:

            if amount of {_SHOP-ITEM.%player%} in inventory of player < 10:

                message "&7[&c!&7] %{_SHOP-NAME.%player%}%&f(이)가 충분하지 않습니다"

            else:

                execute console command "clear %player%  %{_SHOP-ITEM.%player%}% 10"

                add {_SHOP-SELL.%player%}*10 to {monny.%player%}

                message "&7[&a+&7] &f%{_SHOP-SELL.%player%}*10%¤"

        else if clicked slot is 12:

            if amount of {_SHOP-ITEM.%player%} in inventory of player < 1:

                message "&7[&c!&7] %{_SHOP-NAME.%player%}%&f(이)가 충분하지 않습니다"

            else:

                execute console command "clear %player% %{_SHOP-ITEM.%player%}% 1"

                add 10 to {monny.%player%}

                message "&7[&a+&7] &f%{_SHOP-SELL.%player%}%¤"

        else if clicked slot is 14:

            if {monny.%player%} < {_SHOP-COST.%player%}:

                message "&7[&c!&7] &f돈이 충분하지 않습니다"

            else:

                execute console command "give %player% %{_SHOP-ITEM.%player%}% 1"

                add -1*{_SHOP-COST.%player%} to {monny.%player%}

                message "&7[&c-&7] &f%{_SHOP-COST.%player%}%¤"

        else if clicked slot is 14:

            if {monny.%player%} < {_SHOP-COST.%player%}*10:

                message "&7[&c!&7] &f돈이 충분하지 않습니다"

            else:

                execute console command "give %player% %{_SHOP-ITEM.%player%}% 1"

                add -1*{_SHOP-COST.%player%} to {monny.%player%}

                message "&7[&c-&7] &f%{_SHOP-COST10.%player%}%¤"

        else if clicked slot is 14:

            if {monny.%player%} < {_SHOP-COST64.%player%}*64:

                message "&7[&c!&7] &f돈이 충분하지 않습니다"

            else:

                execute console command "give %player% %{_SHOP-ITEM.%player%}% 1"

                add -1*{_SHOP-COST.%player%} to {monny.%player%}

                message "&7[&c-&7] &f%{_SHOP-COST64.%player%}%¤"

on inventory click:

    if inventory name of current inventory of player contains "&5&l상점 메뉴":

        if clicked slot is 10:

            cancel event

            execute player command "/shop cave"

Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!

뉴스 및 창작물
/files/thumbnails/268/789/003/262x150.crop.jpg?20240515192032

레드스톤

벌레먹은 돌 빠르게 제거하는 법

GlassesFilm

2024-05-15

0

/files/thumbnails/797/788/003/262x150.crop.jpg?20240515090924

건축

마인크래프트로 구현한 카르카손 보드게임

Warak

2024-05-15

1

/files/thumbnails/487/784/003/262x150.crop.jpg?20240508233607

모드

Windows Borderless 모드에서 악성코드 발견 3

학교가기싫다

2024-05-08

1

/files/thumbnails/384/778/003/262x150.crop.jpg?20240512002324

업데이트

마인크래프트 자바 에디션 스냅샷 24w18a

학교가기싫다

2024-05-06

0

/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

1