개인 자료란 (JE)

  서버 커뮤니티

Profile cho970427 대표칭호 없음

bang2_ 80c86f021101477fba69a30a41eab160

Profile

질문하기 스크립트

스크립트를 배우고있는 마린이 입니다 .궁금한게 있어서 여쭤봅니다

2023.04.29 조회 수 91 추천 수 0
이해도 입문자 
게임버전 (JE) 관련없음 
게임버전 (BE) 1.19.x 
스크립트 버전 Skript-2.7.0-beta2 

이런식으로 상점을 구현했는데 돈이 마이너스 되면서 아이템이 더 사지고 아이템이 1개 가지고 있으면 쉬프트  마우스  오른쪽 눌렀을때  64개 만큼 돈이 들어옵니다 .. 뭘 고쳐야 하는지 알려줄수 있을까요 ㅠㅠ

on inventory click:

    if inventory name of player's current inventory is "&b상점1":

        cancel event

        if clicked item is not black stained glass pane:

            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%.돈} is smaller than {_lore}:

                    message "&a돈&f이 부족해 해당 &e아이템&f을 구매할 수 없습니다.!"

                    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" with volume 0.5 to the player

                else:

                    set {_item} to clicked item

                    delete lore of {_item}

                    give {_item} to player

                    subtract {_lore} from {%player%.돈}

                    message "&e아이템&f을 구매 했습니다.!"

                    play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

            if click type is left mouse button with shift:

                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%.돈} is smaller than {_lore}:

                    message "&a돈&f이 부족해 해당 &e아이템&f을 구매할 수 없습니다.!"

                else:

                    set {_item} to clicked item

                    delete lore of {_item}

                    give 64 of {_item} to player

                    subtract {_lore}*64 from {%player%.돈}

                    message "&e아이템&f을 구매 했습니다.!"

                    play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

                if click type is right 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

                    set {_item} to clicked item

                    delete lore of {_item}

                if player has 1 of {_item}:

                    remove 1 of {_item} from player's inventory

                    add {_lore} to {%player%.돈}

                    message "&e아이템&f을 판매합니다!"

                    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" with volume 0.5 to the player

                else:

                    message "해당 &e아이템&f을 가지고 있지 않아 판매할 수 없습니다.!"

                    play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

            if click type is right mouse button with shift:

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

                replace all "매매 가격: " and "원" with "" in {_lore}

                set {_lore} to {_lore} parsed as integer

                set {_item} to clicked item

                delete lore of {_item}

                if player has 1 of {_item}:

                    remove 64 of {_item} from player's inventory

                    add {_lore}*64 to {%player%.돈}

                    message "&e아이템&f을 판매합니다!"                

                    play sound "ENTITY_EXPERIENCE_ORB_PICKUP" with volume 0.5 to the player

                else:

                    message "해당 &e아이템&f을 가지고 있지 않아 판매할 수 없습니다.!"

                    play sound "UI_BUTTON_CLICK" with volume 0.5 to the player    

12개의 댓글

코코냐
2023.04.29

아이템 갯수 확인은 하셨냐요?

cho970427
2023.04.29
@코코냐

네넵 아이템 갯수 확인 했는데 1 개여도 64개만큼 돈을 줘가지고 ...

코코냐
2023.04.29
@cho970427

그러면 왜 1개가 있는데 64개로 처리하죠..?

cho970427
2023.04.29
@코코냐

그걸 모르겠어요 .. ㅜㅜ.. if player has 1 of {_item}:

 

remove 64 of {_item} from player's inventory

 

add {_lore}*64 to {%player%.돈} 이부분에 remove 64 remove 1 로바꾸면 1개씩만 팔아지고 64개씩은 안팔아지구

cho970427
2023.04.29
@코코냐

제가 잘 모르겠어서 ..

코코냐
2023.04.29
@cho970427

64개가 아닐수도 있는데 왜 항상 64배로 주죠..?

cho970427
2023.04.29
@코코냐

그러면 어떻게 해야하나요 . ? 1 개로 팔 수있게끔은 해놨는데 64개를 한번에 팔려고 했는데 ㅠㅠ..

코코냐
2023.04.29
@cho970427

몇개 있는지 판단을 해서 그만큼만 돈을 줘야죠?

cho970427
2023.04.29
@코코냐

그러면 if player has 1 of {_item}: 지우고 if player has 수량 of wheat: 인가영?

코코냐
2023.04.29
@cho970427

일일이 검사하기보다 몇개를 갖고있는지를 불러와보세요.

cho970427
2023.04.29
@코코냐

알겠습니다 ㅜㅜ

cho970427
2023.04.30
@코코냐

으헝.. .ㅠㅠ 이것저것 다써보고 하는데 안되는데 힌트좀 가르쳐주세여

뉴스 및 창작물
/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 모드에서 악성코드 발견

학교가기싫다

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