Skip to content
Snippets Groups Projects
Commit 254e3a67 authored by Skriv's avatar Skriv
Browse files

== to ===

parent 7349b8cb
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ Macro.add("textbox2", { ...@@ -4,7 +4,7 @@ Macro.add("textbox2", {
const e = []; const e = [];
return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error(`no ${ e.join(" or ") } specified`); return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error(`no ${ e.join(" or ") } specified`);
} }
if ("string" != typeof this.args[0]) return this.error("variable name argument is not a string"); if ("string" !== typeof this.args[0]) return this.error("variable name argument is not a string");
const t = this.args[0].trim(); const t = this.args[0].trim();
if ("$" !== t[0] && "_" !== t[0]) return this.error(`variable name "${ this.args[0] }" is missing its sigil ($ or _)`); if ("$" !== t[0] && "_" !== t[0]) return this.error(`variable name "${ this.args[0] }" is missing its sigil ($ or _)`);
Config.debug && this.debugView.modes({ Config.debug && this.debugView.modes({
...@@ -45,15 +45,16 @@ Macro.add("textbox2", { ...@@ -45,15 +45,16 @@ Macro.add("textbox2", {
Scripting.evalTwineScript(setargs); Scripting.evalTwineScript(setargs);
} }
Engine.play(passage); Engine.play(passage);
if (currentPassage == passage) { if (currentPassage === passage) {
Scripting.evalJavaScript(`window.scrollTo(0, ${ currentScrollPosition });`); Scripting.evalJavaScript(`window.scrollTo(0, ${ currentScrollPosition });`);
} }
} }
} }
function valueToNumberIfSame(v) { function valueToNumberIfSame(v) {
if (!isNumber) if (!isNumber) {
return v; // Do nothing return v;
} // Do nothing
try { try {
return parseInt(v, 10); return parseInt(v, 10);
} catch (e) { } catch (e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment