見出し画像

ティラノスクリプトで文字を一括表示させる方法

□方法
[
this.kag.variable.sf._config_ch_speed]の変数を3以下に設定してください

;具体例
;以下のようにiscriptで指定
[iscript]
this.kag.variable.sf._config_ch_speed=1;
[endscript]
;具体例2
;公式のdata>scenario>config.ksから

;------------------------------------------------------------------------------------------------------
; テキスト速度
;------------------------------------------------------------------------------------------------------
	[button name="ch,ch_100" fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[1]"  y="&tf.config_y_ch" exp="tf.set_ch_speed =100; tf.config_num_ch = 0"]
	[button name="ch,ch_80"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[2]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 80; tf.config_num_ch = 1"]
	[button name="ch,ch_50"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[3]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 50; tf.config_num_ch = 2"]
	[button name="ch,ch_40"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[4]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 40; tf.config_num_ch = 3"]
	[button name="ch,ch_30"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[5]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 30; tf.config_num_ch = 4"]
	[button name="ch,ch_25"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[6]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 25; tf.config_num_ch = 5"]
	[button name="ch,ch_20"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[7]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 20; tf.config_num_ch = 6"]
	[button name="ch,ch_11"  fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[8]"  y="&tf.config_y_ch" exp="tf.set_ch_speed = 11; tf.config_num_ch = 7"]
	[button name="ch,ch_8"   fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[9]"  y="&tf.config_y_ch" exp="tf.set_ch_speed =  8; tf.config_num_ch = 8"]
;[exp="tf.set_ch_speed =  1;]でthis.kag.variable.sf._config_ch_speedを1に設定
;尚この改修をした場合他にも修正諸々必要になってくるかもです(私は公式のconfig.ksを使っていないので割愛…)
	[button name="ch,ch_5"   fix="true" target="*ch_speed_change" graphic="&tf.btn_path_off" width="&tf.btn_w" height="&tf.btn_h" x="&tf.config_x[10]" y="&tf.config_y_ch" exp="tf.set_ch_speed =  1; tf.config_num_ch = 9"]

□理由
ティラノスクリプト|スマホ対応のノベルゲームエンジン。無料 (tyrano.jp)
(公式サイトで紹介されているGitHubに飛んで)
Breadcrumbstyranoscript/tyrano/plugins/kag/kag.tag.jsから
2073~2089行目あたり(2024/07/14現在)

        // すべてのテキストを一瞬で表示すべきなら全部表示してさっさと早期リターンしよう
        // 次のいずれかに該当するならすべてのテキストを一瞬で表示すべきである
        // - スキップモード中である
        // - [nowait]中である
        // - 1文字あたりの表示時間が 3 ミリ秒以下である
        if (this.kag.stat.is_skip === true || this.kag.stat.is_nowait || ch_speed <= 3) {
            // 全文字表示
            this.makeAllCharsVisible(j_char_span_children);
            // スキップ時間のタイムアウトを設ける
            $.setTimeout(() => {
                // メッセージウィンドウが隠れていなければ次のタグへ
                if (!this.kag.stat.is_hide_message) {
                    this.kag.ftag.nextOrder();
                }
            }, parseInt(this.kag.config.skipSpeed));
            return;
        }

全文字表示する際の条件として、ch_speed(this.kag.variable.sf._config_ch_speed)の変数が3以下という指定が、あったんですねぇ……(今の今まで知らなかった)
ちなみに、nowaitをtrueにしても確かに一括表示はされましたが、演出面もことごとくスキップされるので、内部挙動がちょっと謎でしたね(nowaitってこいう仕様なんですかね?)
あ、あと[r]タグだと若干ラグがかった動きになるので、そこが気になるとなんらか対応が必要かなとは思いました……(私はそもそもセリフ一つの文字数を短くしたいので、[r]タグを使わないという方針に舵を切ります)

またこれは与太話ですが
一括表示って需要そんな無いんですかね?やり方調べても出てこなくて泣く泣くコード見てたらあっさりと表記があって驚きました。
あと私はテキスト一括表示が無い時「テキスト一括表示させる為にダブルクリック→し過ぎて文章を一文飛ばすor選択肢も飛ばす」みたいな事故をよく起こしていたので、回避策が見つかって本当に嬉しかったです()

この記事が気に入ったらサポートをしてみませんか?