Skip to content

using plain links instead passage notification

jackdarker edited this page Apr 25, 2021 · 1 revision

executing an action before passage change

If you want to run some code before switching to another passage you should use a normal link instead of a passage-link and call the code in onclick before running window.story.show. This can also be handy if you want to randomly select the next passage to go to.
Note that sometimes you have to wrap the code into a functiondeclaration,call it and surround this call in additional parenthesis ('(function(){...}()') ).
<a0 onclick='(function(){window.story.state.Kor.upMouth+=1;window.story.show("downgrade_Done");}())'>Choose this icon</a>

Clone this wiki locally