◆Cobblemon Wiki

MoLang

Molang General Functions

이들은 “표준 함수”입니다.

NameDescriptionUsage
print(message: String)Logs a message into the 마인크래프트 console.q.print('Hello World!')
set_queryIDKIDK
replace(text: String, search: String, replace: String): Stringtext 안의 부분 문자열 search가 등장하는 모든 위치를 replace 값으로 대체합니다.q.replace('Hexxo Worxd!', 'x', 'l')
is_blank(value: MoValue): Double전달된 값이 빈 문자열(비어 있거나 공백뿐인 문자열)이거나 0.0과 같은 double인지 확인합니다.q.isBlank(' ')
run_command(command: String): Double?명령어를 실행합니다. 서버에서만 작동합니다. 클라이언트에서 실행하면 0.0을 반환하고, 성공하면 1.0을 반환합니다.q.run_command('say Hello World')
is_int(val: MoValue): Double1.0을 반환합니다: a value is an integer, 그렇지 않으면 0.0을 반환합니다.q.is_int(1)
is_number(val: MoValue): Double값이 double이면 1.0을 반환하고, 그렇지 않으면 0.0을 반환합니다.q.is_number(3.14)
to_number(value: MoValue): Doubledouble로 변환을 시도하고, 실패하면 0.0을 반환합니다.q.to_number('3.14')
to_int(val: MoValue): Double정수로 변환을 시도하고, 실패하면 0을 반환합니다.q.to_int('3')
to_string(val: MoValue): StringCasts value to a string.q.to_string(123)
do_effect_walks(): Double1.0을 반환합니다: the config has walkingInBattleAnimations set to true, 그렇지 않으면 0.0을 반환합니다.q.do_effect_walks(): Double
random(options: MoValue...)값 목록을 받아 그중 하나를 무작위로 선택합니다.q.random(1, 2, 3, 4, 5)
curve(curveName: String): ObjectValue<(Float) -> Float>curveName에 해당하는 WaveFunction을 반환합니다. (Options found here)q.curve('symmetrical')
array(values: MoValue...): ArrayStruct<MoValue>매개변수로 배열을 만들어 반환합니다.q.array(1, 2, 3, 4, 5)
run_script(identifier: String): MoValueidentifier의 스크립트를 실행합니다. 스크립트 결과를 반환하며, 실패하면 0.0을 반환합니다.q.run_script('cobblemon:npc_battle_cooling_down')
run_molang(expression: String): MoValueMoLang 표현식을 파싱하고, 이를 호출한 MoLang과 같은 컨텍스트에서 해석합니다.q.run_molang('q.print(\'Hello World!\')')
system_time_millis(): Double시스템 시간을 밀리초 단위로 반환합니다.q.system_time_millis()
date_local_time(): String현재 날짜를 “DD/MM/YYYY” 형식으로 반환합니다.q.date_local_time()
date_of(millis: Double): String에포크 밀리초를 받아 “DD/MM/YYYY” 형식으로 변환합니다.q.date_of(1000000)
date_is_after(dateA: String, dateB: String): Double“DD/MM/YYYY” 형식의 날짜 두 개를 받아 첫 번째 날짜가 두 번째 날짜보다 뒤이면 1.0을 반환합니다.q.date_is_after('01/01/2024', '02/01/2024')