So, I want to create a character build for playtesting my game (in this case, Captain Picard), and I want to be able to drop in all the relevant stats at the start of any chapter so I can just play the bit I want to test.
I have just played through the first couple of chapters, and obviously I can see the vital statistics on my stats page, but I also need all the mini-variables the game is tracking. Ideally, I want to copy-paste it from a list of all my variables as they are now, at this point in the playthrough, but I can’t find them.
If not, I can work out how to do it the long way, but a quick fix would be appreciated!
I think the easiest way is to just copy-paste a list of print commands for every variable from your startup into the end of each of your chapters, like so:
${VARIABLE1}
${VARIABLE2}
Then do a single manual run with that test char.
So that when you get to the end of each chapter, you get a list of the current status for every single variable.
Copy them into another doc (ideally a spreadsheet) for future use. Make sure to label which chapter you’re pulling from, of course!
Then you can just copy the output into a long list of *set commands to catch you up for any given chapter.
EDIT: You could also create a version of the above within the Stat Menu, so that you can pull it out at literally any part of the game, rather than just at the end of a chapter, of course…
There is a complex way of seeing this. This method works if you’re hosting your game on your browser for testing.
You’ll need to open your developer console on your browser, look into Storage, your file will usually be located under its name. Click the name to open the PersistJS program. Then you’ll access the stored information for your game. Copy and paste the text information stored there to see all variables’ exact values.
I’m not sure if this is what you meant.
I do remember another person created a program to print variables to an Excel sheet.
Copy paste the variables in startup to where you want them to be displayed.
CTRL+H (find and replace)
Find: "*create " (including the space)
Replace: “[n/]${”
Then you’ll unfortunately have to manually go and add the } to the end of each line and also label what the variables are between [n/] and $. Depends on how many you’ve got.
Not helpful, but I have this feature in the browser extension I’m developing.
For now you can do any of the ways mentioned above, but I find this one the easiest:
Open the developer tools of your browser; it’s usually F12, but if it doesn’t work, then a quick Google search should give you the answer.
Go to the console tab if it’s not already on it. If it’s the first time you’re using the console, you might have to type a special phrase to confirm you want to unlock it. Don’t worry, the console itself will tell you the phrase.
Paste the code below:
console.log(JSON.stringify(stats, (k, v) => v instanceof Scene ? undefined : v, 4));
It’s going to print all global game variables. If you want the temporary ones, replace stats with stats.scene.temps.
If you don’t intend to copy the values and just want to check them, you can type stats directly in the console, and it will display an interactive object you can expand. If you want to check the value of a specific variable, enter stats.<var-name>, for example, stats.strength.
If it helps, the manual labelling part of this can be eliminated entirely, assuming you’re using a programme that supports regex (most should).
In the “Find” section, type: \*create (\w+\b) (.+)
In the “Replace” section, type: [n/]$1: ${$1}
Make sure that regular expressions or “regex” is enabled. In VSCode, for example, you have to hit the little button with a full stop and an asterisk beside the “Find” window.
It seems that choice script recognises a command called “stats” so while on browser you can right click on the page click inspect, navigate to console and run the command stats and it will return a dictionary containing all the variables
Something something, dark side of the force, something something, unnatural powers.
More seriously, though… This is a bit off-topic, but for everyone here who’s never tried it: go and learn regex. It’s an absolute godsend for anyone dealing with large amounts of text. You can use it for almost anything that you want to do programmatically with your text, assuming you have the patience.
Some examples of its possible uses, off the top of my head…
Finding all elements of a particular type in the text, in order to count them and/or modify them in some way
Format all option choices in the same way, such as putting quotes around them, making them all italic, and so on.
Relatedly, make all versions of a made-up word italic, or the opposite: remove all italics from a certain word
Find all versions of a specific command (or even a group of commands) and change something about them, whether that be the arguments, the type of operation, or something else entirely
Insert commands or text that always follows from some other piece of text or command, or verify that such rules are always followed in your pre-existing writing. E.g., every time a particular stat increases, insert a piece of text that says “Your X stat just increased”, make sure those lines are always italicised, and make sure those lines are always hidden by an *if statement so that the player can turn them off. You can literally do this instantly, right at the end of your project, if you want to, rather than doing it as you go through, choice by choice. You could even do it for all primary stats at once, if you wanted to, with a single regex replace.
Make sweeping, wholesale changes to your variable or character names throughout the work without worrying about catching strays and accidentally changing more words than you meant (e.g., trying to change, say, ch3_temp_library_book_length without also changing ch3_temp_library_book, or turning all mentions of a character named “Menda” into one called “Threnda”, without also turning all instances of the word “mendacious” into “threndacious”)
Search for common errors in your text and remove or replace them automatically
Find common errors often created by multireplace: double spaces, punctuation marks preceded by a space rather than a character, stray brackets, uneven number of quotation marks on a line, etc.
Verify that you don’t have any *goto commands linking to labels that don’t exist (though quicktest should probably catch this anyway), or checking that you don’t have any subroutines that don’t end with *return, or any other format-related issues
Find out information about your text at large
Find the longest and shortest sentences or paragraphs
See the amount of times you increased or decreased each stat and by what amounts, or see how many times you’ve given multiple ways to increase the same stat within the same choice
Find out how many times you’ve used more than one, two, or three *page_breaks in a row
Look up how many choices you have with each number of choices (i.e. how many 3-option choices, how many 4-option choices, etc.)
Check the frequency of certain words or phrases with a high level of detail and precision, e.g.: How many times do I use the phrase “owing to” proceeded by a gerund vs. a possessive? How often do I use multiple ellipses in the same instance of speech?
Find connections between specific elements; for example, you could find all the times you used a certain phrase or language in the paragraph immediately following a stat increase of a particular type.
I would genuinely advise anyone here who is writing in ChoiceScript to spend some time fiddling with it when they can. It might feel slow at first but will save you heaps of effort in the long run. I’ve used it for all sorts of things in the past, and the longer your project becomes, the more it honestly becomes a necessity if you want to preserve your own sanity. (And that of your beta testers!)