Using options in stat screens

Thanks guys. It worked. We appreciate it :raised_hands:t6:

It’s just a test. My plan for the book will be that the mc will select an ability from said Power Gauntlet menu and it will reflect in the options in the passage

I was trying my hand at some game mechanics I taught of and I hit a road block

My plan was to create a set of options in the stats screen that could change the character’s power set, thereby influencing the set of options from the stats screen


The essence of the thread is for me to get some help from you guys anytime I encounter an issue I can’t solve. I was hoping to use this idea in the book I and my partner are working on.

I’d say if you only have one power at a time (first screen) having an extra single choice there is superfluous until you add more options per power.

As for the stats screen: Am I understanding it right that you want an option to switch the power focus on the gauntlet?

It’s just a test. If it works I’ll use it.

Yeah. I was working on that but I got an error

This might not work through the stat screen, if I understand this comment correctly. You can’t set variables through the stat screen. Try to create a separate file for setting gauntlet powers and use *gosub_scene when changing is needed.
Edit: Added an example how that might work:

*label this_action
	#Before I do anything, I'll change my superpower.
		*gosub_scene power_gauntlet select_powers
		*goto this_action
	*if (power = "Super strength") #Attack the enemy with your super strength!
		You punch the enemy!
		*goto next_action
	*if (power = "Super speed") #Dodge the enemy!
		*if speed >= 60
			You dodge successfully!
			*goto next_action
			You can't dodge completely!
			*goto next_action

If you choose the 1st option, you are taken to label select_powers in the power_gauntlet file you hypothetically created.

*label select_powers
Do you want to change your power?
	*selectable_if (power != "Super speed") #Use super speed.
		*set power "Super speed"
		*goto select_powers
	*selectable_if (power != "Super strength") #Use super strength.
		*set power "Super strength"
		*goto select_powers
	#Return to the game.

You can try this.
I’ve also taken a look at your label beginning. It won’t work for what you are trying to do.

The problem

You are using *input_text command for numerical variables. If you input 100, the game won’t treat it as a number 100 which can pass *if speed >= 60 condition, if will treat it as a text which reads “100” and can’t pass.
Use *input_number instead. And, unless you want to allow players to play on god mode, set up a limit of points you can allocate to your stats. I’ve written an example code for you:

*temp max_points 100
*temp points 0
*label beginning
You have ${max_points} power points left. Allocate them wisely!
	#How strong are you?
		*input_number points 0 max_points
		*set physical +points
		*set max_points -points
		*set points 0
		*goto beginning
	#How fast are you?
		*input_number points 0 max_points
		*set speed +points
		*set max_points -points
		*set points 0
		*goto beginning
	#I changed my mind! Let's re-allocate the points!
		*set max_points 100
		*set points 0
		*set physical 0
		*set speed 0
		*goto beginning
	#I've finished!
		*goto next_label
*label next_label

You can set variables from the stats page, but it will only take effect on the main game after you refresh the page, that means, after you turn the page or if you close and open the game again, both of which are impractical to do in the middle of a fight.

But a system like this, to select active powers for example, should be fine as long as you don’t expect the change to take effect immediately. Alternatively, you can force the page to refresh by using *redirect_scene, clever reference variables and well-placed labels, but it also means losing any temporary variables.

1 Like

Oh. I guess I was mistaken.

You guys are geniuses. I’ll take my time reading cause I’m confused right now :joy:. I’ll get back to y’all if I have any other issues

1.Will the sub-scene be used in tandem with the stats menu?
2. I’m doubting it is, but is it possible for the player to change powers on the getgo

No. Even if you use a different file, the changes will take effect only after refreshing the page if you access it from the stats page.

You could add a label at the top of every page of a fighting scene and add an option during the fight to access the gosub and then goto the label at the top of the page. This would force the refresh and is relatively simpler.

1 Like

I suggest you using a subroutine in a separate file for setting your power, while leaving the stat screen only for showing information, not setting it. What other users are suggesting you requires subroutines anyway, so I think my way is slightly easier.

Meaning the player won’t see their powers?

Randomtest 05-Jul-20 12_18_51 PM


That’s because CS uses explicit control flow by default. That means you must always explicitly tell the CS Engine where to go next.

You can’t fall out of an if statement, you have to use *goto to tell it where to go next, even if it’s the very next line.

This is to prevent authors from forgetting to add gotos where they must be, but this also forces authors to add gotos where they are not needed.

If you have some experience with programming or if you feel comfortable with implicit control, just go to startup.txt and add this line:

*create implicit_control_flow true

1 Like

Why not? Add something like this in your choicescript_stats file:

Depending on your power focus, you can use Super Speed, Strength or Mind Manipulation.

Your current power focus is ${power}.

Any chance I can send my code to someone if not all of you. Cause I’m having a hard time explaining m problems

OK, send your code.

You can post it here. Don’t forget to use preformatted text.

I’d still say you don’t need the choices in the text if there’s only one ability linked to a power.

So, for example, instead of (simplified text)

   #use the power you have
      *if power_checks_out
         good stuff
         *goto yay
         bad stuff
         *goto nay

You could go with this

*if power_x
   *goto x
*elseif power_y
   *goto y
   *goto z
*label x
*if (x_power > 60)
   *set stats
@{(x_power > 60) success text| fail text}
*goto thing

I think.