Can I use ChoiceScript to add an extra button to the stats page?

There is a row of buttons at the top of the stats page. Is there a way to add an additional button there? Alternatively, can I put multiple “return to story” buttons at the bottom?

Here’s what I’m trying to do. I’m trying to have a multiple choice “G, PG, PG-13, R, X” setting that the reader can adjust as they go along. The stats page seems like the correct place to put that. I’m worried that if I navigate away to another “chapter” where they set this option then returning to the story will be broken. What are the options to resolve this?

Before we even get to the solution to the question you had, there is a quandary I want to make sure you’re aware of. You’re at risk of really bloating your workload.

It is possible to have “toggles” for things like npc/RO initiative, explicit vs f-t-b, so on, but just because you could have that many variations on a scene doesn’t necessarily mean it is a reasonable task to set yourself on.

Let’s say the variable the game searches for when a player sets their rating is A. When a player sets the value attached to the A variable, then each rating would be classified under its own value, like A = 1, where 1 represents the G rating. Or you could have it be A = 4, where 4 represents R.

If you choose to set 1, the game would then search for the scene that has the 1/G rating, ignoring the rest that don’t share the scene’s variable value.

This is where things start to bloat exponentially, unfortunately, because you’d have a scene variation that the code must navigate to for each possible rating you decide to add. So a separate paragraph of text for G, and PG, and PG-13, etc.

Having said this, I don’t know what your thoughts are on adherence to all possible film media ratings; the scope you gave as an example is rather wide. Going children’s movie all the way to something that could make even well-adjusted adults uncomfortable. I am definitely taking this more literally than I need to. :sweat_smile:

1 Like

I don’t know about adding a new button to the top of the Choicescript interface itself, but I think you can achieve what you want with the *gosub command.

You can write all the code you need to do whatever you want inside any chapter and add a label at the top of it. So long as you end it with a *return command, you can go there anytime you want and return to the story right after.

Of course, like my predecessor, I also advise making the game as simple and small-scaled as possible to avoid frustration. It’s a lesson I’m still in the process of learning myself.

1 Like

Just to be clear: you are wanting to have whole chapters to have different ratings rather than individual parts within a chapter? Will the events be different or just that how they are described are going to be different?

If the events will not be different I recommend using *if instead of jumping to whole new scenes. Then you will just need to set a variable to reference against. If it changes the whole scene then I agree with @LadyUmbreon89, you might be giving yourself too much work and their suggestion is spot on for the code.

About Breaking the Game

When it comes to breaking the game that depends on if the events in the chapter is actually changing or just how things are described. If the events are changing then you have a slight issue. If the descriptions are, it is not too bad.

The issue is that you would probably want the rest of the chapter to ride out under that Rating before having the change go into effect. However there is a messy way around that in the following:

Assuming the events change within the chapter
You would need to track a lot of *label commands and have them sitting at the beginning of every ‘page’. You would want every variation of the chapter to have the exact same commands and *labels. You would then have the code check after every page if the Rating was changed and if it were to jump to a different scene to the same label they were otherwise going to. That sounds like horrendous upkeep.

It also would not undue what already happened in the current page or previous pages so you do run the risk of things still not making sense cinematically.

Assuming the same events happen but the descriptions change
I would just use *if statements to vary how things are done. Have it look at the rating variable and provide different descriptions based on that. It’s simpler to track than the other option. Like with the previous option changing the rating will not change the current page, it’ll only adjust future pages. What is done will not be undone.

1 Like

Thank you for your replies.

I understand the concern about workload. Let’s put that aside for a moment.

This isn’t just about content ratings, but that’s the most obvious application of the notion. Consider content rating an example for a way I’d apply this. I’m presuming that readers will be able to set a rating at the beginning of the entire story (while they’re setting up the M.C.). What I’d prefer is to also include a quality of life improvement. Sometimes someone may decide they want more/less of something. Like a good dinner I’m looking to let the reader add a little more spice if they want (or tone things down if they don’t). I’m trying to avoid pasting a page in front of each chapter that would allow options to be swapped around. If readers can change things that don’t relate to the M.C.'s stats (such as content rating) then I don’t care if they do so whenever they want. The technology should allow for this, so I’m trying to go the extra mile by including the option.

I’m hoping to integrate something that wouldn’t be impossible to do in, for example, Visual Basic. Is there any documentation on how different commands in ChoiceScript behave (other than the five page tutorial linked from the front of the web site). Is there a wiki that explains details like the exact behavior of the *gosub command & how scripting as a sub & returning would behave differently than jumping to a chapter & scripting what I want to do? Can I just add code from any other programming languages? If so, which one(s)?

Yes, I believe there’s is more detailed stuff on *gosub here

I’m not sure if other programming languages can be brought into Choicescript, but even if they could be, I’m sure it wouldn’t be easy.

Also, the advantage to using the *gosub command with *return is that the block of code you create and go(sub) to essentially becomes a Function which you can use and reuse whenever you want and return right back to the story. You only have to write it once.

If you want to use it from another chapter (and scene), you’d just use *gosub_scene instead. You can find more info on that here

Hope this helps out.

/me looks around to see if there are any mods reading the thread

“Just the sort of U.R.L. that should be in a pinned thread on the forum…”

hint… hint… hint…

It is! This pinned thread includes links to other helpful resources as well

1 Like

Aa everyone else has discussed the relative merits and philosophies of your request, I’ll just show you how to do it.

*create scene ""

At the beginning of each scene file:

*set scene "scene_1"

etc, for all your scenes. In choicescript_stats:

Change rating. Warning: this will restart your current chapter!

  # R
    *set rating 4
  # PG-13
    *set rating 3
  # etc

*redirect_scene ${scene}

And you’ll have to do some work to save state the variables at each new scene and reset them if the player does this.

1 Like