# Increasing Percentages Through Choices

#1

Okay so this might be really obvious, but I’m new to this. I’m very confused on how to make a percentage go up, i mean it can’t just stay at 50% the entire game.

You've just finished a long day, what do you do again?
*choice
#I'm a realtor
*set Charm %+25
*finish
*set Telepathy %+25
*finish
#I'm a personal trainer
*set Strength %+25
*finish
#I'm a... Well lets just say it's not exactly legal...
*set Menace %+25
*finish

This is what I originally tried, but it’s not right, any advice/suggestions?
Thanks

#2

What you’re doing in your example is actually “fairmath” – in ChoiceScript, fairmath has it’s own way of increasing and decreasing stats.

Do you mean to increase the stats by an actual percentage of what they are currently, or just by a fixed amount?

#3

All the percentages are at 50%, after the choice I’d hope that it would go to 75%, although thinking about it know I’d probably want to add less than that like 10% or 5% because 25% seems like a lot. I read through the fairmath instructions, but it just seemed really confusing. And thanks for replying so fast, TBH i wasn’t expecting to here anything for a while.

#4

If you want to increase or decrease a variable by a fixed amount, it’s easy.
If your variable was “eel” and eel is 50, and you want to raise it by 25, then you would just do:

*set eel +25

However, if eel is 50 and you want to increase eel by 25 percent of 50, then it’s a different process.
There are many different math equations that can work here, but I might use this one:

*set eel (eel * 0.25) +eel

So to follow that, eel is 50.
We’re telling the computer to find 25 percent, which is .25
That gives us 12.5
Then we add back the original number 50 to give us 62.5
Please let me know if this works for you because I haven’t actually tried it yet

Edit: I fixed the code, it didn’t work the first time. It should work now.

#5

Okay so it worked for my text variable (money) , but it didn’t for my percentages.This is how the code looks:

*scene_list
startup
animal
variables
gosub
ending
death

*create money 100

You’ve just finished a long day, what do you do again?
*choice
#I’m a realtor
*set charm +25
*finish
*set money +25
*finish
#I’m a personal trainer
*set money +25
*finish
#I’m a… Well lets just say it’s not exactly legal…
*set money +25
*finish

And the stats code is this:

*stat_chart
percent 50 Hunger
percent 50 Self-Control
percent 50 Charm
percent 50 Telepathy
percent 50 Strength
percent 50 Menace

text money

So I don’t know, am I supposed to add something?

#6

(it is indented in the txt document, but i copy and pasted it here)

#7

Oh, right!
Percentages in the stat chart:

Also, if you want to show pre-formatted text, you can use the </> button on the toolbar (or press control shift c).

Edit: Ok, I see what happened:

In your stat chart, you should have already set the variables in startup.txt
So, if in your startup, these variables are set to 50, then you could display them like:

*stat_chart
percent Hunger
percent Self-Control
percent Charm
percent Telepathy
percent Strength
percent Menace

#8

Fairmath:

• Increase/decrease the value of a variable with a diminishing effect (the higher the lesser ++, vice versa)
• Use the +%[number] or -%[number] command to modify a variable using fairmath
• Maximum value of variable is 99
• Minimum value of variable is 1

Normal:

• Increase/decrease the value with a fixed amount.
• Use +[number] or -[number] instead of using +% or -%
• No limitation on max/min value (go beyond 100 and 0)

By the way, you can use </> button at the comment toolbar to show your code. This way, your comment will have indents on it that resembles the actual code.

#9

I can’t seem to make anything work for the stats table, for now I’ll just use the text elements, but I’m still going to try to make this work

#10

Also it may help to post what you have in your startup.txt just to make sure the variables are set correctly there.
If they aren’t set correctly in startup, they won’t display on the stats screen.

#11
*scene_list
startup
animal
variables
gosub
ending
death

*create money 100

*page_break

is what I have in the start up

and this is what’s in the stats.txt:

*stat_chart
percent 50 Hunger
percent 50 Self-Control
percent 50 Charm
percent 50 Telepathy
percent 50 Strength
percent 50 Menace

#12

Ok, two things…!

*scene_list
startup
animal
variables
gosub
ending
death

*create money 100
*create Hunger 50
*create Self-Control 50
*create Charm 50
*create Telepathy 50
*create Strength 50
*create Menace 50

*page_break

Also:

*stat_chart
percent Hunger
percent Self-Control
percent Charm
percent Telepathy
percent Strength
percent Menace

#13

IT WORKED!!! THANK YOU SO MUCH!

stats screen:

*stat_chart
percent Hunger
percent Charm
percent Telepathy
percent Strength
percent Menace

text money

start up screen:

*title Life of a
*author EELSFOREALS
*scene_list
startup
animal
variables
gosub
ending
death

*create money 100
*create Hunger 50
*create Charm 50
*create Telepathy 50
*create Strength 50
*create Menace 50

*page_break

next screen:

You’ve just finished a long day, what do you do again?
*choice
#I’m a realtor
*set Charm +25
*finish
*set Telepathy +25
*finish
#I’m a personal trainer
*set Strength +25
*finish
#I’m a… Well lets just say it’s not exactly legal…
*set Menace +25
*finish
*page_break

next screen:

You've just finished a long day, what do you do again?
*choice
#I'm a realtor
*set Charm +25
*finish
*set Telepathy +25
*finish
#I'm a personal trainer
*set Strength +25
*finish
#I'm a... Well lets just say it's not exactly legal...
*set Menace +25
*finish
*page_break

#14

If I may, when you initially create variables, you don’t capitalize:

*create strength 50

When you want to see the strength stat in the stat-screen, you can do either this:

percent Strength

Or this:

percent strength

But later when you want to add 15 points to strength, it should look like:

*set strength +15

Another thing I noticed is that the money stat isn’t capitalized but all of the percent stats are when you created them…

Also, you don’t have to put the *page_break command at the bottom of the stat page because the game already lets the player go back to the story from any of the stat pages…

It looks like you’re writing the first scene in the startup file… the game works just fine if this is the case, but it might be harder to tell where the story begins once you add more writing…

#15

originally i did have the first scene in the startup file, but i switched it out

#16

Ah… Well, I wish you luck with your writing!