개인 자료란 (JE)

  서버 커뮤니티

Profile ing_o 대표칭호 없음
Profile

질문하기 스크립트

상점 cancel event

2021.05.27 조회 수 76 추천 수 0
이해도 1.12 
게임버전 (JE) 모드버킷 
스크립트 버전 입문자(아무것도 몰라요) 
스크립트 애드온 2.2 

on rightclick on entity:

    if name of entity is "[상점] 묘목":

        set {묘목.1} to chest with 6 rows named "&e[상점] 묘목 - 1"

        open {묘목.1} to player

        set {_slot} to 0

        loop 54 times:

            set slot {_slot} of current inventory of player to gray glass

            add 1 to {_slot}

        set slot 10 of current inventory of player to harvestcraft date sapling

        set line 1 of lore of slot 10 of current inventory to "&a[구매가] &f2000원"

        set slot 50 of current inventory of player to nether_star named "다음 2페이지"

            

on inventory click:

    if name of current inventory is "&e[상점] 묘목 - 1":

        cancel event

        if clicked item is not gray glass:

            if clicked raw slot <= 54:

                if click type is left mouse button:

                    set {_lore} to uncolored line 1 of lore of clicked item

                    replace all "[구매가] " and "원" with "" in {_lore}

                    set {_lore} to {_lore} parsed as integer

                    if player's money < {_lore}:

                        message "&c소지금이 부족합니다."

                    else:

                        set {_item} to clicked item

                        delete lore of {_item}

                        give {_item} to player

                        subtract {_lore} from player's money


다음페이지로 넘어가는 네더의 별을 눌렀을 때 인벤토리로 네더의 별이 들어오지 않게 설정하고 싶습니다. 

if clicked item is not gray glass or nether_star named "다음 2페이지" 로 설정하면 오류가 났다고 뜨진 않지만 인벤으로 유리와 네더의별 둘 다 들어옵니다.

4개의 댓글

거너아나
2021.05.28

작성했던 코드 다 보여주세요

ing_o
2021.05.28
@거너아나
on rightclick on entity:
    if name of entity is "[상점] 묘목":
        set {묘목.1} to chest with 6 rows named "&e[상점] 묘목 - 1"
        open {묘목.1} to player
        set {_slot} to 0
        loop 54 times:
            set slot {_slot} of current inventory of player to gray glass
            add 1 to {_slot}
        set slot 10 of current inventory of player to harvestcraft date sapling
        set line 1 of lore of slot 10 of current inventory to "&a[구매가] &f2000원"
        set slot 50 of current inventory of player to nether_star named "다음 2페이지"
            
on inventory click:
    if name of current inventory is "&e[상점] 묘목 - 1":
        cancel event
        if clicked item is nether_star named "다음 2페이지":
            cancel event
        if clicked item is not gray glass or not nether_star named "다음 2페이지":
            if clicked raw slot <= 54:
                if click type is left mouse button:
                    set {_lore} to uncolored line 1 of lore of clicked item
                    replace all "[구매가] " and "원" with "" in {_lore}
                    set {_lore} to {_lore} parsed as integer
                    if player's money < {_lore}:
                        message "&c소지금이 부족합니다."
                    else:
                        set {_item} to clicked item
                        delete lore of {_item}
                        give {_item} to player
                        subtract {_lore} from player's money

or구문으로 다시 시도해보니 유리는 들어오지 않고 네더의 별만 들어오는것을 확인했습니다. 그래서 네더의 별을 눌렀을 때 이벤트가 취소되도록 추가했는데도 여전히 네더의 별이 인벤토리에 들어옵니다..

ing_o
2021.05.28
@거너아나
on rightclick on entity:
    if name of entity is "[상점] 묘목":
        set {묘목.1} to chest with 6 rows named "&e[상점] 묘목 - 1"
        open {묘목.1} to player
        set {_slot} to 0
        loop 54 times:
            set slot {_slot} of current inventory of player to gray glass
            add 1 to {_slot}
        set slot 10 of current inventory of player to harvestcraft date sapling
        set line 1 of lore of slot 10 of current inventory to "&a[구매가] &f2000원"
        set slot 50 of current inventory of player to nether_star named "다음 2페이지"
            
on inventory click:
    if name of current inventory is "&e[상점] 묘목 - 1":
        cancel event
        if clicked item is not gray glass:
            if clicked item is nether_star named "다음 2페이지":
                cancel event
            if clicked raw slot <= 54:
                if click type is left mouse button:
                    set {_lore} to uncolored line 1 of lore of clicked item
                    replace all "[구매가] " and "원" with "" in {_lore}
                    set {_lore} to {_lore} parsed as integer
                    if player's money < {_lore}:
                        message "&c소지금이 부족합니다."
                    else:
                        set {_item} to clicked item
                        delete lore of {_item}
                        give {_item} to player
                        subtract {_lore} from player's money

이렇게도 시도해봤습니다

거너아나
2021.05.29
@ing_o

nether star

뉴스 및 창작물
/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

/files/thumbnails/505/766/003/262x150.crop.jpg?20240411122306

레드스톤

기동전사 건담 수성의 마녀 | 노트블럭 커버 1

노트블럭전문가

2024-04-11

1