Right now I'm using the audio macro. Can I give the reader/player an option to mute all audio? If there is not, can I make an option in the UI bar (below saves and restart) that basically turns a variable off (and also stops all audio) or on so that I can check before playing audio if sound is turned on? I've tried some
#ui-bar and Setting.addToggle stuff but I don't know how to make it work.
I have tried the
Youtube Background Music thing then I found out it's for Twine 1. I guess I'll have to put the audio somewhere else. Most free webhosters seem to have something against hosting music. Obviously some Twine stories do have audio. So where can I upload music for free so that my story can play it?
Comments
The latter can be accomplished by adding a setting to the Settings menu (via the Setting API), which you'd do by placing something like the following in your Story JavaScript: And then checking the setting whenever you wish to play audio. For example:
Github pages allows you to create a repository that can include pretty much anything, including audio and images, and host everything using relative paths.
I can't confirm, but I've also heard that itch.io allows you to upload and access external resources as well.
Story JavaScript: And checking the setting wherever you wish to play audio. For example:
Because as the documentation for the <<back>> macro notes, it undoes history.
Also, it doesn't, not fully. Depending on how you use it the <<remember>> macro really consists of two components: the optional ability to set variables and storing the current value of the given variables so they're automatically reinitialized at story startup. Undoing the moment where the <<remember>> was invoked only reverts the former, not the latter.
Unless you restarted the story while you were attempting to use <<remember>>, you probably never noticed that the storage for automatic reinitialization part was, in fact, working.
That said, as the documentation for the <<remember>> macro notes, you rarely need, or want, to use <<remember>>, as it is only useful in very specific circumstances and problematic in most others. Unless you know that you need to use it, you very likely do not.
Can i create a "cheat" menu using your code, something like:
Setting.addToggle("STREnabled", {
label : "Add +20 Strenght?",
default : false,
onInit : add +20 to variable STR,
});
Then i would repeat the above for every other game variable needed.
Not sure if i can use Javascript to mess directly with Twine's variables...
Thanks in advance for your help.
You could/should simply create a passage to do so via <<link>> macros. For example, a passage named Cheats:
How you display that passage to the player is up to you. You could simply provide a link to it or you could display it via a dialog, like so:
One more thing, if i wanted to "teleport" to a specific passage from inside the Cheats popup/passage would i still use the same code? Example below?
<<link "Go to End Passage">>End Passage<</link>>
I am asking because i tried, saw the link passage on twine from the Cheats Passage to the End Passage, but when clicking nothing happened. I assume the coding must be slightly different.
You don't need anything more than a wiki link (double square bracketed link) to do that. For example:
If you wanted to perform other actions, as well as forwarding the player, then you could use the <<link>> macro like so: