Skip to content

Instantly share code, notes, and snippets.

@aoisensi
Last active January 26, 2024 11:47
Show Gist options
  • Save aoisensi/9484da9cc32e96df615cfc4dcc42a205 to your computer and use it in GitHub Desktop.
Save aoisensi/9484da9cc32e96df615cfc4dcc42a205 to your computer and use it in GitHub Desktop.
/*
Oyasumi Command v1.0.0
by aoisensi
License: WTFPL
使い方
以下のコードをOMORI起動毎にコンソールに丸々コピペすれば準備完了
表示したいスイッチや変数を
oyasumi.printer = "s1,s100,v143";
とコンソールに入力すれば設定できる (これはスイッチ1,100と変数143を表示する設定)
oyasumi.printOn(); で表示開始
oyasumi.printOff(); で表示終了
現状500ミリ秒ごとに表示するようにしている
変えたかったら「いんたーばる」で検索して
*/
(() => {
window.oyasumi = {
printer: "",
};
window.oyasumiState = {
printer: null,
};
window.oyasumi.printOn = () => {
window.oyasumiState.printer = window.oyasumiState.printer || setInterval(() => {
if (!window.oyasumi.printer) {
return;
}
const keys = window.oyasumi.printer.split(",");
for (const key of keys) {
const typ = key.charAt(0);
const n = Number(key.slice(1));
if (typ === "v" || typ === "V") {
const n = Number(key.slice(1));
console.log(`Variable ${String(n).padStart(6, ' ')}: ${$gameVariables.value(n)}`);
}
if (typ === "s" || typ === "S") {
const n = Number(key.slice(1));
console.log(`Switch ${String(n).padStart(6, ' ')}: ${$gameSwitches.value(n)}`);
}
}
}, 500); // いんたーばる
}
window.oyasumi.printOff = () => {
window.oyasumiState.printer && clearInterval(window.oyasumiState.printer);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment