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

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?

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

*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
1 Like

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

6 Likes

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.

4 Likes

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
1 Like

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?

1 Like

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

1 Like

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?

*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

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!

5 Likes