# Changing the entire Stats Screen (multiple stories in one game)

**URL:** <https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805>\
**Category:** ChoiceScript Help\
**Created:** [September 8, 2021, 7:09pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805 "2021-09-08T19:09:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [September 8, 2021, 7:09pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/1 "2021-09-08T19:09:05Z")

</div>

Is there a way to change the entire Stats Screen based on a variable?

Long story short, Community College Hero 2.5 is a game that will feature 3 distinct stories. You access these stories in a menu, so you can bounce around from story to story however you like, there is no set order (other than for the initial paywall).

Right now, I have the Stats Screen coded to Story 1, with Stories 2 and 3 relegated to the Stats Screen submenu, so it requires an extra click to access any of those. For example, if you’re playing Story 2, you have to click Stat Screen (which will show the Story 1 stats) and then click the right story in the submenu. That’s not as elegant as I would like.

Can I do away with this approach and code the Stats Screen to just show the stats for the specific story the player is playing at a given time? If so, how would I go about doing that? Has anyone found an example of a game doing that? Would I need to put \*if commands in front of every line of text in the Stats Screen?

---

<div class="post-metadata">

**Author:** ![Sid0](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sid0/32/151165_2.png) [@Sid0](https://forum.choiceofgames.com/u/Sid0)\
**Post date:** [September 8, 2021, 7:18pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/2 "2021-09-08T19:18:17Z")

</div>

> [@Eric\_Moser](#):
>
> \*if commands in front of every line of text in the Stats Screen?

Not at all, just use `*if` and add the same spaces/tabs everywhere you need it.

```choicescript
*stat_chart
  text name

*if (story="1")
  *stat_chart
    percent 1_story
    percent 1_story

  *stat_chart
    percent 1_story
    percent 1_story

*if (story="2")
  *stat_chart
    percent 2_story
    percent 2_story

  *stat_chart
    percent 2_story
    percent 2_story
```

---

<div class="post-metadata">

**Author:** ![The\_Lady\_Luck](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/the_lady_luck/32/212891_2.png) [@The\_Lady\_Luck](https://forum.choiceofgames.com/u/The_Lady_Luck)\
**Post date:** [September 8, 2021, 7:27pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/3 "2021-09-08T19:27:05Z")

</div>

Or have each story’s stat screen under different labels, and use an \*if statement at the top of the file to \*goto or \*gosub to the right label.  
You can even move each stat screen to their own file, if you want, and use \*gosub\_scene

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [September 8, 2021, 7:33pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/4 "2021-09-08T19:33:17Z")

</div>

Thanks to both of you for the ideas!! This is very helpful. Since the stat pages are structured so differently, it might just make the most sense to create three different files for the stat pages, but I’ll play around with both fixes because I need to keep learning this stuff.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [September 8, 2021, 7:44pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/5 "2021-09-08T19:44:14Z")

</div>

I’d definitely go for something like Lady Luck suggested with multiple files:

startup.txt:

```
*create stats_file "game1_stats"

```

choicescript\_stats.txt:

```
*gosub_scene {stats_file}

```

game1\_stats.txt:

```
*comment stat code for game 1 goes here
*return

```

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [September 8, 2021, 8:12pm UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/6 "2021-09-08T20:12:54Z")

</div>

Would I just type something like \*set stats\_file “game2\_stats” on the first line of game 2’s text file, and the same for game 3’s text file, to correspond with those files I’d create?

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [September 9, 2021, 1:25am UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/7 "2021-09-09T01:25:45Z")

</div>

@CJW that suggestion worked beautifully, so thank you! It does seem to have introduced a weird “can’t open .txt” error warning in Quicktest, but Randomtest does fine, so I’ll get to the bottom of it eventually.

---

<div class="post-metadata">

**Author:** ![Jacic](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/jacic/32/7061_2.png) [@Jacic](https://forum.choiceofgames.com/u/Jacic)\
**Post date:** [September 9, 2021, 1:36am UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/8 "2021-09-09T01:36:45Z")

</div>

How much info do you need for the stats screen? Is it mulitple pages, or just one?

I’m using a separate label for one of mine that has completely separate screens for the stats, but I don’t have mulitple screen options for each MC type (ie one for character stats, one for items, one for friendship levels etc) I’m flicking through which would make it more annoying to manage of a single page.

```
*if (storytype = "enchanter")
	*goto humanstat
	
*if (storytype != "enchanter")
	*goto spiritstat

```

The go\_sub scene should work as an alternative, but if you’re getting errors does it cause any problems if you quit back to the story via the buttons while in the alternate go\_sub’ed files?

---

<div class="post-metadata">

**Author:** ![will](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/will/32/132033_2.png) [@will](https://forum.choiceofgames.com/u/will)\
**Post date:** [September 9, 2021, 1:51am UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/9 "2021-09-09T01:51:19Z")

</div>

```
*if (character = 1)
  *goto character_1
*elseif (character = 2)
  *goto character_2
*else
  *goto character_3

*label character_1

stats

*finish

*label character_2

stats

*finish

*label character_3

stats

*finish

```

---

<div class="post-metadata">

**Author:** ![Eric\_Moser](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eric_moser/32/259257_2.png) [@Eric\_Moser](https://forum.choiceofgames.com/u/Eric_Moser)\
**Post date:** [September 9, 2021, 2:22am UTC](https://forum.choiceofgames.com/t/changing-the-entire-stats-screen-multiple-stories-in-one-game/106805/10 "2021-09-09T02:22:05Z")

</div>

Okay I’m stumped now, as I keep getting the Quicktest error message.

So at the top of startup.text, I coded: \*create stats\_file “rpg\_stats”

Then on the top of my second story file I coded: \*set stats\_file “lake\_stats”  
And on the top of my third story file I coded: \*set stats\_file “family\_stats”

The only code on choicescript\_stats is: \*gosub\_scene {stats\_file}

Then I created three stat files: lake\_stats.txt, family\_stats.txt, and rpg\_stats.txt, and each of them contains the stats for the corresponding game, with \*return at the end

This seems to work, even when I hit the “Stats” button while I’m playing in the startup file, but I’m still getting this damn error message in Quicktest.

QUICKTEST FAILED  
ERROR: couldn’t open rpg\_stats.txt

EDIT: Stupid me forget to add the new stats screen files to scene list. UGH. Fixed! A HUGE thanks to everyone offering help!
