개인 자료란 (JE)

  서버 커뮤니티

Profile Ru_Nan 대표칭호 없음

Ru_Nan 642a599e50ad442cab0e91c0d4d2252a

Profile

질문하기 스크립트

구문 오류

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

aliases:

    one = 5847    

    two = 5857

    three = 5853

    four = 5850

    five = 5848

    six = 5849

    seven = 5854

    eight = 5856

    nine = 5851

    zero = 5852

    plus = 5858

    minus = 5855



chance of 70%:

                set {_n} to 6

            loop {_n} times:

                set {_block} to random element of "one" and "two", "three", "four", "five", "six", "seven", "eight", "nine", "zere"

                set {_slot} to 12 + loop-number

                set slot {_slot} of current inventory of player to {_block}

                play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player

이런식으로 구문을 짰는데 만약 뽑은 블록이 one 이라면 {뽑은수}라는 변수를 1로 지정하고 싶다면

if {_block} element is one:

                    set {뽑은수} 1 

이런식으로 하면 되나요 아님 다르게 if를 짜야 하나요?




7개의 댓글

스크립터브혼
2020.12.19

[Element of ]익스프레션은 리스트 중 한가지 값을 가져옵니다.
사용한 리스트는 텍스트 타입들만 있으므로 {_block}은 텍스트 값를 가지게 됩니다.
텍스트는 텍스트끼리 비교하면 됩니다.

변수에 값을 세팅할 때는 [Change]이펙트의 패턴을 참고하세요.

Ru_Nan
2020.12.19
@스크립터브혼

aliases:

one = 5847

two = 5857

three = 5853

four = 5850

five = 5848

six = 5849

seven = 5854

eight = 5856

nine = 5851

zero = 5852

plus = 5858

minus = 5855

 

on load:

set {나.가격} to 50000

set {너.가격} to 50000

Command /너를위한:

trigger:

if money of player >= {너.가격}:

add -50000 to player's money

send "{@S} 너를 위한 도박 비용으로 5만원이 지출되었습니다."

set {_n} to 5

open chest inventory with 6 rows named "{@S} 너" to player

play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player

set {_slot} to 0

loop all players:

if loop-player is player:

exit 2 sections

set slot {_slot} of current inventory of player to loop-player's head named "%loop-player%"

add 1 to {_slot}

wait 1 tick

set {_w} to a random integer between 0 and {_slot}-1

set {_player} to name of slot {_w} of current inventory

wait 1 second

close inventory to player

send title "&c대상자 : &f%{_player}%" to player for 1 seconds with fadein 1 second and fade out 1 second

wait 3 second

open chest with 3 row named "&4너를위한도박"

play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player

loop 27 times:

set slot 4 of current inventory of player to player's head named "&f[ &c공격대상 &f] %{_player}%"

set slot loop-number - 1 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"

chance of 70%:

set {_n} to 6

loop {_n} times:

set {_n.%player%.%loop-number%} to random element of "one" and "two", "three", "four", "five", "six", "seven", "eight", "nine", "zero"

set {_slot} to 12 + loop-number

set slot {_slot} of current inventory of player to {_n.%player%.%loop-number%}

play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player

if {_block} element is one:

set {_n.%player%.%loop-number%} 1

if {_block} element is two:

set {_n.%player%.%loop-number%} 2

if {_block} element is three:

set {_n.%player%.%loop-number%} 3

if {_block} element is four:

set {_n.%player%.%loop-number%} 4

if {_block} element is five:

set {_n.%player%.%loop-number%} 5

if {_block} element is six:

set {_n.%player%.%loop-number%} 6

if {_block} element is seven:

set {_n.%player%.%loop-number%} 7

if {_block} element is eight:

set {_n.%player%.%loop-number%} 8

if {_block} element is nine:

set {_n.%player%.%loop-number%} 9

if {_block} element is zero:

set {_n.%player%.%loop-number%} 0

if {_n} is 5:

if loop-number is 1:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10000

if loop-number is 2:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 1000

if loop-number is 3:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100

if loop-number is 4:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10

if {_n} is 6:

if loop-number is 1:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100000

if loop-number is 2:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10000

if loop-number is 3:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 1000

if loop-number is 4:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100

if loop-number is 5:

set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10

 

고쳐보았는데 {_block}을 어떻게 바꿔야 할지 모르겠습니다

스크립터브혼
2020.12.19
@Ru_Nan

본문에 스크립트 코드 넣는 방법 - https://www.koreaminecraft.net/scriptqna/2149827

코드 읽을 수 있게 넣어주세요. 어떤것을 수정했고, 어떤 결과가 나왔는지 알려주세요. 저도 뭘 고쳤다는건지 잘 모르겠습니다.


if {_n} is 5: 이것과 같이 if {_value} is "one": 이렇게 비교하면 됩니다.


복잡한 코드를 바로 수정하려 하지마시고 간단한 코드부터, 기본적인 문법부터 차근차근 해보실 필요가 있습니다.
이미 작성자께서 복붙하신 코드에 모두 정답이 들어있습니다.

set의 경우 set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100 와 같습니다.

Ru_Nan
2020.12.19
@스크립터브혼

스크립트의 목적은 5자리또는 6자리로 숫자가 set slot이 되고 그 숫자만큼 랜덤한 상대방의 돈을 깍는 것 입니다

https://serviceapi.nmv.naver.com/flash/convertIframeTag.nhn?vid=2B4B7493A844168F0D2A9356DBC4DB0A7D81&outKey=V1237e036d12a0da1470536f9690ab8977d754f159dfd0733582c36f9690ab8977d75&width=544&height=306

이것을 스크립트로 구현해 보는 것입니다


on load:
    set {나.가격} to 50000
    set {너.가격} to 50000
    
Command /너를위한:
    trigger:
        if money of player >= {너.가격}:
            execute console command "/eco take %player% 50000"
            send "{@S} 너를 위한 도박 비용으로 5만원이 지출되었습니다."
            set {_n} to 5 
            add one to {random::*}
            add two to {random::*}
            add three to {random::*}
            add four to {random::*}
            add five to {random::*}
            add six to {random::*}
            add seven to {random::*}
            add eight to {random::*}
            add nine to {random::*}
            add zero to {random::*}
            open chest inventory with 6 rows named "{@S} 너" to player
            play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player
            set {_slot} to 0
            loop all players:
                if loop-player is player:
                    exit 2 sections
                set slot {_slot} of current inventory of player to loop-player's skull named "%loop-player%"
                add 1 to {_slot}
                wait 1 tick
            set {_w} to a random integer between 0 and {_slot}-1
            set {_player} to name of slot {_w} of current inventory
            wait 1 second
            close inventory to player
            send title "&c대상자 : &f%{_player}%" to player for 1 seconds with fadein 1 second and fade out 1 second
            wait 3 second
            
            open chest inventory with 3 row named "&4너를위한도박" to player
            set slot 0 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 1 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 2 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 3 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 4 of current inventory of player to player's skull named "&f[ &c공격대상 &f] %{_player}%"
            set slot 5 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 6 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 7 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 8 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 9 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 10 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 11 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 12 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 13 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 14 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 15 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 16 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 17 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 18 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 19 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 20 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 21 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 22 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 23 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 24 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 25 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 26 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player
    
            chance of 50%:
                set {_n} to 6
            loop {_n} times:
                set {_n.%player%.%loop-number%} to random element of {random::*}
                set {_slot} to 10 + loop-number
                set slot {_slot} of current inventory of player to {_n.%player%.%loop-number%}
                play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player
                
                if {random::*} is "one":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 1
                if {random::*} is "two":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 2
                if {random::*} is "three":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 3
                if {random::*} is "four":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 4
                if {random::*} is "five":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 5
                if {random::*} is "six":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 6
                if {random::*} is "seven":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 7
                if {random::*} is "eight":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 8
                if {random::*} is "nine":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 9
                if {random::*} is "zero":
                    set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} == 0
                    
                if {_n} is 5:
                    if loop-number is 1:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10000
                    if loop-number is 2:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 1000
                    if loop-number is 3:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100
                    if loop-number is 4:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10
                if {_n} is 6:
                    if loop-number is 1:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100000
                    if loop-number is 2:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10000
                    if loop-number is 3:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 1000
                    if loop-number is 4:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 100
                    if loop-number is 5:
                        set {_n.%player%.%loop-number%} to {_n.%player%.%loop-number%} * 10
                    wait 1 second
            wait 2 second
            open chest inventory with 3 rows named "{@S} +-" to player
            set slot 0 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 1 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 2 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 3 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 4 of current inventory of player to player's skull named "&f[ &c공격대상 &f] %{_player}%"
            set slot 5 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 6 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 7 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 8 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 9 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 10 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 11 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 12 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 14 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 15 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 16 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 17 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 18 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 19 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 20 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 21 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 22 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 23 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 24 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 25 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            set slot 26 of current inventory of player to gray stained glass pane named "&f[ &c도박중 &f]"
            chance of 30%:
                set {_pm} to 1
            loop 6 times:
                set slot 13 of current inventory of player to plus named "&f[ &a플러스 &f]"
                play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player
                wait 3 tick
                set slot 13 of current inventory of player to minus named "&f[ &c마이너스 &f]"
                play sound "BLOCK_NOTE_PLING" with volume 1 and pitch 1 at player
                wait 3 tick
            set {_money} to {_n.%player%.1} + {_n.%player%.2} + {_n.%player%.3} + {_n.%player%.4} + {_n.%player%.5} + {_n.%player%.6}
            if {_pm} is 1:
                set slot 13 of current inventory of player to plus named "&f[ &a플러스 &f]"
                send "{@S} 누군가에 의해 %{_player}%님의 돈이 &a+ %{_money}% 되었습니다" to all players
                add {_money} to player's money
            else:
                set slot 13 of current inventory of player to minus named "&f[ &c마이너스 &f]"
                send "{@S} 누군가에 의해 %{_player}%님의 돈이 &c- %{_money}% 되었습니다" to all players
                add -1 * {_money} to player's money  

            


                

                

                

            

Ru_Nan
2020.12.19
@스크립터브혼

항상 질문에 답해주셔셔 감사합니다

현재 상황과 지금 어떠한 오류가 있는지에 대한 영상을 담은 것 입니다


스크립터브혼
2020.12.20
@Ru_Nan

먼저 말씀드리자면 질문자께서는 아직 해당 기능을 구현할 단계가 아닙니다.

스크립트의 기본적인 자원도 활용하지 못하는데 복잡한 알고리즘을 구현한다는건 불가능합니다.

지금 단계에서는 제가 답을 드리는것이 아니라 만들어드리는 것과 같습니다.


답을 드리는것은 의미가 없고 질문자께서 지금 해야하는것들을 알려드리겠습니다.


1. 스크립트의 구성요소인 이벤트, 컨디션, 이펙트, 익스프레션, 타입에 대해서 찾아보세요.

네이버, 구글에 검색하면 이것들을 설명하는 강좌가 아주 많습니다. 한마포에도 있구요.

강좌에 있는 예문들도 열심히 받아 적고 서버에 적용해보시고요.

각각의 요소가 어떤역할을 하고 어떻게 쓰이는지 알아보세요.


2. 변수의 종류와 쓰임에 대해서 이해하세요.

변수는 생명주기에 따라 '전역'변수와 '지역'변수로 나뉩니다.

저장 개수에 따라 '싱글'변수와 '리스트'변수로 나뉘구요.

상황에 따라 어떤 형태의 변수를 써야하는지 고를 수 있어야 합니다.


3. [스크립트 문서]의 패턴을 보고 코드를 작성 할 수 있어야 합니다.

대괄호[]는 생략 가능한 선택지, 소괄호()는 생략 불가능한 선택지, 세로줄|은 선택 요소 구분자, 퍼센트%는 타입을 의미합니다.

패턴을 보고 예문에 적용해보면서 문서를 어떻게 읽는지 연습하세요.

모든 스크립트 요소는 작성 패턴이 있습니다. 이걸 모르면 스크립트를 다룰 수 없어요.


4. 1~3의 일을 모두 하셨다면 기본설치 되는 예제를 분석하세요.

15개의 기본예제는 위 1~3의 일을 모두 할 수 있어야 분석할 수 있습니다.

또한 예제를 분석할 수 있어야 자신의 아이디어를 스크립트로 구현할 수 있습니다.


현재로서 제가 드릴 답변은 이것뿐입니다.

스크립터브혼
2020.12.20
@Ru_Nan
#// teleport with compass.sk
on rightclick with compass:
    loop blocks above targeted block:
        teleport player to loop-block
        stop trigger

예제분석하는 방법입니다. 예제는 teleport with compass.sk 파일입니다.


> on rightclick with compass:
[on click]이벤트 - 우클릭 패턴 rightclick과 아이템 패턴 with %item% 이 사용됨.
나침반을 들고 오른쪽 클릭을 하면 발생한다.


> loop blocks above targeted block:
[blocks]익스프레션 - blocks %direction% [%locations%] 패턴이 사용됨. 리스트 형태로 반환함
[direction]익스프레션 - 윗쪽을 가르키는 above가 사용됨
[targeted block]익스프레션 - 유저가 바라보는 블록을 반환함
유저가 바라보는 블록의 한칸 위에있는 블록들을 루프한다


> teleport player to loop-block
[Teleport]이펙트 - 엔티티들 특정 위치로 이동
[Event-Player]익스프레션 - 생략 패턴 [event-]가 생략된 형태.
플레이어를 루프한 블록에 이동시킨다.


> stop trigger

[Exit]이펙트 - 생략 패턴 [trigger]가 생략 안된 형태.
코드 진행을 멈춘다.

뉴스 및 창작물
/files/thumbnails/150/925/003/262x150.crop.jpg?20241123005717

건축

응답하라 1988 ?

팀뉴일리시

2024-11-23

3

/files/thumbnails/761/908/003/262x150.crop.jpg?20241025153749

건축

서울 숭례문(崇禮門) 5

KHC

2024-10-25

2

/files/thumbnails/578/899/003/262x150.crop.jpg?20241010142350

건축

경주 월정교 1

KHC

2024-10-10

2

/files/thumbnails/219/899/003/262x150.crop.jpg?20241009200950

건축

송전탑+도시 2

dbasd12

2024-10-09

2

/files/thumbnails/246/898/003/262x150.crop.jpg?20241008102328

레드스톤

단다단 - 오토노케(オトノケ) | 마인크래프트 노트블럭 커버

노트블럭전문가

2024-10-08

1