개인 자료란 (JE)

  서버 커뮤니티

Profile sdfdsr 대표칭호 없음

bl9ckSapphire 86355e6bbe4b483482de818ff64e62da

Profile

질문하기 스크립트

스크립트 질문

2020.11.14 조회 수 586 추천 수 0
이해도 1.16 
게임버전 (JE) 페이퍼 
스크립트 애드온 2.5 

on inventory click:
    if inventory name is "제작대":
        cancel event
        if clicked raw slot is 10:
            if click type is right mouse button or left mouse button:
                if player doesn't have enough space for 1 of air:
                    send "인벤토리 공간을 비워주세요."
                else: 
                    if amount of cobblestone in inventory of player >= 3:
                        if amount of stick in inventory of player >= 2:
                            remove 3 of cobblestone from player
                            remove 2 of stick from player
                            give stone pickaxe to player
                            send "돌 곡괭이를 제작하였습니다."
                        else:
                            message "재료가 부족합니다."
                    else:
                        message "재료가 부족합니다."
 작동을 안하는데 혹시 잘못된 부분이 있나요?

오류는 뜨지 않지만 인벤토리가 가득 차 있어도 계속 제작이 되길래..




3개의 댓글

스크립터브혼
2020.11.14

if player doesn't have enough space for 1 of air: 이 부분을 다시 확인해보세요.
[Can Hold]컨디션은 아이템을 가질 수 있는지 확인합니다. 공기는 가질 수 있다고 판단 하는 것일 수 있습니다.


컨디션을 올바르게 사용하면 가독성을 높일 수 있습니다.
아래는 본문의 내용을 정리한 코드입니다.

on inventory click:
    inventory name is "제작대"
    cancel event

    clicked raw slot is 10
    click type is right mouse button or left mouse button
    
    add 1 to {_case} if amount of cobblestone in inventory of player >= 3
    add 1 to {_case} if amount of stick in inventory of player >= 2
    
    if {_case} < 2:
        message "재료가 부족합니다."
        stop
    
    set {_item} to stone pickaxe
    if player doesn't have enough space for {_item}:
        send "인벤토리 공간을 비워주세요."
        stop
        
    remove 3 of cobblestone from player
    remove 2 of stick from player
    give {_item} to player
    send "돌 곡괭이를 제작하였습니다."
sdfdsr
2020.11.15
@스크립터브혼

감사합니다. 그런데 이 구문을 사용해보니 돌 곡괭이를 만들기 위해 필요한 재료 (조약돌,막대기) 를 아무것도 보유하고 있지 않을 때에는 돌 곡괭이가 무한정으로 지급되는데 어떤 구문을 더 추가해 줘야 하는건가요?

스크립터브혼
2020.11.15
@sdfdsr
    set {_case} to 0
    add 1 to {_case} if amount of cobblestone in inventory of player >= 3
    add 1 to {_case} if amount of stick in inventory of player >= 2

\이렇게 바꾸세요.

뉴스 및 창작물
/files/thumbnails/487/784/003/262x150.crop.jpg?20240508233607

모드

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

학교가기싫다

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

/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