# Linking scenes to hidden pages in the Stats Screen

**URL:** <https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598>\
**Category:** ChoiceScript Help\
**Created:** [June 5, 2020, 6:26am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598 "2020-06-05T06:26:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheChaosArchivist](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/thechaosarchivist/32/162222_2.png) [@TheChaosArchivist](https://forum.choiceofgames.com/u/TheChaosArchivist)\
**Post date:** [June 5, 2020, 6:26am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/1 "2020-06-05T06:26:14Z")

</div>

Hello, everyone!

This topic may have been covered already (I’ve been reading a lot and I can’t seem to find the answer I’m looking for), and thought I’d put it up here. I’m quite confused, at this point, and have decided I’ll turn to the much wiser people in our lovely community.

My idea is this - in the stats screen, I only want certain ‘pages’ to show up once at certain points. Like, I don’t want the relationship page showing up until the player meets the first NPC in the game. Or, if the character reads a certain page in a book, that page will then be available to reread in the stats screen as additional reading.

I want backstory and lore stored as “found items” in the stats screen, as “choices” they can read. But I don’t know how to set the choices as invisible until they’ve been found! And I know it can be done - I’ve read a few stories where that happens and I _really_ love how plays in the game. That way I have to _play_ the game in order to learn about what’s happening in the background.

Help, please!

---

<div class="post-metadata">

**Author:** ![moonfungus](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/moonfungus/32/123197_2.png) [@moonfungus](https://forum.choiceofgames.com/u/moonfungus)\
**Post date:** [June 5, 2020, 6:38am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/2 "2020-06-05T06:38:05Z")

</div>

You could try using `*if` & `*elseif` to do that.

As in, let’s take that X content is not supposed to be seen by the reader until they reach a certain page.

What I would do, is that create a new boolean variable which would act as a condition for the X content to appear in the stats page. Like;

```
*create x_content false

```

Then when the reader would reach that certain page, I would “activate” `x_content` by setting it to “true”. So;

```
*set x_content true

```

Meanwhile in the stats screen;

```
*if (x_content)
  #X Content
    Blah Blah Blah.

```

So you have X content available if the reader reaches that certain point in the stats screen. You could do the same with backstory and items like that.

Sorry if you couldn’t understand this, English and coding are not my strongest suit 😅

Or basically what @MonkeyLottery said 😅

---

<div class="post-metadata">

**Author:** ![MonkeyLottery](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/monkeylottery/32/138005_2.png) [@MonkeyLottery](https://forum.choiceofgames.com/u/MonkeyLottery)\
**Post date:** [June 5, 2020, 6:39am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/3 "2020-06-05T06:39:58Z")

</div>

Both problems can be easily solved with the \*if statement

```
*create book_read false
*create relationships_unlocked false

*fake_choice 
 *if (book_read = true) #Book 
  *goto book 
 *if (relationships_unlocked = true) #Relationships 
  *goto relationships 

```

---

<div class="post-metadata">

**Author:** ![Hazel](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/hazel/32/77796_2.png) [@Hazel](https://forum.choiceofgames.com/u/Hazel)\
**Post date:** [June 5, 2020, 8:00am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/4 "2020-06-05T08:00:41Z")

</div>

There are two simple ways to accomplish this. First, you could set your relationship stats to an initial value of zero. If you use [Fairmath](https://choicescriptdev.fandom.com/wiki/Arithmetic_operators#Fairmath), then the stat will _never again_ be at a zero value, except right at the beginning of the game, because Fairmath is percentage-based.

`*create bob_relationship 0`

When you introduce the character, you set their initial relationship. This has to be a positive number, both to make the chart work properly, and because Fairmath only works correctly on percentage numbers, 1-99.

```
You meet Bob from accounting at the office mixer.
*set bob_relationship 10

```

Then you set your stat chart to only show when the variable has a non-negative value.

```
*if (bob_relationship > 0)
    *stat_chart
        percent bob_relationship Bob from accounting

```

This method is simple because it doesn’t require creating any more variables than you already have, but you do need to set the initial value of the variable outright, like `*set bob_relationship 10`, and thereafter, only alter it through Fairmath, to make sure it stays non-zero, like `*set bob_relationship %+ 10`.

If you want more freedom to set your variable to any sort of value, at any point in the game, you can instead create a [boolean flag](https://www.techopedia.com/definition/5495/boolean). I often do this. You’ll have the `bob_relationship` variable, that always has a numeric value, and then you’ll have another variable, let’s give it an intuitive name like `met_bob`. You create it with the value `false`, because the MC hasn’t met Bob. When you write the scene where the player meets Bob, you set the variable to `true`. Then your stat chart looks something like this:

```
*if (met_bob)
    *stat_chart
        percent bob_relationship Bob from accounting

```

It’s extra work, and it might seem silly to create a whole variable that only gets set twice, but it also makes the code more **readable**. Being able to tell at a glance what’s going on in your code will become more and more valuable, the longer your game gets.

---

<div class="post-metadata">

**Author:** ![TheChaosArchivist](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/thechaosarchivist/32/162222_2.png) [@TheChaosArchivist](https://forum.choiceofgames.com/u/TheChaosArchivist)\
**Post date:** [June 6, 2020, 4:34am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/5 "2020-06-06T04:34:52Z")

</div>

Everyone poses some good options here. Is it possible to open a scene in the stats?

---

<div class="post-metadata">

**Author:** ![moonfungus](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/moonfungus/32/123197_2.png) [@moonfungus](https://forum.choiceofgames.com/u/moonfungus)\
**Post date:** [June 6, 2020, 4:47am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/6 "2020-06-06T04:47:20Z")

</div>

If you mean a scene file, then yes, you can use `*goto_scene` for that.

---

<div class="post-metadata">

**Author:** ![TheChaosArchivist](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/thechaosarchivist/32/162222_2.png) [@TheChaosArchivist](https://forum.choiceofgames.com/u/TheChaosArchivist)\
**Post date:** [June 6, 2020, 4:52am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/7 "2020-06-06T04:52:35Z")

</div>

I thought as much, but, every time I try to do so, I get this message:

“Cannot read property ‘endLine’ of undefined”

When I put it like this:

\*fake\_choice  
–\*if (relationships\_unlocked = true) #Relationships  
----\*goto\_scene relationships

Not sure what I’m supposed to do to make a hidden page in the stat screen show up. I’m fairly sure it’s something simple I’m missing, but I’ve trying to figure this out for a few days, now. It works once I reach the point in the story where relationships\_unlocked gets switched from false to true — but if I try to put it there BEFORE it happens, my stat screen breaks

---

<div class="post-metadata">

**Author:** ![moonfungus](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/moonfungus/32/123197_2.png) [@moonfungus](https://forum.choiceofgames.com/u/moonfungus)\
**Post date:** [June 6, 2020, 5:09am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/8 "2020-06-06T05:09:53Z")

</div>

You can’t use `*fake_choice` while using `*goto_scene`, `*goto` or `*finish` at the same time. You have to use `*choice` for that.

---

<div class="post-metadata">

**Author:** ![TheChaosArchivist](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/thechaosarchivist/32/162222_2.png) [@TheChaosArchivist](https://forum.choiceofgames.com/u/TheChaosArchivist)\
**Post date:** [June 6, 2020, 5:13am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/9 "2020-06-06T05:13:27Z")

</div>

I think I may have figured it out.

I’m using the fake\_choice so far, but as long as I don’t have the “if” condition in it, I can direct it towards a scene and then apply the _if_ parameters there (making hidden data inside the scenes and having them revealed only a step at a time). It is good to know, however, that a fake choice and goto\_scene don’t work together.

---

<div class="post-metadata">

**Author:** ![moonfungus](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/moonfungus/32/123197_2.png) [@moonfungus](https://forum.choiceofgames.com/u/moonfungus)\
**Post date:** [June 6, 2020, 5:17am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/10 "2020-06-06T05:17:51Z")

</div>

> [@TheChaosArchivist](#):
>
> but as long as I don’t have the “if” condition in it, I can direct it towards a scene and then apply the _if_ parameters there (making hidden data inside the scenes and having them revealed only a step at a time).

Yeah, I think it’s an efficient way to do that than to make a whole file act like it doesn’t exist. Oh wait, every scene files _do_ act like that 😂

Just do whatever you believe would work. Nobody can judge you on the code you write, since it’s behind the scenes stuff.

---

<div class="post-metadata">

**Author:** ![Kaelyn](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kaelyn/32/141616_2.png) [@Kaelyn](https://forum.choiceofgames.com/u/Kaelyn)\
**Post date:** [June 6, 2020, 5:22am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/11 "2020-06-06T05:22:39Z")

</div>

I am still figuring out, what you really want. It might be, that my stat page could be like that. You could take a look at the Stats page here:  
[Look for the stats](https://dashingdon.com/play/kaelyn-micanna/modern-crusoe/mygame/)  
If you click in the Relationships part of the Stats you see its empty, yet.  
When that is kind of what you want, I can post the code here.

---

<div class="post-metadata">

**Author:** ![TheChaosArchivist](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/thechaosarchivist/32/162222_2.png) [@TheChaosArchivist](https://forum.choiceofgames.com/u/TheChaosArchivist)\
**Post date:** [June 6, 2020, 5:31am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/12 "2020-06-06T05:31:12Z")

</div>

> [@moonfungus](#):
>
> Oh wait, every scene files _do_ act like that 😂

They do act like they’re invisible! I have a few scene files that are notes to myself and don’t really connect to the rest of the writing because all my content is defined by my scene\_list and by \*goto\_scene commands littered _everywhere_. I’m thinking I’m going to be using goto\_scene commands for a lot of things, actually. Sure, my scene list is gonna be _enormous_, but as long as I have it structured…then that’s what counts, no?

> [@Kaelyn](#):
>
> If you click in the Relationships part of the Stats you see its empty

I did notice that, yes. If you are willing, I’d like to see the code for that and see if it resembles what mine is shaping up to be (several days with little sleep does wonders for the Muse, it seems - which makes no sense, but one should not look a gift horse in the mouth)

---

<div class="post-metadata">

**Author:** ![Kaelyn](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kaelyn/32/141616_2.png) [@Kaelyn](https://forum.choiceofgames.com/u/Kaelyn)\
**Post date:** [June 6, 2020, 5:43am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/13 "2020-06-06T05:43:41Z")

</div>

I’ll post it in a few hours, when I am back from work.

---

<div class="post-metadata">

**Author:** ![MonkeyLottery](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/monkeylottery/32/138005_2.png) [@MonkeyLottery](https://forum.choiceofgames.com/u/MonkeyLottery)\
**Post date:** [June 6, 2020, 6:05am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/14 "2020-06-06T06:05:41Z")

</div>

There are two ways: using \*goto\_scene (just as @moonfungus here said) and \*redirect\_scene.

Do note that when using \*goto\_scene, you will not exit the stats screen. If you’re in the stats screen and use the \*goto\_scene command, you will still have the “return to game” button on top and all that.

\*redirect\_scene is used if you want to exit the stats screen. It behaves exactly the same as \*goto\_scene, but it’s only exclusive to the stats screen. Any scene accessed through this command will make the reader exit the stats screen.

---

<div class="post-metadata">

**Author:** ![G-Man](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/g-man/32/255484_2.png) [@G-Man](https://forum.choiceofgames.com/u/G-Man)\
**Post date:** [June 6, 2020, 6:51am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/15 "2020-06-06T06:51:12Z")

</div>

There’s a way easier solution. I created a first scene that teaches reader the mechanics, lore etc (all stuff I need them to know)

When I wanted to hide something, I’ve hid it in the scene when it’s neccessary. For example, MC’s will have the chance of buying armored cars. It’s not included in very first scene but whenever they buy a car, they’ll see a little info in page about these.

Sure, it makes reader impossible to return and recheck but it’s way better than dealing with that

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [June 6, 2020, 7:51am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/16 "2020-06-06T07:51:54Z")

</div>

Note: Never use `*goto_scene` in your `choicescriptstats.txt`. It can cause bugs, especially on certain iOS devices where part of their screen is dedicated to displaying stats screen (kinda like supplemental RPG sheet). Use simple `*goto` instead.

---

<div class="post-metadata">

**Author:** ![Hazel](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/hazel/32/77796_2.png) [@Hazel](https://forum.choiceofgames.com/u/Hazel)\
**Post date:** [June 6, 2020, 8:35am UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/17 "2020-06-06T08:35:02Z")

</div>

My stats screen might be a tad long/confusing if I link the whole thing, but I use a choice menu at the end of the stats page, combined with labels and `*goto` statements, and that allows me to have several “logical” stat screens within the same text file.

The menu looks like this:

```
*label navigation_menu

*choice
     *if (stat_page != 0) #Return to the main stat page.
        *set stat_page 0
        *goto main_stat_page
    *if (stat_page != 1) #Explain the stats page.
        *set stat_page 1
        *goto explain_stat_page
    *if (stat_page != 2) #View lore page.
        *set stat_page 2
        *goto lore_page
    *if (stat_page != 3) #View character list.
        *set stat_page 3
        *goto character_list
    *if ((stat_page != 4) and (debug_mode)) #View debug stats.
        *set stat_page 4
        *goto debug_stat_page

```

It’s at the very end of the file, so it always appears at the bottom of the screen.

Here’s an example of one of the sub-pages (abbreviated for clarity):

> **Detailed code**
>
> ```
> *label show_all_stats
> [b]Personality[/b]
> 
> *stat_chart
> opposed_pair Ruthless
> Compassionate
> opposed_pair Manipulative
> Straightforward
> 
> [b]Relationships[/b]
> 
> *if (intro_complete) or (turncoat_heir_trust > 0)
> *stat_chart
> percent turncoat_heir_trust ${h_name} Trust
> 
> *if (fake_heir)
> *stat_chart
> percent turncoat_fake_trust ${guard_name} Trust
> 
> *goto navigation_menu
> 
> ```

This allows me a lot of control over what players see and when. In a later version of the game, I use this with `*gosub_scene` to repeat some text from another part of the game in the stats screen.

---

<div class="post-metadata">

**Author:** ![Kaelyn](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kaelyn/32/141616_2.png) [@Kaelyn](https://forum.choiceofgames.com/u/Kaelyn)\
**Post date:** [June 8, 2020, 7:17pm UTC](https://forum.choiceofgames.com/t/linking-scenes-to-hidden-pages-in-the-stats-screen/80598/18 "2020-06-08T19:17:32Z")

</div>

Almost forgot, sorry

> **Summary**
>
> ```
> 
> *label needs
> [i][b]Character Details[/b][/i]
> 
> Name: $!{pname}
> 
> Gender: $!{pcgender}
> 
> Life: 
> *if life > 90
> You are healthy
> *goto next01
> *elseif life > 70
> You have some scratches
> *goto next01
> *elseif life >50
> You are injured
> *goto next01
> *elseif life > 20
> You are badly injured
> *goto next01
> *else 
> You are near death
> *goto next01
> 
> *label next01
> 
> Psyche : 
> *if psyche > 90
> You are feeling wonderful
> *goto next02
> *elseif psyche > 70
> You are feeling good
> *goto next02
> *elseif psyche > 50
> You are feeling ok
> *goto next02
> *elseif psyche >20
> You´re feeling down
> *goto next02
> *else
> You feel really bad
> *goto next02
> 
> *label next02
> 
> [b]Inventory[/b]:
> 
> Special item: $!{item}
> 
> [b][i]Needs[/i][/b]:
> *if island
>     
> *stat_chart
> percent hunger Hunger
> percent thirst Thirst
> opposed_pair Hot 
> Cold 
> percent fatigue Fatigue
> percent comfort Comfort
>    
> *label screen
> *choice
> #Abilities
> [b]Abilities[/b]:
> *stat_chart
> percent b Body
> percent m Mind
> percent s Soul
> [b]Traits[/b]:
> *stat_chart
> opposed_pair cool 
> hot blooded
> opposed_pair impulsive
> organized
> opposed_pair creative
> by the book
> opposed_pair funny
> serious
> opposed_pair gentle
> ruthless
> opposed_pair genuine
> manipulative       
>         
> *goto screen
> #Relationships
> [b]Relationships[/b]:
> *if partner 
> *stat_chart
> text paname
> percent pafriend
> percent palove
> percent pamood
> percent pasurvival
> *goto screen
> #General
> *goto needs
> #Customizables
> Change:
> *fake_choice 
> #Pronouns
> Which pronouns do you want to use?
> *fake_choice
> #He/him/his
> *set p_gender 1
> *set phe "he"
> *set phim "him"
> *set phis "his"
> *set pmister "mister"
> #She/her/hers
> *set p_gender 2
> *set phe "she"
> *set phim "her"
> *set phis "hers"
> *set pmister "miss"
> #eating habits
> #flirting
> #sexuality
> #violence
> #love          
> *goto screen
>     
> 
> ```

There are some parts not yet implemented in the link by now, just ignore them^^
