0 votes
asked by (570 points)
edited by

This is a interesting idea I made for a game.

 

I want to make a variable ($Depression) and make it a constant game over possibility.

Example:

<<if $Depression is(ever) gt 100 (and/or) eq 100>>

YOU HAVE BEEN ERASED FROM EXISTENCE!

<<link "BAD END">><<script>>window.close()<</script>><</link>>

 

 

<</if>>

 

Or

<<goto  [[BAD END]]>>

But set up to at anytime it happens, it makes this passage show instead of the desired passage..

 

I dont know how to set up a goto. A cool addition if it only shows the passage for a few seconds then kicks you out of the game

 

I can clarify, but not really too good at making it any simpler

1 Answer

0 votes
answered by (8.5k points)
<<if $Depression gte 100>>
  <<goto [[BAD END]]>>
<</if>>

 

commented by (570 points)
is there a way to add this at the start of the game so if at anytime(or other passages), the variable is 100 it performs the script
commented by (55.9k points)

Throw it in a passage and name that passage PassageReady, and it'll fire just before each passage is rendered. 

http://www.motoslave.net/sugarcube/2/docs/special-names.html#special-passages

commented by (570 points)

This led to a blank, black passage: used he PassageReady passage

 

<<if $Depression gte 100 >>
  <<goto [[BAD END]]>>
<</if>>

 

and

[YOU HAVE BEEN ERASED FROM EXISTENCE!]

<<link "BAD END 0: Forgotten By All">><<script>>window.close()<</script>><</link>>

commented by (55.9k points)

You need to put something in the passage. 

::BAD END
Bad End 0: Forgotten by All... 

[YOU HAVE BEEN ERASED FROM EXISTENCE!]

<<timed 2s>><<run window.close()>><</timed>>

You should probably never assume control of the users browser though, since that's always annoying and always looks like a bug. 

commented by (2.7k points)
To stop it looking like a bug, you could say the following: "This window will close in 3, 2, 1.."
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...