Detecting game mode

Discussion in 'Site Feedback' started by robyna, Apr 12, 2021.

Tags:
  1. robyna

    robyna Virgin

    Is there any way we can detect game mode in-game, allowing us to offer different text to those playing the gave vs. those just clicking through? This would be a useful feature.
     
  2. Almax

    Almax Really Experienced

    Yep! You know how you can hide certain things behind a variable? For example:
    {if Strength > 14}"You're lookin' pretty strong dude"{endif}
    (if you don't know about this, here's a good tutorial page)

    Well, all you'd have to do is make a variable that gets added at the start of the story, like "Gamemode = True". Then you can check for that any time you want to add special text. Alternatively, you could just check for something that will ALWAYS be true -- like {if Strength >0} in a story where Strength starts at 1 and can only go up, for example.

    For going the other way, to make text that only people out of Game Mode can see, you can make use of the @. It points out which outcome you want to display on non-game mode states. If you don't use it, then it just takes the else-case. Here's some examples of that:

    {if Strength == 1} First Option! {elseif Strength == 2} Second Option! {else} Third Option! {endif}
    ^this would display "Third Option!" out of Game Mode

    {if@ Strength == 1} First Option! {elseif Strength == 2} Second Option! {else} Third Option! {endif}
    ^this would display "First Option!" out of Game Mode

    {if Strength == 1} First Option! {elseif@ Strength == 2} Second Option! {else} Third Option! {endif}
    ^this would display "Second Option!" out of Game Mode

    So if you want to have something like that, but have it never show up during Game Mode, you can just make up a variable for it. Whenever I do that, which is loads, my go-to is {if@ Gammod == False}, because "Gammod" instead of "Game Mode" makes me smile and because that'll never ever be a real variable. Anything I put between that and the endif will show up to non-Game Mode readers, and will never show up in Game Mode. Hope that answers your question! Lemme know if anything wasn't clear.
     
  3. robyna

    robyna Virgin

    Great idea, Almax. Thanks.
     
    Almax likes this.
  4. Almax

    Almax Really Experienced

    No worries!
     
  5. gene.sis

    gene.sis CHYOA Guru

    You could also use
    Code:
    {if@ nonexistant > 100000}Game Mode not active{else}Game Mode active{endif}
    If the reader hasn't started game mode, they will see the part with the "@"

    If the reader has started game mode, the if-statement will always fail, even if you actually have a variable called "nonexistant". (No variable can be higher than 100000.)