개인 자료란 (JE)

  서버 커뮤니티

Profile 빈수빈수 대표칭호 없음
Profile

질문하기 스크립트

스크립트 한 번만 봐주실 수 있을까요..

2024.06.19 조회 수 63 추천 수 1
이해도 입문자 
게임버전 (JE) 1.20.1 
게임버전 (BE) 관련없음 
스크립트 버전 2.8.5 

스크립트를 배운 적이 없지만 꾸역꾸역 얕은 지식으로 챗지피티와 함께 만들어 가는 중인데 도저히 해결을 못하네요..

베팅까지는 돈이 잘 빠져나가는데 당첨금이 지급이 안됩니다.
디버깅을 해보니 아마 플레이어의 uuid를 인식을 못해서 지급할 때 문제가 있는 것 같습니다.

도와주세요..


# 베팅 시작 명령어

command /베팅시작 <text> <text> [<text>] [<text>] [<text>]:

    trigger:

        if {betting.active} is true:

            send "&c이미 베팅이 진행중입니다!" to player

            stop

        set {betting.active} to true

        set {betting.starter} to uuid of player

        

        # 옵션 리스트 설정

        clear {betting.options::*}

        add argument 1 to {betting.options::*}

        add argument 2 to {betting.options::*}

        if argument 3 is set:

            add argument 3 to {betting.options::*}

        if argument 4 is set:

            add argument 4 to {betting.options::*}

        if argument 5 is set:

            add argument 5 to {betting.options::*}

        

        clear {betting.bets::*}

        clear {betting.players::*}

        clear {betting.totals::*}

        set {betting.total} to 0

        broadcast "&a베팅이 시작되었습니다! 항목은 &e%{betting.options::*}% &a입니다! '/베팅 <항목> <베팅금>'을 통해 베팅하세요!"

        wait 30 seconds

        broadcast "&e베팅이 30초 남았습니다!"

        wait 20 second

        broadcast "&e베팅이 10초 남았습니다!"

        wait 5 seconds

        broadcast "&e베팅이 5초 남았습니다!"

        wait 1 second

        broadcast "&e베팅이 4초 남았습니다!"

        wait 1 second

        broadcast "&e베팅이 3초 남았습니다!"

        wait 1 second

        broadcast "&e베팅이 2초 남았습니다!"

        wait 1 second

        broadcast "&e베팅이 1초 남았습니다!"

        wait 1 second

        broadcast "&c베팅이 마감되었습니다!"

        set {betting.active} to false

        set {betting.ended} to true


# 베팅 명령어

command /베팅 <text> <number>:

    trigger:

        if {betting.active} is not true:

            send "&c베팅이 진행중이지 않습니다!" to player

            stop

        if {betting.options::*} does not contain argument 1:

            send "&c올바르지 않은 항목입니다. 항목은 &e%{betting.options::*}% &c입니다." to player

            stop

        if {돈::%uuid of player%} < argument 2:

            send "&c돈이 부족합니다!" to player

            stop

        remove argument 2 from {돈::%uuid of player%}

        add argument 2 to {betting.bets::%uuid of player%}

        add argument 2 to {betting.total}

        add argument 2 to {betting.totals::%argument 1%}

        set {betting.players::%uuid of player%} to argument 1

        send "&a%argument 2%원을 베팅했습니다! 총 %{betting.bets::%uuid of player%}%원을 베팅하셨습니다!" to player


# 베팅 현황 명령어

command /베팅현황:

    trigger:

        if {betting.active} is not true:

            send "&c베팅이 진행중이지 않습니다!" to player

            stop

        set {_status} to ""

        set {_totalBet} to {betting.total}

        loop {betting.options::*}:

            set {_option} to loop-value

            set {_optionTotal} to {betting.totals::%{_option}%}

            set {_percentage} to 100 * {_optionTotal} / {_totalBet}

            add "%{_option}%: %{_percentage}%, " to {_status}

        set {_playerOption} to {betting.players::%uuid of player%}

        set {_playerBet} to {betting.bets::%uuid of player%}

        set {_playerOptionTotal} to {betting.totals::%{_playerOption}%}

        set {_playerMultiplier} to {_totalBet} / {_playerOptionTotal}

        send "총 판돈은 %{_totalBet}%입니다. %{_playerOption}%의 배율은 %{_playerMultiplier}%입니다." to player


# 베팅 당첨 명령어

command /베팅당첨 <text>:

    trigger:

        if {betting.ended} is not true:

            send "&c아직 베팅이 마감되지 않았습니다!" to player

            stop

        if {betting.starter} is not uuid of player:

            send "&c베팅을 시작한 플레이어만 당첨을 결정할 수 있습니다!" to player

            stop

        if {betting.options::*} does not contain argument 1:

            send "&c올바르지 않은 항목입니다. 항목은 &e%{betting.options::*}% &c입니다." to player

            stop

        

        set {_winningOption} to argument 1

        set {_totalWinningBets} to {betting.totals::%{_winningOption}%}

        broadcast "&a%{_winningOption}%이(가) 승리했습니다!!"

        

        loop {betting.players::*}:

            if {betting.players::%loop-value-1%} is {_winningOption}:

                set {_playerBet} to {betting.bets::%loop-value-1%}

                set {_playerUUID} to loop-value-1

                set {_playerMultiplier} to ({betting.total} * {_playerBet}) / {_totalWinningBets}

                add {_playerMultiplier} to {돈::%{_playerUUID}%}

        

        clear {betting::*}

        set {betting.active} to false

        set {betting.ended} to false



# 베팅 초기화 명령어 (OP 전용)

command /베팅초기화:

    permission: op

    trigger:

        clear {betting::*}

        set {betting.active} to false

        set {betting.ended} to false

        send "&c베팅이 강제로 초기화되었습니다!" to all players





4개의 댓글

windy_wind
2024.06.19

set {betting.players::%uuid of player%} to argument 1

여기서 arg 1이 text 타입입니다. arg 2로 바꿔주세요~

빈수빈수
2024.06.19
@windy_wind

엇 베팅 항목을 설정하는 변수가 맞지 않나요?? 밑에 winningoption 변수랑 비교할려면 arg 1이 맞지 않나요??

arg 2는 베팅금액이에요!

useu
2024.06.22

수정이 필요한 부분이 많아보입니다. 일단 문제가 발생한 부분만 해결하자면

loop {betting.players::*}:

이 부분 아래에서 uuid가 필요한 부분에 loop-value가 아닌 loop-index를 사용하는게 맞습니다.

[/베팅]  명령어 부분을 보시면

set {betting.players::%uuid of player%} to argument 1

index에는 uuid, value에는 항목을 넣었습니다.


아래처럼 변경해보세요.

loop {betting.players::*}:
    if loop-value is {_winningOption}:
        set {_playerBet} to {betting.bets::%loop-index%}
        set {_playerUUID} to loop-index
        set {_playerMultiplier} to ({betting.total} * {_playerBet}) / {_totalWinningBets}
        add {_playerMultiplier} to {돈::%{_playerUUID}%}


빈수빈수
2024.06.25
@useu

바로 되네요 ㅠㅠ 정말정말 감사합니다!!

혹시 말씀하신 다른 수정할 부분은 어떤 문제들이 발생할 수 있는 건가요??

뉴스 및 창작물
사진이 없습니다.

레드스톤

[노트블럭 패러디] 신창섭 - 모장이 다해줬잖아

노트블럭전문가

2024-09-28

0

/files/thumbnails/677/856/003/262x150.crop.jpg?20240913205849

아티클

마인크래프트 개발의 미래

학교가기싫다

2024-09-13

2

사진이 없습니다.

모드

아이리스 쉐이더

gyeol12

2024-09-07

0

/files/thumbnails/382/873/003/262x150.crop.jpg?20240903125347

레드스톤

[노트블럭커버] 숙청행진 - 밀그램

노트블럭전문가

2024-09-03

0

/files/thumbnails/069/864/003/262x150.crop.jpg?20240819102737

레드스톤

[노트블럭커버] 만찬가 - tuki

노트블럭전문가

2024-08-19

1