개인 자료란 (JE)

  서버 커뮤니티

Profile 이득 대표칭호 없음

rodlemrsla 679483ebe5b74c7d80300e2979d5d022

Profile

질문하기 스크립트

주식 스크립트 오류

2023.01.31 조회 수 55 추천 수 0
이해도 입문자 
게임버전 (JE) 1.12.2 
게임버전 (BE) 관련없음 
스크립트 버전 2.5.3 

주식 구매와 판매가 안되는데 무엇이 문제인가요......




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 inventory 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} white stained glass pane

                set slot {_b} {@s} white 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} dark oak sign 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 iname 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:

        delete {주식::*}

Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!

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