I’m trying to get Inform to set a variable based on what a JavaScript function returns. This is what’s in my Inform code:
Story mode is a truth state that varies. Story mode is false.
When play begins:
if Vorple is supported:
execute JavaScript command "queryPlayMode()";
if the JavaScript command returned true:
now story mode is true;
say "Test succeeded.";
else:
say "Test failed.";
say "Hello world.";
And my JavaScript:
function queryPlayMode() {
return true;
}
I know it’s calling the function because if I comment it out the interpreter has an error. But that’s all it does. It isn’t changing the variable, and the only text it prints to the screen is “Hello world.” It’s been awhile since I played with Inform so maybe I’m just doing something ridiculous, but I can’t see what’s wrong.