I would like to have a passage similar to this:
Your favorite color is PURPLE and you have a lavender car.
Where someone can click on the bold part, choose between several colors, have the car color change automatically, then be able to change the favorite color (which will then update the car color) as many times as they want before moving on to the next passage.
Is this sort of thing supported in Twine, or would it require reloading the entirety of the passage every time?
Comments
I have no idea how to do this in any other story format, since I am not positive if any other supports simple Javascript use. SugarCube in Twine 1.4 is also the only format that can really easily include a javascript user library.
As Claretta stated, how you implement this functionality depends totally on which Story Format you chose because each Story Format defines it's own macro language, it's own list of core macros, and the core features available to an Author.
You can implement what you want in one of three ways:
1. Using a story format's built in click/link/replace related macros.
This is possible in both Harlowe and SugarCube (1.x and 2.x), although the solution can become quiet complex.
2. Use custom Javascript to extend the story format's core features.
This can be done (one way or another) for all story format, how you do it depends on the story format.
3. Use a third-party Javascript library (like GSAP) to extend the story format.
Not all third-party Javascript libraries work in all (or any) story formats, it depends on how the library and the story format was designed.
Sometimes click/replace inside passages can be overly complex if you can just solve the issue with a quick copy and paste to several passages. I use that technique a fair bit - am not sure why it is looked down on sometimes.