Please specify version and format if asking for help, or apply optional tags above:
Twine Version: version 2.3.13
Story Format: SugarCube 2.35.0
Hi, I am really new in Twine. My game consists in a very simple list of choices, which at the end shows several images. It worked in Harlowe just fine, but I wanted to make it more appealing and switched to SugarCube.
What I want to do with those images is explained in the following links:
That’s a twofold issue: getting your function in-scope and waiting until your element is attached to the page. There are a few ways to resolve both parts.
For the former, the simplest is probably to just make the functions auto-globals. Assuming you pasted the JavaScript into your project’s Story JavaScript section, all you need to do is add something like the following after the function body:
window.function_name = function_name;
For example, for magnify():
window.magnify = magnify;
For the latter, after having completed the above, your <<script>> example should work with one small tweak: