Linking scenes to hidden pages in the Stats Screen

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!

1 Like

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 :sweat_smile:

Or basically what @MonkeyLottery said :sweat_smile:

5 Likes

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 
8 Likes

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, 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. 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.

7 Likes

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

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

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

1 Like

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

1 Like

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.

1 Like

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 :joy:

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

1 Like

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
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.

2 Likes

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?

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)

3 Likes

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

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.

2 Likes

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

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.

2 Likes

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.

2 Likes

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^^