OK, here’s what I’ve got.
-
*redirect_scene
: A New Variant of*goto_scene
Previously, when using *goto_scene
in the stats screen, it was just buggy; the game was partially in stats mode and partially not in stats mode. A few weeks ago, I “fixed” it so *goto_scene
and *gosub_scene
would reliably leave you in stats mode, requiring the user to actually click a button to leave stats mode.
The *redirect_scene
command only works in stats mode; it exits stats mode and executes a *goto_scene
command back in the main game. In tablet mode, the stats screen can’t be “exited” (it’s always visible as a panel on the side of the screen) so we just *goto_scene
back in the main game and then refresh the stats screen.
Like *goto_scene
, you can add a label name, e.g. *redirect_scene party invitation
to redirect to party.txt
at *label invitation
.
I haven’t written up a lot of documentation about it yet, because I’m not 100% convinced that I like the name *redirect_scene
. I’d like to call it *exit_stats_and_goto_scene_in_main_game
if that weren’t such a mouthful…!
- Saving In Stats Kinda Works Now
In the latest version of ChoiceScript up on github, *set
commands on the stat screen will take permanent effect, but only after you return to the main game and click Next.
So, for example, if you have code like this:
startup.txt
-----------
*create count 0
*set count +1
page 1: ${count}
*page_break
page 2: ${count}
choicescript_stats.txt
----------------------
*set count +1
*stat_chart
text Count
Now suppose you start the game and visit the stats screen eight times without doing anything else.
Surprisingly, even though you visited the stats screen eight times, the counter will show “page 1: 1” in the main game and “Count: 1” on the stats screen. But as soon as you click Next, it will correctly show “page 2: 9,” one for each visit to the stat screen plus the initial +1 for starting the game.
In other words, we refresh the stat screen when the main screen changes, but we don’t refresh the main screen when the stats screen changes. (That would be an infinite loop.)
As a result, players can now set preferences on the stats screen, e.g. it mostly fixes the bug in Tin Star where you can’t force it to remember that you want the stats screen to stay in “story mode.”
(That is, the Tin Star bug is completely fixed in tablet mode, where there’s no way to exit stats mode. In non-tablet mode, if you select story mode, exit stats and immediately re-enter stats, your preference will be forgotten. But if you exit stats, click Next and then re-enter stats, the preference will stick.)
If you want to make a change on the stat screen that has an immediate effect on the main game, use *redirect_scene
instead of just *set
.
What do you think? Close enough?