개인 자료란 (JE)

  서버 커뮤니티

Profile Ru_Nan 대표칭호 없음

Ru_Nan 642a599e50ad442cab0e91c0d4d2252a

Profile

질문하기 스크립트

구문 오류

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

variables:

    {stock.hour} = 0

    {stock.min} = 30

    {stock.sec} = 0

    {stock.hour2} = 0

    {stock.min2} = 30

    {stock.sec2} = 0

    {stock.item} = 0


options:

    s: &f[&2게임&f]

    

every 1 second:

    if {stock.hour} > 0:

        if {stock.min} > 0:

            if {stock.sec} > 0:

                remove 1 from {stock.sec}

                

            if {stock.sec} = 0:

                set {stock.sec} to 59

                remove 1 from {stock.min}

                

        if {stock.min} = 0:

            if {stock.sec} > 0:

                remove 1 from {stock.sec}

        

            if {stock.sec} = 0:

                remove 1 from {stock.hour}

                set {stock.min} to 59

            

            

    if {stock.hour} = 0:

        if {stock.min} > 0:

            if {stock.sec} > 0:

                remove 1 from {stock.sec}

                

            if {stock.sec} = 0:

                set {stock.sec} to 59

                remove 1 from {stock.min}

        

        if {stock.min} = 0:

            if {stock.sec} > 0:

                remove 1 from {stock.sec}

                

            if {stock.sec} = 0:

                set {stock.hour} to {stock.hour2}

                set {stock.min} to {stock.min2}

                set {stock.sec} to {stock.sec2}

                broadcast ""

                broadcast "{@s} &귀금속의 &e가격&f이 &c변동&f되었습니다."

                broadcast ""

                loop {stock.item} times:

                    add 1 to {_주식변동}

                    set {_주식가격.%{_주식변동}%} to {stockmoney::%{_주식변동}%}/6

                    set {_퍼센트} to random number between 0 and {_주식가격.%{_주식변동}%}

                    set {_퍼센트} to round {_퍼센트}

                    set {_확률} to random number between 0 and 1

                    if {_확률} < 0.5:

                        remove {_퍼센트} from {stockmoney::%{_주식변동}%}

                        set {stockcnmoney::%{_주식변동}%} to "&c▽ &f%{_퍼센트}% &c원"

                    if {_확률} >= 0.5:

                        add {_퍼센트} to {stockmoney::%{_주식변동}%}

                        set {stockcnmoney::%{_주식변동}%} to "&a△ &f%{_퍼센트}% &c원"

                        

                

every 0.1 second:

    loop all players:

        if inventory name of current inventory of loop-player contains "{@s}":

            set {_item1} to clock named "&a[ &f남은 변동 시간 &a]"

            set line 1 of lore of {_item1} to "&cㄴ &f%{stock.hour}%&e시 &f%{stock.min}%&e분 &f%{stock.sec}%&e초"

            set slot 45 of current inventory of player to {_item1}

            loop {stock.item} times:

                add 1 to {_슬롯}

                add 1 to {_주식개수}

                set slot {_슬롯}-1 of current inventory of loop-player to {stockitem::%{_주식개수}%} named "%{stock::%{_주식개수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주식개수}%}%"

                stop

        

command /주식:

    trigger:

        open chest with 6 row named "{@s}" to player

        set slot 36 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 37 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 38 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 39 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 40 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 41 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 42 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 43 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set slot 44 of current inventory of player to glass pane named "&8[ &f구분선 &8]"

        set {_item1} to clock named "&a[ &f남은 변동 시간 &a]"

        set line 1 of lore of {_item1} to "&cㄴ &f%{stock.hour}%&e시 &f%{stock.min}%&e분 &f%{stock.sec}%&e초"

        set slot 45 of current inventory of player to {_item1}

        set {_item2} to clock named "&c[ &f도움말 &c]"

        set line 1 of lore of {_item2} to "&eㄴ &f좌클릭 시 &e주식&f을 &c구매&f합니다.||&eㄴ &f우클릭 시 &e주식&f을 &c판매&f합니다."

        set slot 49 of current inventory of player to {_item2}

        set {_item3} to clock named "&e[ &f돈 &e]"

        set line 1 of lore of {_item3} to "&cㄴ &f%{money::%player%}% &c원"

        set slot 45 of current inventory of player to {_item3}

        loop {stock.item} times:

            add 1 to {_슬롯}

            add 1 to {_주식개수}

            set slot {_슬롯}-1 of current inventory of player to {stockitem::%{_주식개수}%} named "%{stock::%{_주식개수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주식개수}%}%"

        

command /주식설정 [<text>] [<integer>] [<integer>] [<integer>]:

    permission: stock.op

    trigger:

        if arg 1 is not set:

            message ""

            message "{@s} &f/주식설정 &e추가 &c[&f가격&c] &f- 손에 든 아이템을 &c[&f가격&c] &f의 돈으로 주식에 &e추가&f합니다."

            message "{@s} &f/주식설정 &e시간 &c[&f시&c] [&f분&c] [&f초&c] &f - 주식 변동 시간을 &c[&f시&c] [&f분&c] [&f초&c] &f로 &e설정&f합니다."

            message "{@s} &f/주식설정 &e초기화 &f- 주식 아이템 목록을 &e초기화 &f합니다."

            message ""

            stop

            

        if arg 1 is "추가":

            if arg 2 is set:

                add player's tool's name to {stock::*}

                add player's tool to {stockitem::*}

                add arg-2 to {stockmoney::*}

                add "&8- &f0 &c원" to {stockcnmoney::*}

                add 1 to {stock.item}

                message ""

                message "{@s} &f당신은 %player's tool's name% (이)라는 이름과 &c[ &f%arg-2% &c] &f이라는 가격에 주식을 &e추가&f하였습니다."

                message ""

                stop

            

            else:

                message ""

                message "{@s} &f/주식설정 &e추가 &c[&f가격&c] &f- 손에 든 아이템을 &c[&f가격&c] &f의 돈으로 주식에 &e추가&f합니다."

                message ""

                stop

        

        if arg 1 is "시간":

            if arg 2 is set:

                if arg 3 is set:

                    if arg 4 is set:

                        set {stock.hour} to arg-2

                        set {stock.min} to arg-3

                        set {stock.sec} to arg-4

                        set {stock.hour2} to arg-2

                        set {stock.min2} to arg-3

                        set {stock.sec2} to arg-4

                        message ""

                        message "{@s} &f주식 &c변동 시간&f이 &f%{stock.hour}%&e시 &f%{stock.min}%&e분 &f%{stock.sec}%&e초 &f로 변동되었습니다."

                        message ""

                        stop

                        

                    else:

                        message ""

                        message "{@s} &f/주식설정 &e시간 &c[&f시&c] [&f분&c] [&f초&c] &f - 주식 변동 시간을 &c[&f시&c] [&f분&c] [&f초&c] &f로 &e설정&f합니다."

                        message ""

                        stop

                        

                else:

                    message ""

                    message "{@s} &f/주식설정 &e시간 &c[&f시&c] [&f분&c] [&f초&c] &f - 주식 변동 시간을 &c[&f시&c] [&f분&c] [&f초&c] &f로 &e설정&f합니다."

                    message ""

                    stop

                    

            else:

                message ""

                message "{@s} &f/주식설정 &e시간 &c[&f시&c] [&f분&c] [&f초&c] &f - 주식 변동 시간을 &c[&f시&c] [&f분&c] [&f초&c] &f로 &e설정&f합니다."

                message ""

                stop

            

        if arg 1 is "초기화":

            set {stock.item} to 0

            delete {stock::*}

            delete {stockitem::*}

            delete {stockmoney::*}

            delete {stockcnmoney::*}

            message ""

            message "{@s} &f당신은 &c주식&f을 &e초기화&f를 하셨습니다."

            message ""

            stop


on inventory click:

    if inventory name of current inventory of player is "{@s}":

        cancel event

        if raw slot < 36:

            if click item is not air:

                if click type is "LEFT":

                    if number of air in the player's inventory >= 1:

                        set {_lore::*} to lore of click item split by "||"

                        set {_money} to uncolored {_lore::2}

                        replace all "[" and "가격" and "]" and " " and "원" with "" in {_money}

                        set {_money} to uncolored {_money} parsed as integer

                        if {money::%player%} >= {_money}:

                            remove {_money} from {money::%player%}

                            set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]" with lore "&cㄴ &f%{money::%player%}% &c원"

                            give 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%" to player

                            message ""

                            message "{@s} &f당신은 &e%{_money}% &f원을 사용하여 %{stock::%clicked slot+1%}% &f을 &c구매&f하였습니다."

                            message ""

                            stop

                            

                    else:

                        message ""

                        message "{@s} &f당신의 &e인벤토리&f가 비어있는지 &c확인&f해주시기 바랍니다."

                        message ""

                        stop

                        

                if click type is "RIGHT":

                    if player has 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%":

                        set {_lore::*} to lore of click item split by "||"

                        set {_money} to uncolored {_lore::2}

                        replace all "[" and "가격" and "]" and " " and "원" with "" in {_money}

                        set {_money} to uncolored {_money} parsed as integer

                        remove 1 of {stockitem::%clicked slot+1%} named "%{stock::%clicked slot+1%}%" from player's inventory

                        add {_money} to {money::%player%}

                        set slot 53 of current inventory of player to emerald named "&e[ &f돈 &e]" with lore "&cㄴ &f%{money::%player%}% &c원"

                        message ""

                        message "{@s} &f당신은 %{stock::%clicked slot+1%}% &f을 &c판매&f하여 &e%{_money}% &f를 얻었습니다."

                        message ""

                        stop

에서 이러한 오류가 발생합니다

[20:13:02] [Server thread/ERROR]: There's no world in a periodic event if no world is given in the event (e.g. like 'every hour in "world"') (주식.sk, line 75: set slot 45 of current inventory of player to {_item1}')

[20:13:02] [Server thread/ERROR]: '::%{_주식개수}%} named "%{stock::%{_주식개수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주식개수}%}%"' is not a valid item data (주식.sk, line 79: set slot {_슬롯}-1 of current inventory of loop-player to {stockitem::%{_주식개수}%} named "%{stock::%{_주 식개수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주식개수}%}%"')

[20:13:02] [Server thread/ERROR]: '::%{_주식개수}%} named "%{stock::%{_주식개수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주식개수}%}%"' is not a valid item data (주식.sk, line 106: set slot {_슬롯}-1 of current inventory of player to {stockitem::%{_주식개수}%} named "%{stock::%{_주식개 수}%}%" with lore "||&e[ &f가격 &e] &f%{stockmoney::%{_주식개수}%}% &c원||||&e[ &f가격 변동 &e] &f%{stockcnmoney::%{_주 식개수}%}%"')

[20:13:02] [Server thread/ERROR]: Can't compare a click type with a text (주식.sk, line 186: if click type is "LEFT":')

[20:13:02] [Server thread/ERROR]: Can't compare a click type with a text (주식.sk, line 207: if click type is "RIGHT":')




1개의 댓글

스크립터브혼
2020.12.18

1. periodic event에서는 월드 정보를 받아 올수 없다는 오류입니다.
예를들면 message, send 이펙트에서 to player를 생략해도 플레이어에게 메세지가 전송됩니다.
이것은 이벤트가 기본적으로 플레이어 정보를 가지고 있기때문에 생략 가능합니다.
월드 역시 대부분의 이벤트에서 기본적으로 정보를 가지고 있습니다만,
periodic 이벤트와 같은 몇몇 이벤트는 이러한 기본정보가 없습니다.


2. 아이템 데이터가 잘못된겁니다. 해당 아이템을 생성하는 코드를 따로 만들어 어디가 오류인지 찾으셔야합니다.


3. click type은 text와 비교할수 없다는 오류입니다. [Click Type]이 어떤것들이 있는지 확인해보세요.

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