Can you change the value of a variable relative to another using fairmath?

I have two numeric variables and want to set var2 relative to var1, preferably using fair math as they are ages.

I know I can set variables relative to one another using:

*set var1 var2

Is it also the case that I can use arithmetic? e.g.:

*set var1 var2+10

And is it possible to use fairmath, either the sameway or by another method? e.g.:

*set var1 var2%+10

The reason for this is to keep the ages of siblings realistically close together whilst allowing the player to select from a wide range of ages, allowing for different choices, with out allowing/needing them to choose an age for the elder sibling. If I can set it in such a manner as %+10, the player could choose from a wide range of ages and the sibling would always be older but never more than 10 years.

Sorry if this has been posted before, I can find posts on relative variable and fair math but not fair math relative to relative variables!

If I understand you correctly, I would do something like

*create mc_age ""
*create sibling_age ""

Choose your age

*input_number mc_age 1 50


*set sibling_age mc_age + 5

Your age ${mc_age}
Siblings age ${sibling_age}

yes!

 *create age 0
 *create sibage 0

How old are you? 
*input_number age 10 70

*page_break

*set sibage {"age"}%+10
Then your sibling is ${sibage} years old!

*finish

as i don’t know your age range, which… appears to be up to a 100 years old, if you’re expecting 10% = 10, which is not the case with fairmath–and in any case, it’s better to just set a fixed number of years, which would be-

*set sibage {"age"}+4

i do realize i’m just restating what’s already been said, though, except just maybe in a slightly shorter format.

Thanks for your help @fantom & @OfficerRattlesnake. Both are helpful. I want the character to age throughout the story allowing for certain events to only happen at certain ages and obviously I’d want the sibling to age at the same rate, but want the age gap to be bigger the younger the character starts off.

1 Like