見出し画像

【ティラノスクリプト】全てのゲーム変数にまとめて数値を代入するサンプル

[iscript]
Object.keys(f).forEach(function(key) {
  f[key] = 0;
});
[endscript]

今回は、全てのゲーム変数にまとめて0を代入しています。

【scene1.ks】

[iscript]

f.test1 = 1;
f.test2 = 2;
f.test3 = 3;
f.test4 = 4;
f.test5 = 5;

[endscript]

【test1】[emb exp="f.test1"][p]
【test2】[emb exp="f.test2"][p]
【test3】[emb exp="f.test3"][p]
【test4】[emb exp="f.test4"][p]
【test5】[emb exp="f.test5"][p]

[iscript]

Object.keys(f).forEach(function(key) {
  f[key] = 0;
});

[endscript]

【test1】[emb exp="f.test1"][p]
【test2】[emb exp="f.test2"][p]
【test3】[emb exp="f.test3"][p]
【test4】[emb exp="f.test4"][p]
【test5】[emb exp="f.test5"][p]

[s]