개인 자료란 (JE)

  서버 커뮤니티

Profile 심심한사람2 대표칭호 없음

Posy09 fca569d92e65449db72618540475732a

Profile

질문하기 스크립트

주식 스크립트 오류

2023.12.28 조회 수 39 추천 수 0
이해도 초보자 
게임버전 (JE) 1.20.1 
게임버전 (BE) 관련없음 
스크립트 버전 2.7.3 

#made by 장인돌이

#무단배포 금지

#서버에 맞게 변형하여 사용하세요!

#유튜브 구독 부탁드려요~!

#유튜브 채널 : https://www.youtube.com/channel/UC2BxiMLDuHjzbP41syXTT8Q

#if inventory name of current inventory of player contains

#위 구문은 스크립트 자체적 오류로 인해 사용불가하여 아래구문으로 대체

#if iname contains(인벤클릭할때), if icname contains(인벤닫을때) by SkChoke애드온

#SkChoke애드온 다운로드 주소 https://www.spigotmc.org/resources/skchoke.70314/

#위 글은 절대 지우지 말것!

#적발시 스크립트 공유 전면 중단합니다!

#명령어 목록

#/주식추가 [주식이름] [주식갯수] [주식가격]

#/주식제거 [주식이름]

#/주식목록

#/주식변동시간설정 [분]

#/주식초기화

#기본적인 주식 변수 형태

#{주식::목록::이름}

#{주식::목록::이름::최대갯수}

#{주식::목록::이름::현재갯수}

#{주식::목록::이름::상장가}

#{주식::목록::이름::매매가}

#{주식::목록::이름::상한가}

#{주식::목록::이름::하한가}

#{주식::목록::이름::최대변동가}

#{주식::목록::변동시간}

#{주식::목록::변동시간::분}

#{주식::목록::변동시간::초}

options:

    c : &6[&e시스템&6]&f

    s : of current inventory of player to

    s2 : of current inventory of loop-player to

    

#주식을 추가시기는 구문 /주식추가 [주식이름] [주식갯수] [주식가격]

command /주식추가 [<text>] [<number>] [<number>]:

    trigger:

        if player is op:

            if arg 1 is set:

                if arg 2 is set:

                    if size of {주식::목록::*} < 7:

                        delete {주식::목록::%arg 1%::*}

                        set {주식::목록::%arg 1%} to paper

                        set {주식::목록::%arg 1%::상장가} to arg 3

                        set {주식::목록::%arg 1%::매매가} to arg 3

                        set {주식::목록::%arg 1%::상한가} to arg 3

                        set {주식::목록::%arg 1%::하한가} to arg 3

                        set {주식::목록::%arg 1%::최대변동가} to arg 3

                        set {주식::목록::%arg 1%::최대갯수} to arg 2

                        set {주식::목록::%arg 1%::현재갯수} to arg 2

                        set {주식::목록::%arg 1%::기록::1} to "&f기록 없음"

                        message "{@c} 주식을 생성하였습니다."

                        message "{@c} 주식명 : &f%arg 1%"

                        message "{@c} 상장가 : &f%arg 3%원"

                        message "{@c} 수 량 : &f%arg 2%개"

            else:

                message "{@c} &f - /주식추가 [주식이름] [주식갯수] [주식가격]"

#주식을 제거하는 구문 /주식제거 [주식이름]

command /주식제거 [<text>]:

    trigger:

        if player is op:

            delete {주식::목록::%arg 1%}

            delete {주식::목록::%arg 1%::*}

            message "{@c} 주식이 제거되었습니다."

                

#주식가격의 변동시간을 설정하는 구문(단위:분)              

command /주식변동시간설정 [<integer>]:

    trigger:

        if player is op:

            if arg 1 is set:

                set {주식::변동시간} to arg 1

                broadcast "{@c} 주식변동시간을 %arg 1%분으로 변경되었습니다."

                broadcast "{@c} 다음 쿨타임부터 변경된 시간으로 적용됩니다."

            else:

                message "&f - /주식변동시간설정 [분]"

#주식 목록을 오픈하는 구문

command /주식목록:

    trigger:

        set {_a} to 0

        set {_b} to 17

        open chest with 3 rows named "&6주식목록" to player

        while name of current inventory of player is "&6주식목록":

            set {_a} to 0

            set {_b} to 17

            loop 10 times:

                if {_a} is not 4:

                    set slot {_a} {@s} black stained glass pane

                set slot {_b} {@s} black stained glass pane

                add 1 to {_a}

                add 1 to {_b}

            set {_c} to 10

            loop {주식::목록::*}:

                if {_c} < 17:

                    set slot {_c} {@s} loop-value named "&6%loop-index%" with lore " " and "&6[잔여주식]" and "&f▶ %{주식::목록::%loop-index%::현재갯수}%/%{주식::목록::%loop-index%::최대갯수}%개" and " " and "&6[가격정보]" and "&e▶ 상장가 : %{주식::목록::%loop-index%::상장가}%" and "&f▶ 매매가 : %{주식::목록::%loop-index%::매매가}%원" and "&a▶ 상한가 : ▲%{주식::목록::%loop-index%::상한가}%원" and "&c▶ 하한가 : ▼%{주식::목록::%loop-index%::하한가}%원" and " " and "&6[변동기록]" and {주식::목록::%loop-index%::기록::*}

                    add 1 to {_c}

            set slot 4 {@s} clock named "&6다음 변동까지 남은시간" with lore "&f%{주식::변동시간::분}%분 &f%{주식::변동시간::초}%초"

            wait 1 tick

#주식가격을 변동시키는 쿨타임 구문

every 1 second:

    if {주식::변동시간} is set:

        if {주식::변동시간::분} is set:

            if {주식::변동시간::초} is not set:

                subtract 1 from {주식::변동시간::분}

                set {주식::변동시간::초} to 59

            else:

                if {주식::변동시간::초} > -1:

                    subtract 1 from {주식::변동시간::초}

                if {주식::변동시간::초} = -1:

                    if {주식::변동시간::분} >= 0:

                        subtract 1 from {주식::변동시간::분}

                        set {주식::변동시간::초} to 59

                    if {주식::변동시간::분} = -1:

                        set {주식::변동시간::분} to {주식::변동시간}-1

                        set {주식::변동시간::완료} to true

                        execute console command "가격변동"

        else:

            set {주식::변동시간::분} to {주식::변동시간}

#주식가격을 변동시키는 명령어(수동으로 가능)       

command /가격변동:

    trigger:

        if {주식::변동시간::완료} is true:

            delete {주식::변동시간::완료}

            set {_a} to 1

            loop {주식::목록::*}:

                set {_변동최대치} to {주식::목록::%loop-index%::최대변동가}

                #가격변동 확률 높을수로 가격↑확률 증가

                chance of 50%:

                    set {_변동가} to random integer between 1 and {_변동최대치}

                    add {_변동가} to {주식::목록::%loop-index%::매매가}

                    if {주식::목록::%loop-index%::매매가} > {주식::목록::%loop-index%::상한가}:

                        set {주식::목록::%loop-index%::상한가} to {주식::목록::%loop-index%::매매가}

                    #변동 기록을 저장하는 구문 아래 임시변수({_b})의 값과 루프값의 따라 최대 저장한도 변경

                    set {_b} to 9

                    if {주식::목록::%loop-index%::기록::1} is not "&f기록 없음":

                        loop 9 times:

                            set {_c} to {_b}+1

                            set {주식::목록::%loop-index%::기록::%{_c}%} to {주식::목록::%loop-index%::기록::%{_b}%}

                            subtract 1 from {_b}

                        set {주식::목록::%loop-index%::기록::1} to "&a▲%{_변동가}%원"

                    else:

                        set {주식::목록::%loop-index%::기록::1} to "&a▲%{_변동가}%원"

                else:

                    set {_변동가} to random integer between 1 and {주식::목록::%loop-index%::매매가}

                    subtract {_변동가} from {주식::목록::%loop-index%::매매가}

                    if {주식::목록::%loop-index%::매매가} < {주식::목록::%loop-index%::하한가}:

                        set {주식::목록::%loop-index%::하한가} to {주식::목록::%loop-index%::매매가}

                    #변동 기록을 저장하는 구문 아래 임시변수({_b})의 값과 루프값의 따라 최대 저장한도 변경

                    set {_b} to 9

                    if {주식::목록::%loop-index%::기록::1} is not "&f기록 없음":

                        loop 9 times:

                            set {_c} to {_b}+1

                            set {주식::목록::%loop-index%::기록::%{_c}%} to {주식::목록::%loop-index%::기록::%{_b}%}

                            subtract 1 from {_b}

                        set {주식::목록::%loop-index%::기록::1} to "&c▼%{_변동가}%원"

                    else:

                        set {주식::목록::%loop-index%::기록::1} to "&c▼%{_변동가}%원"

            broadcast "{@c} 주식가격이 변경되었습니다!"

        

#주식을 사거나 파는 구문

on inventory click:

    #if name of current inventory contains "&6주식목록":

    if inventory name of current inventory of player contains "&6주식목록":

        if clicked raw slot is between 10 and 16:

            cancel event

            loop {주식::목록::*}:

                if name of clicked item contains loop-index:

                    if click type is right mouse button:

                        if {주식::목록::%loop-index%::현재갯수} >= 1:

                            if player has space for 1 of loop-value named loop-index:

                                if {%uuid of player%.돈} >= {주식::목록::%loop-index%::매매가}:

                                    subtract 1 from {주식::목록::%loop-index%::현재갯수}

                                    subtract {주식::목록::%loop-index%::매매가} from {%uuid of player%.돈}

                                    give player 1 of loop-value named "&6%loop-index%"

                    if click type is right mouse button with shift:

                        if {주식::목록::%loop-index%::현재갯수} >= 10:

                            if player has space for 10 of loop-value named loop-index:

                                if {%uuid of player%.돈} >= {주식::목록::%loop-index%::매매가}*10:

                                    subtract 10 from {주식::목록::%loop-index%::현재갯수}

                                    subtract {주식::목록::%loop-index%::매매가}*10 from {%uuid of player%.돈}

                                    give player 10 of loop-value named "&6%loop-index%"

                    if click type is left mouse button:

                        if player has 1 of loop-value named "&6%loop-index%":

                            add 1 to {주식::목록::%loop-index%::현재갯수}

                            add {주식::목록::%loop-index%::매매가} to {%uuid of player%.돈}

                            remove 1 of loop-value named "&6%loop-index%" from player's inventory

                    if click type is left mouse button with shift:

                        if player has 10 of loop-value named "&6%loop-index%":

                            add 10 to {주식::목록::%loop-index%::현재갯수}

                            add {주식::목록::%loop-index%::매매가}*10 to {%uuid of player%.돈}

                            remove 10 of loop-value named "&6%loop-index%" from player's inventory

        else:

            cancel event

            

#모든 주식정보를 초기화 하는구문

command /주식초기화:

    trigger:

        if player is op:

            delete {주식::*}


위의 스크립트를 넣을 경우 다른 기능은 정상 작동하는데 버킷에서 아래의 문구가 뜹니다

인벤토리 인식? 뭐 그런거라고 열심히 찾아봤는데 잘 모르겠어요 ㅠㅠ...

In 1.13+ you cannot get the title name of an inventory outside of an InventoryClickEvent, Only if this inventory has an InventoryHolder may it be used in this state.

+

168번 구문으로 변경시 오류가 뜨다가 안뜨다가 그러고

 if name of current inventory contains "&6주식목록":

169번 원래 구문으로 변경시 위의 1.13 오류가 납니다

 if inventory name of current inventory of player contains "&6주식목록":


1개의 댓글

코코냐
2023.12.29

바꿔도 문제가 되는 구문이 들어간건 똑같기 떄문입니다. 오류 내용을 해석해보세요.

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