SpeechTools
只需一条命令即可创建流畅的自定义对话!
功能包括:
-
完全控制打字速度、变形、震动等更多效果
-
事件系统,允许你在任意时刻运行命令并更改参数
只需一条命令即可完成!
如何使用 SpeechTools
通过在游戏中使用命令 /function speechtools:help 可查看此页面
要创建对话实体,请使用命令:/function speechtools:create {args:{},events:[]}
参数 (ARGUMENTS)
text: 原始字符串,不包含 JSON 元素。例如:args:{text:"Hi there!"}
如需使用引号或撇号,必须输入 \\\" 或 \\\'
(适用于 1.1.1 及更低版本:撇号:\\',引号:\\'\\')
extra: 附加到文本上的任何 JSON 元素(颜色、字体、粗体等)。例如:args:{extra:' "bold":true,"color":"green" '}
duration: 对话消失前的持续时长(整数)。默认值:100
wait: 对话开始前或作为事件间隔的刻度持续时间(整数)。用于多个对话实体在不同时间启动的情况。默认值:0
fade_in: 文本生成时从 0 缩放到显示状态的持续时间。设置为 0 则无过渡动画。默认值:3
fade_out: 对话结束时文本缩小至 0 的持续时间。设置为 0 则无过渡动画。默认值:3
typed: true | false || 文本随时间逐字显示,而非瞬间出现。默认值:true
typed_delay: 打字字符之间的延迟时间,单位为刻度。默认值:2
punctuation_delay: 输入标点符号(.!?:;,)时的额外刻度延迟。逗号使用此延迟的一半。默认值为 typed_delay 的值。
shake: 文本震动效果,数值越高震动越强。建议配合 teleport_duration 调整效果。最大值为 50。默认值:0
teleport_offset: 一组坐标字符串,用于指定传送目标。与 teleport_duration 配合使用以创建滑动效果。例如:args:{teleport_offset:"~ ~2 ~"}
transformation: 格式与展示实体(Display Entity)的变换相同。
Other NBT 你也可以在 args{} 中放入任何其他 text_display 的 NBT 数据,例如 billboard:、background:、text_opacity: 等。
事件 (EVENTS)
若要将事件添加到你的对话实体,可以使用 events[] 字段,如下所示:function speechtools:create {args:{},events:[ {on:40,command:"say test"} ]}
on: 每个事件必需,可通过以下方式指定:
-
on:<number> 在指定的刻度执行事件,例如 on:40 将在第 40 个刻度运行。
-
on:start 当实体生成时执行事件。
-
on:end 当实体的持续时间到期时执行事件。
-
on:type (当 typed:true 时)为每个输入的字符执行事件,忽略空格。旨在实现 Undertale/动物森友会风格的语音效果。
-
on:tick 每个刻度都执行事件。
-
command: 字符串。从对话实体处运行玩家选择的命令。例如:{on:100,command:"function your:function/here"}
-
modify_args: 格式与 'args' 字段相同,可用于更改变换、改变打字速度等。例如:{on:150,modify_args:{typed_delay:10}}
-
pause_on_tick: 整数。如果设置了 on:tick 事件,则暂停该事件这么多刻度。
使用多个事件
只需像这样向事件数组添加内容即可:[{on:start,command:"say hi"},{on:25,modify_args: {shake:10}},{on:50,modify_args:{shake:0}}]
如果要在同一个 on: 条件下添加多个事件,请这样做:[{on:25,command:"say hi",pause_on_tick:5,modify_args: {typed_delay:10}}]
限制
- 目前,你只能拥有单元素文本,这意味着你不能让一段文本处于
italic:true 而其余部分处于 italic:false。相反,你必须使用多个对话实体来实现这种效果。
- 如果激活了
fade_in:,变换将在实体的第 3 个刻度发生,因为在前几个刻度运行时存在不一致性。
欢迎提供任何反馈或建议!
SpeechTools
Create smooth, custom speech with just one command!
Features Include:
-
Full control over typing speed, transformation, shake, and much more
-
Events system allowing you to run commands and change arguments at any point
All it takes is one command!
How to use SpeechTools
This page is viewable in game by using the command /function speechtools:help
To create a speech entity, use the command: /function speechtools:create {args:{},events:[]}
ARGUMENTS
text: Raw string, no json elements. e.g: args:{text:"Hi there!"}
To use quotation marks or apostrophes, you have to type \\\" or \\\'
(for versions 1.1.1 and below: apostrophe:\\' quotation marks:\\'\\')
extra: Any json elements to be attached to the text (color, font, bold etc). e.g: args:{extra:' "bold":true,"color":"green" '}
duration: Integer duration of the speech before disappearing. Default: 100
wait: Integer duration of ticks before the speech starts, or as a pause in events. Used for instances with multiple speech entities which start at different times. Default: 0
fade_in: Duration of how long the text scales up from 0 when spawned. Set to 0 for no interpolation. Default: 3
fade_out: Duration of how long the text scales down to 0 when ending. Set to 0 for no interpolation. Default: 3
typed: true | false || Text is typed out over time instead of instantly appearing. Default: true
typed_delay: Delay between typed letters, in ticks. Default: 2
punctuation_delay: Additional tick delay when punctuation is typed (.!?:;,) Commas use half this delay. Defaults to typed_delay value.
shake: Text shaking effect, higher number, more shake. Experiment with teleport_duration to adjust effect. Max of 50. Default: 0
teleport_offset: String set of coordinates to teleport to. Used with teleport_duration to create a sliding effect. e.g. args:{teleport_offset:"~ ~2 ~"}
transformation: Same format as a display entities transformation.
Other NBT You can also put any other text_display nbt in args{}, e.g. billboard:, background:, text_opacity: etc.
EVENTS
To add events to your speech entity, you can use the events[] field like so: function speechtools:create {args:{},events:[ {on:40,command:"say test"} ]}
on: Required for every event, specified with the following:
-
on:<number> Executes the event on the specified tick, e.g. on:40 would run on the 40th tick.
-
on:start Executes the event when the entity spawns.
-
on:end Executes the event when the entity's duration expires.
-
on:type (when typed:true) Executes the event for every character typed, ignoring spaces. Intended for Undertale/Animal Crossing style voices.
-
on:tick Executes the event every tick.
-
command: String. Runs a command of the players choosing from the speech entity. e.g. {on:100,command:"function your:function/here"}
-
modify_args: Same format as the 'args' field, can be used to change transformation, change typing speed, etc. e.g. {on:150,modify_args:{typed_delay:10}}
-
pause_on_tick: Integer. If an on:tick event is set, pause it for this many ticks.
Using Multiple Events
Simply add to the events array like so: [{on:start,command:"say hi"},{on:25,modify_args: {shake:10}},{on:50,modify_args:{shake:0}}]
If you want to add multiple events to one on: condition, do this: [{on:25,command:"say hi",pause_on_tick:5,modify_args: {typed_delay:10}}]
Limitations
- As of right now, you can only have single element text, meaning you can't have one section of text in
italic:true and the rest in italic:false . Instead you have to use multiple speech entities to achieve this effect.
- If
fade_in: is activated, the transformation will take place on tick 3 of the entity, due to inconsistencies when ran on earlier ticks.
Any feedback/tips are appreciated!
评论 0
登录后参与评分
还没有评论,来抢沙发吧