0 votes
by (750 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
by (8.9k points)
<<if $Depression gte 100>>
  <<goto [[BAD END]]>>
<</if>>

 

by (750 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
by (63.1k 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

by (750 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>>

by (63.1k 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. 

by (2.7k points)
To stop it looking like a bug, you could say the following: "This window will close in 3, 2, 1.."
...