見出し画像

【ティラノスクリプト】ptextで変数を表示するサンプル


①ptextで表示するサンプル

[iscript]

f.test1 = 100;
f.test2 = 'テスト';

[endscript]

[layopt layer="0" visible="true"]

[ptext layer="0" text="&f.test1" x="100" y="100" size="100" color="yellow" bold="bold" edge="black"]
[ptext layer="0" text="&f.test2" x="100" y="200" size="100" color="yellow" bold="bold" edge="black"]

②ステータス画面のサンプル

【scene1.ks】

[iscript]

f.hp = 0;
f.money = 1000;
f.item = 5;

[endscript]

[call storage="status.ks"]

*action

[glink target="*result" text="体力が10上昇" x="377" y="100" width="400" exp="f.hp += 10"]
[glink target="*result" text="体力が10減少" x="377" y="200" width="400" exp="f.hp -= 10"]
[glink target="*result" text="アイテムを1個購入する" x="377" y="300" width="400" exp="f.money -= 100,f.item += 1"]
[glink target="*result" text="アイテムを1個売却する" x="377" y="400" width="400" exp="f.money += 100,f.item -= 1"]

[s]

*result

[call storage="status.ks"]

ステータスが更新されました[p]

[jump target="*action"]

【status.ks】

[layopt layer="fix" visible="true"]

[iscript]

tf.hp = '【体力】 ' + f.hp;
tf.money = '【所持金】 ' + f.money + '円';
tf.item = '【アイテム】 ' + f.item + '個';

[endscript]

[ptext layer="fix" text="&tf.hp" x="0" y="100" size="30" color="yellow" bold="bold" edge="black" name="hp" overwrite="true"]
[ptext layer="fix" text="&tf.money" x="0" y="200" size="30" color="yellow" bold="bold" edge="black" name="money" overwrite="true"]
[ptext layer="fix" text="&tf.item" x="0" y="300" size="30" color="yellow" bold="bold" edge="black" name="item" overwrite="true"]

[return]