I’m currently working on a mystery game where there is an “Evidence Menu” in the Stats Screen where it automatically displays the most recent piece of evidence the player reviewed/received.
My problem with my code so far is that there appears to be no sync of the “most recent evidence” between regular game files (startup.txt, other chapter files) and choicescript_stats.txt
I know that my problem may sound a bit confusing, so here’s a recording of my issue in Google Drive. (It’s 33 seconds, so it’s a relatively quick view)
When I select “Apples” in the Stats Screen the “most recent fruit” defaults back to “Oranges” when I go back to the regular game (in startup.txt).
The desired effect is for the “most recent” fruit to become “Apples” when I select it in the stats screen and stay that way until I select “Oranges.”
Basically, how can I make it so that when I select “Apples” in choicescript_stats, it will say “Apples were your most recently selected fruit” in startup.txt?
Below is the code used for the program in the video.
CODE IN STARTUP.TXT
*create implicit_control_flow true
*create recent_fruit "NULL"
*label search
This is in startup.txt
*if (recent_fruit = "NULL")
Select a fruit.
*else
${recent_fruit} were your most recently selected fruit.
*fake_choice
#Apples
*set recent_fruit "apples"
*comment: variable recent_fruit updated in startup.txt
#Oranges
*set recent_fruit "oranges"
*comment: variable recent_fruit updated in startup.txt
*goto search
*finish
CODE IN CHOICESCRIPT_STATS.TXT
*label fruitmenu
This is in choicescript_stats.txt
*if (recent_fruit = "NULL")
Select a fruit.
*else
${recent_fruit} were your most recently selected fruit.
*fake_choice
#Apples
*set recent_fruit "apples"
*comment: variable recent_fruit updated in choicescript_stats
#Oranges
*set recent_fruit "oranges"
*comment: variable recent_fruit updated in choicescript_stats
*goto fruitmenu
Now imagine this but replace “Recent Fruit” with “Recent Evidence”, and “Apples” and “Oranges” with things like “Kitchen Knife” and “Jane Doe’s Testimony.” That’s kind of how the “Evidence Menu” in my planned game will work.
Feel free to ask for clarification or anything else!