Question about how to use basic variables and stats

Hello everyone !

So to make it simple, I want in my game to add option at the beginning that will turn on or off the content for adult (for example) or a system to know wich option help with the RO’s flirt etc…

I would also like to know how to add content like in stats, for example add some knowledges in a glossary when you learn about it ?

And how to make relationships stats too- and make some stat appear in that when you meet a character ?

1 Like

This is a pretty simple thing to do.

Every time there’s adult content, you want to display it only if a variable is turned on, instead of off, so you’ll want a boolean adult content variable.

*create adult_content false

And in the body of your work:

*if (adult_content)
  She breasted boobily down the stairs.
*if not(adult_content)
  She walked down the stairs.

Or, using multireplace, if you’re up for it:

She @{adult_content breasted boobily|walked} down the stairs.

You want the player to able to choose whether or not to enable adult content. At the beginning of your game, you’ll want to offer a choice to the player. The default command is *choice but for this one you’re just flipping a boolean variable true or false, so you can just use *fake_choice which removes the need to add *goto or *finish after every option.

*fake_choice
  # Enable adult content.
    *set adult_content true
  # Disable adult content.
    *set adult_content false

Pay close attention to the indentation. Notice how it all lines up.

As for a glossary in choicescript_stats:

*choice
  # Glossary.
    *goto glossary

*label glossary

[b]Glossary[/b]

Tortoise: A shelled reptile known for its slow speed.
[n/]Turtle: Like a tortoise but it swims.

The HTML command [n/] adds a line break, otherwise they’d show up on the same line.

For relationship stats, first you want to make the stat.

*create mom 50

In the body of your work, you can let the player adjust this variable.

*fake_choice
  # Clean your room.
    *set mom +10
  # Back talk your mom.
    *set mom -10

And in choicescript stats, you display it. Start with *stat_chart, and then use the “percent” command for a numbered variable that goes from 1-100. Call the variable name mom and then write what the player sees: Mom.

*stat_chart
  percent mom Mom

If you want to gate it behind having met your mom, start with another boolean variable.

*create met_mom false

When the player meets mom, change that variable to true.

*set met_mom true

And in choicescript stats, gate the “mom” stat behind an *if command.

*if (met_mom)
  *stat_chart
    percent mom Mom

If you haven’t checked out the basic choicescript introduction, go do that right now.

17 Likes

For this one you can make a variable (I think)
Ex. *create adult_content “unknown”
Then you can have a choice before the game starts
“Would you like to read any explicit scenes in the game?”

  • yes
  • set adult_content “yes”
  • no
  • set adult_content “no”

Then when you get to one of those scenes, you can use that to create 2 different versions
Ex.
*if adult_content= “yes”
*goto scene4_explicit
*else
* goto scene4_fade

3 Likes

Yes, once you get the gist on variables it becomes very trivial, for example:

“Would you like to read any explicit scenes in the game?”
*fake_choice
	# yes
		*set adult_content “yes”
	# no
		*set adult_content “no”

*if adult_content = "yes"
      Some naughty line written here!

Is the same as writing:

“Would you like to read any explicit scenes in the game?”
*fake_choice
	# yes
		*set adult_content true
	# no
		*set adult_content false

*if adult_content
       Some naughty line written here!

It works the same way in both examples the only difference is the data type (string in the first example and boolean in the second)

1 Like

Alright thank you everyone ! I’m trying to do a better start from my game so I was wondering how and all.

For a choice, when there is the possibility to go back in a previous choice (like with the trigger warning, start game etc…or even when the MC ask a lot of questions to someone), how do we “blur” a choice that already was made ?

*choice
  *disable_reuse #Choice 1

This should work.

2 Likes

Don’t use strings as booleans, and watch your indentation carefully.

Looks like someone hasn’t read the basic choicescript introduction! That should be the first thing you do; your questions all have simple answers found in the guide.

2 Likes

The disable_reuse is working like a command but when I test it, it doesn’t make the choise “blur”…

You want to make it like this Test

If so I dont think its possible in choicescript.

1 Like

Well, I say “blur” because I don’t know how it’s called… But sometimes when there is a lot of choices, you can like, choose everything without being able to choose another one that we already clicked on-

I am sorry but I didn’t quite understand what exactly you mean.

1 Like

Sorry- English isn’t my native language and I’m not good at explaining… I will try to find you an example ^^" if I find one-

1 Like

*hide_reuse command?

Do you just want it to go grey and non-selectable? (Like example below). That should be the *disable_reuse command if you only want it to be able to be chosen once. If it’s not working you may need to post code and errors (if stated.) Bear in mind if you leave the scene page and return to it later (for example if you have an inn you can visit to select a quest for example- you leave the file to go to another file to play that scene, then return for another quest), it can reset. So if you have something like that you’ll need to set a variable instead that permanently triggers after a choice is selected.

ie

*label questselection
*choice
    *selectable_if (quest1 = "no") #Choose to fight the orcs
        *set quest1 "yes"
        *goto_scene quest1scene

1 Like

Yes that’s what I meant for example, thank you !

Is it possible to use the disable_reuse command with fake_choice ?

I learned to only use fake_choice so I don’t really know if it’s important or not ?

I don’t think you can disable reuse on fake choice (to my knowledge at least). Just use a normal choice statement. Only difference is you’ll need to use label and goto commands. It’s pretty easy once you get used to it :slight_smile:

ie

*disable_reuse
*label returnchoice

How do you leave the building?

*choice
   #Escape through the window.
      The window is jammed and wont open. 
      *goto returnchoice

   #Run out the back door.
      There's a scary looking guard dog out there! Retreat back inside.
      *goto returnchoice

   #Leave through the front door. 
      The front door opens. You walk out onto the street. 
      *goto nextscene

*label nextscene
More story here.


1 Like

You can, and I’ve done it often!

3 Likes

Huh did not know that. Didn’t think it’d work as they’re kind of designed to be a run through choice.

1 Like

It’s the most efficient way to do it if you want to limit the amount of choices that can be selected from the group.

"You may ask me no more than three questions."

*temp questions_asked 0
*label questions
*set questions_asked +1

*fake_choice
  *disable_reuse # Question 1
  *disable_reuse # Question 2
  *disable_reuse # Question 3
  *disable_reuse # Question 4
  *disable_reuse # Question 5

*if (questions_asked >= 3)
  "That's enough questions for now."
  *goto next

*goto questions

*label next
2 Likes