개인 자료란 (JE)

  서버 커뮤니티

Profile 웰치포도 대표칭호 없음
Profile

질문하기 스크립트

마크 상점 전체 판매 질문

2023.12.23 조회 수 89 추천 수 0
이해도 초보자 
게임버전 (JE) 관련없음 
게임버전 (BE) 관련없음 
스크립트 버전 2.7.3 
스크립트 애드온 SharpSK, Skellett, SkQuery, SkRayfall, skript-gui, sKUtillties, Citizens 

on inventory click:

    if inventory name is "&b상점":

        set {_item} to clicked item

        cancel event

        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 "&c돈이 부족해 구매할수없습니다."

                play sound "entity.experience_orb.pickup" with volume 0.5 to the player

            else:

                delete lore of {_item}

                give {_item} to player

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

                play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

        else if click type is right mouse button:

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

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

            set {_lore} to {_lore} parsed as integer

            delete lore of {_item}

            if player has 1 of {_item}:

                remove 1 of {_item} from player's inventory

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

                play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

                send "&e1개 판매하였습니다! "

            else:            

                message "&c아이템이 부족해 판매할수없습니다."

                play sound "entity.experience_orb.pickup" with volume 0.5 to the player        

        if click type is right mouse button with shift:    

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

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

            set {_lore} to {_lore} parsed as integer

            delete lore of {_item}

            if player has 64 of {_item}:

                remove 64 of {_item} from player's inventory

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

                play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

                send "&e64개 판매하였습니다! "

            else:            

                message "&c아이템이 부족하여 판매할수없습니다."

                play sound "entity.experience_orb.pickup" with volume 0.5 to the player


몇시간을 해봐도 이 구문에서 쉬프트+우클릭을 했을때전체 판매를 하게 하는 법을 모르겠는데 도와주세요!




15개의 댓글

라아아아밍
2023.12.25

어디가 이상한지 알려주셔야... 구문은 제가 보기엔 이상한 게 없어 보입니다.

웰치포도
2023.12.25
@라아아아밍

그 쉬프트 우클릭 했을떄 전체판매 하는 구문을 알고싶어서요

라아아아밍
2023.12.25
@웰치포도

혹시 판매할 아이템의 로어랑 gui에 있는 판매 아이템의 로어를 확인할 수 있을까요?

웰치포도
2023.12.25
@라아아아밍

on rightclick on entity:

if name of entity is "광부 상점":

open chest with 1 row named "&b광부 상점" to player

set slot 0 of current inventory of player to coal with lore "&e&l구매 가격: 500원" and "" and "&e&l판매 가격: 250원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 1 of current inventory of player to copper ingot with lore "&e&l구매 가격: 5000원" and "" and "&e&l판매 가격: 2700원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 2 of current inventory of player to iron ingot with lore "&e&l구매 가격: 1200원" and "" and "&e&l판매 가격: 800원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 3 of current inventory of player to gold ingot with lore "&e&l구매 가격: 1500원" and "" and "&e&l판매 가격: 850원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 4 of current inventory of player to diamond with lore "&e&l구매 가격: 3000원" and "" and "&e&l판매 가격: 1600원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 5 of current inventory of player to emerald with lore "&e&l구매 가격: 5000원" and "" and "&e&l판매 가격: 2700원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 6 of current inventory of player to netherite ingot with lore "&e&l구매 가격: 5000원" and "" and "&e&l판매 가격: 2700원" and "&7&l쉬프트+우클릭시 64개 판매"

set slot 7 of current inventory of player to lapis lazuli with lore "&e&l구매 가격: 5000원" and "" and "&e&l판매 가격: 2700원" and "&7&l쉬프트+우클릭시 64개 판매"

라아아아밍
2023.12.25
@웰치포도

어.. 일단 판매가격 로어가 2번째 줄이 아니라 3번째 줄이네요

라아아아밍
2023.12.25
@웰치포도

set {_lore} to uncolored line 3 of lore of clicked item 이렇게 하시면 되지 않을까 합니다

라아아아밍
2023.12.25
@웰치포도

아 아니네요 죄송합니다

라아아아밍
2023.12.25
@웰치포도
if click type is right mouse button with shift:
        set {_lore} to uncolored line 2 of lore of clicked item
        replace all "판매 가격: " and "원" with "" in {_lore}
        set {_lore} to {_lore} parsed as integer
        delete lore of {_item}
        set {_item} to type of {_item}
        if player has 64 of {_item}:
            remove 64 of {_item} from player's inventory
            add {_lore}*64 to {돈.%player%}
            play sound "UI_BUTTON_CLICK" with volume 0.5 to the player
            send "&e64개 판매하였습니다! "
            else:
                message "&c아이템이 부족하여 판매할수없습니다."
                play sound "entity.experience_orb.pickup" with volume 0.5 to the player

이렇게 해보실래요? 아이템의 타입을 가져와서 겹치는 아이템이 없다면 이렇게 하셔도 될 거 같습니다.. 제가 정확히 구현할 수가 없어서 쉽지 않네요..

웰치포도
2023.12.26
@라아아아밍

아 그..한세트씩 말고 아이템 들고있는걸 다 파는게 궁금해서요

예로 아이템 54개만 있으면 54개를 다팔고 150개가 있으면 150개를 한번에 파는게 궁금해서요

라아아아밍
2023.12.26
@웰치포도

아 그거는 브혼님 https://www.koreaminecraft.net/plugin_lecture/1424133 함수를 참고하시면 될 거 같습니다.

웰치포도
2023.12.26
@라아아아밍

오 감삼다

웰치포도
2023.12.27
@라아아아밍

저 혹시

if click type is right mouse button with shift:

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

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

set {_lore} to {_lore} parsed as integer

delete lore of {_item}

set {_amount} to getinventoryitemAmount(inventory of player,{_item})

if {_amount} > 0:

remove {_amount} from player's inventory

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

play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

send "&e64개 판매하였습니다! "

이 구문에서 set {_amount} to getinventoryitemAmount(inventory of player,{_item}) 여기서 {_item} 은 못쓰나요?

자꾸 이 에러가 나요

the function "getinventoryitemAmount" does not exist

라아아아밍
2023.12.27
@웰치포도

저 오류는 getinventoryitemAmount 함수가 없다는 뜻입니다.

스크립트 파일에 글에 있는 함수 복붙을 안 하셨거나 함수 이름에서 대소문자가 잘못된 곳이 있는지 확인해보세요.

웰치포도
2023.12.29
@라아아아밍

그 제가 찾아보면서 다른방법으로 했긴했는데 그 아이템 갯수를 가진만큼 판매하면 가지고있는 아이템갯수만큼의 돈은 들어오는데 가지고있는아이템이 안사라집니다

if click type is right mouse button with shift:

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

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

set {_lore} to {_lore} parsed as integer

delete lore of {_item}

if {_inv} contains {_item}:

set {_amount} to amount of {_item} in {_inv}

remove {_amount} from player's inventory

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

play sound "UI_BUTTON_CLICK" with volume 0.5 to the player

send "&e64개 판매하였습니다! "

else:

message "&c아이템이 부족하여 판매할수없습니다."

play sound "entity.experience_orb.pickup" with volume 0.5 to the player

remove 쪽에 어떻게 해야하나요?

 

 

웰치포도
2023.12.30
@라아아아밍

아 아닙니다 해냈어요!

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