개인 자료란 (JE)

  서버 커뮤니티

Profile L베리 대표칭호 없음
Profile

질문하기 스크립트

스크립트 gui 질문

2023.10.22 조회 수 52 추천 수 0
이해도 입문자 
게임버전 (JE) 관련없음 
게임버전 (BE) 관련없음 

    on inventory click:

        if name of player's current inventory is "&b낚시":

            if clicked item is not air:

                if click type is left mouse button:

                    set {_등급} to uncolored line 1 of lore of clicked item

                    replace all "등급" with "" in {_등급}

                    if {_등급} is "S":

                        set {_등급} to "5" parsed as integer

                    else if {_등급} is "A":

                        set {_등급} to "3" parsed as integer

                    else if {_등급} is "B":

                        set {_등급} to "2" parsed as integer

                    else if {_등급} is "C":

                        set {_등급} to "1.2" parsed as integer

                    else if {_등급} is "D":

                        set {_등급} to "1" parsed as integer

                    set {_길이} to uncolored line 2 of lore of clicked item

                    replace all " cm" with "" in {_길이}

                    set {_길이} to {_길이} parsed as integer

                    set {_종류} to clicked item

                    delete lore of {_종류}

                    if {_종류} is "정어리":

                        if player has 1 of {_종류}:

                            set {_정어리} to ({정어리}+({정어리}*({_길이}*0.01)*{_등급}))

                            remove 1 of {_종류} from player's inventory

                            if {%player%.직업} is "낚시꾼":

                                add {_정어리}+({_정어리}*0.05) to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_정어리}%원을 벌었습니다."

                                message "&6낚시꾼 보너스로 %{_정어리}*0.05%원을 더 벌었습니다."

                            else:

                                add {_정어리} to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_정어리}%원을 벌었습니다."

                    else if {_종류} is "참치":

                        if player has 1 of {_종류}:

                            set {_참치} to ({참치}+({참치}*({_길이}*0.01)*{_등급}))

                            remove 1 of {_종류} from player's inventory

                            if {%player%.직업} is "낚시꾼":

                                add {_참치}+({_참치}*0.05) to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_참치}%원을 벌었습니다."

                                message "&6낚시꾼 보너스로 %{_참치}*0.05%원을 더 벌었습니다."

                            else:

                                add {_참치} to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_참치}%원을 벌었습니다."

                    else if {_종류} is "고등어":

                        if player has 1 of {_종류}:

                            set {_고등어} to ({고등어}+({고등어}*({_길이}*0.01)*{_등급}))

                            remove 1 of {_종류} from player's inventory

                            if {%player%.직업} is "낚시꾼":

                                add {_고등어}+({_고등어}*0.05) to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_고등어}%원을 벌었습니다."

                                message "&6낚시꾼 보너스로 %{_고등어}*0.05%원을 더 벌었습니다."

                            else:

                                add {_고등어} to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_고등어}%원을 벌었습니다."

                    else if {_종류} is "멸치":

                        if player has 1 of {_종류}:

                            set {_멸치} to ({멸치}+({멸치}*({_길이}*0.01)*{_등급}))

                            remove 1 of {_종류} from player's inventory

                            if {%player%.직업} is "낚시꾼":

                                add {_멸치}+({_멸치}*0.05) to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_멸치}%원을 벌었습니다."

                                message "&6낚시꾼 보너스로 %{_멸치}*0.05%원을 더 벌었습니다."

                            else:

                                add {_멸치} to {%player%.돈}

                                message "&a%{_등급}%등급 %{_종류}%(%{_길이}%)을(를) 팔아 %{_멸치}%원을 벌었습니다."

위 명령어는 지금 낚시라는 이름을 가진 창고에 있는 아이템의 이름과 설명을 인식하여 가격을 책정해 돈을 지급하는데,

창고에있는 아이템이 아니라 인벤토리에 있는 아이템을 클릭하여 그 아이템이 인식되어 팔렸으면 좋겠습니다.

어떻게 고쳐야할까요?




5개의 댓글

피코
2023.10.22

if name of player's current inventory is "Crafting":

이 구문을 쓰시고 똑같이 스크립트를 작성해 주시면 될거 같습니다.

L베리
2023.10.22
@피코

안되네요... 플레이어의 인벤토리 이름이 Crafting인가요?

 

L베리
2023.10.22
@L베리

현재 낚시라는 gui창이 열리고 그 안에 정어리 1000원이 적혀있고,

인벤토리에 있는 정어리 A등급 20cm라고 적혀있는 정어리를 누르면

아래 구문이 작동하여 아이템이 팔리도록 하고 싶어요 가능할까요?

피코
2023.10.25
@L베리

늦게 봤네요

마크 내에 있는 인벤토리의 이름은 Crafting입니다

버전마다 차이가 있을 수 있으니

on inventory close:

@set {_name} to event-inventory's name

@message "%{_name}%"

과 같이 직접 확인하는 방법도 있습니다

L베리
2023.10.25
@피코

위에 댓글 참고해서 찾아보다가 해결했습니다!

늦게라도 도와주셔서 감사해요!

뉴스 및 창작물
/files/thumbnails/855/781/003/262x150.crop.jpg?20240505141129

레드스톤

레이저 클리너

GlassesFilm

2024-05-05

0

/files/thumbnails/576/775/003/262x150.crop.jpg?20240426232553

아티클

이달의 블록: 단단한 진흙

학교가기싫다

2024-04-26

0

/files/thumbnails/115/774/003/262x150.crop.jpg?20240428135129

업데이트

마인크래프트 1.20.5 정식 업데이트

학교가기싫다

2024-04-24

0

/files/thumbnails/762/770/003/262x150.crop.jpg?20240418073724

레드스톤

T.B.H (고민중독) | 노트블럭 버전 | NoteBlock Cover [한국어 영어 중국어 가사 추가]

노트블럭전문가

2024-04-18

0

/files/thumbnails/218/767/003/262x150.crop.jpg?20240412130213

레드스톤

우리의 꿈 - 원피스 오프닝

노트블럭전문가

2024-04-12

0