Hello everyone!
I have just started using Twine 2 and after some initial experimentation I started my first story in the the story format Snowman 2.0.2.
My question is this: In multiple parts of my story the player revisits the same passages over and over, but with more information than before. I want to hide dialouge options which contain information the player already knows. Sometimes the initial paragraph of the passage may also change depending on where the player comes from.
So far I have been doing that by setting flags after a specific dialouge option was clicked, check them again later on and hide the corresponding option, like so:
<% if (!s.homeKnowledge) { %> 3. \> [[So this home you are talking about is the earth?]] <% } else { %><br><% } %>
This works, but I was wondering whether there are any better or easier ways to do context-sensitive dialouge options?
Similarly, when a player enters a paragraph through different options, like being very pushy or being very understanding, the NPC dialouge will slightly change. I’m also using this to adjust for dialouge that is differently formulated but leads to the same passage. A minor example:
<% if (s.pushy) { %>\> No, sorry. I don't think I can do that. <% } else { %>\> I can't tell you that.<% } %>
So far to do the latter, I have used Javascript to set a flag, when the player is clicking the link for the according dialouge option. However, to do that I have had to use html links in the passages to execute the javascript and then manually jump to a passage with window.story.show()
. This works fine, but has the caveat that the connections aren’t shown anymore in the story graph. Is there any way to execute Javascript when clicking on one of the Twine links, the ones in the double square brackets? They don’t have id’s or similar, so I don’t know how to do that.
Thank you for your suggestions!