Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Ideas on a Variable and Events

6 years ago
There is a variable in the story, we'll call it COUNT for now. When different actions are selected by the reader, at different times, the variable value may increase, normally just by one.

What I would like to happen:

When the variable value reaches 3, I would like the user to get a warning text, then get returned to the page they were headed to originally.
When the variable value reaches 5, I would like them taken to a completely different page.

I know how to use the Event feature of the variable, but that (obviously) doesn't allow for additional values. Any ideas on the best way to implement this? I've thought of having an event page that you go to every time the value is greater than 3, but then that page will have to determine if the value is 3 (send warning and return to somewhere), 4-5 (just return), or 6 (continue on to another page), or if that will even work.

I've also tried to think about using two variables, then the both increase every time (that's a pain), but then one could use the event value of 3 and the other 5, but then the warning page would show up more than once (unless I put a script in there to return if it was greater than 3?).

Any easier ways I'm not thinking of here?

Ideas on a Variable and Events

6 years ago
You could put a Global Script in there like the following:

IF %VARIABLE = 3 THEN $DEST := @P100
IF %VARIABLE = 5 THEN $DEST := @P500

Where page 100 is the warning and page 500 is the other page.

You would need a second variable to track the last page (see the Codex article) in order to have a Go Back link in the warning page to return the player to the correct page afterwards.

Ideas on a Variable and Events

6 years ago
Good idea, that might be the simplest way to do that. Thanks!