How to add a codex?

First of all if there is a thread for this sorry for making a new one but I could not find it. Secondly I have already looked at the tutorial provided by the choice of games website and could not find anything helpful to what I am trying to do.

Okay now on to what I am trying to do. I have come across this in multiple WIPs and actual games. They would have a section in the stats screen where one could find the definitions and generally more info on the events and/or terms used throughout the book. I was wondering if anyone knew the code necessary to do that is and if so could you please share it with me?

Here is the basic code I start with:

*label navigation_menu
*choice
  *if (stat_page != 0) #Return to the main stat page.
    *set stat_page 0
    *goto main_stat_page
  *if (stat_page != 1) #View Codex.
    *set stat_page 1
    *goto codex_stat_page
  *if (stat_page != 2) #View Character Relations page.
    *set stat_page 2
    *goto relationship_stat_page

*label codex_stat_page

Glossary:


*goto navigation_menu

You’ll need to create a “stat_page” variable in start-up to use this.

I’m not understanding your question here.

2 Likes

Isn’t that just like the variables?

How do I include a glossary in the states screen is what I am basically asking. and yes I could have worded it differently.

There isn’t a *dictionary command in Choicescript. It is using label and goto commands like @Eiwynn provided.

2 Likes

Okay so all I have to do is include that in the choicescript stat file? What i am trying to figure out is how do I make a glossary in choice stats. I already know there is no such command

Yes. Just like Eiwynn provided.

2 Likes

So it will look like this?

*label terms
Terms
*choice
#MANT drive
The term [b]MANT[/b} stands for Magnetically Accelorated Nuclear Tranlight. It is a special type of reactor designed specifically to enable ships to travel at between thirty - fourty times the speed of light. Every ship built by the MC’s people has at least two of these drives built in with the option to add more if the designer feels that it is nessacary.

I literally (and I mean literally—I’m still in bed) just woke up, but I think a *gosub_scene would be more appropriate for a codex, no? Correct me if I’m wrong, but that should allow you to keep your codex on a totally separate file so you don’t clog up your stat file. It would still be available via the stats screen but, I dunno, I think having a codex be a separate file is easier, especially if you know it’s going to be pretty big.

Actually, you would even be able to link it in choices if necessary, especially during a tutorial scene (if applicable).

2 Likes

Okay thanks. I had no idea I could do that. I am literally a noob when it comes to coding and I like to double and sometimes even triple verify things to make sure I did not mess them up

1 Like

It depends if you want the glossary list to be a giant list on one page or if you want to allow the reader to select which term they want to be defined. This is what it would look like if you want all your terms on one giant page.

*label navigation_menu
*fake_choice
        #Return to main stat screen.
             *goto main_screen
        #Go to codex.
             *goto codex
        #View character relationships.
             *goto character_relationships

*label codex
[b]Codex[/b]

Word: definition.

Word: definition.

Word: definition.

*fake_choice
        #Return to main stat screen.
             *goto main_screen
        #Go to codex.
             *goto codex
        #View character relationships.
             *goto character_relationships
4 Likes

I’ve been using the above basic code for a long time, so I just type it out this way out of habit.

I often view “stats” as a catch-all file for my basic systems structure and only go outside of it for nuances to the systems.

2 Likes

Do I need a seperate file for it?

No, when it’s just a *goto or a *gosub, they have to be within the same text file. Whenever you finish playing through what is written in a *gosub, it will automatically take the reader back to where they came from, while a *goto will keep going unless there’s another *goto to return to the original label.

*gosub_scene works like *gosub, where once the player is finished with that particular scene/section, the game springs back to where they came from.

I think I left some specifics out, but let me hop on my computer before I correct myself. mobile is hard y’all

3 Likes

Sorry for all the hassle.

1 Like

Oh no! It’s no hassle! I was just too lazy to boot up my computer, lol.

Anyway, it’s worth suggesting that you take a look through the ChoiceScript wiki which is an amazing resource when you’re just starting out. It defines all the commands clearly and concisely, and even includes sample code to study.

For reference here are the pages on *goto, *gosub, and *gosub_scene.

Okay, looks like the only thing I need to clarify is that both gosubs requires the *return command to spring back to where it came from, it isn’t automatic.

2 Likes

Just wanted to state it even if it’s obvious, but to create a glossary/codex, simply write down the terms and definitions manually like you would normal text.

*label gloss
[b]Gloss[/b]: shiny!

[b]Glossary[/b]: shinery!
*finish

Look at the .txt files of games that include codexes, and emulate those for your own. If you go here, https://www.choiceofgames.com/fate-of-the-storm-gods/scenes/choicescript_stats.txt, you can see how a glossary was coded in Fate of the Storm Gods. Check out the actual game to see how it looks practically, too.

2 Likes