# Is it possible to make a variable dependent on another variable?

**URL:** <https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930>\
**Category:** ChoiceScript Help\
**Created:** [June 6, 2021, 12:42pm UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930 "2021-06-06T12:42:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mastermind](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mastermind/32/86031_2.png) [@Mastermind](https://forum.choiceofgames.com/u/Mastermind)\
**Post date:** [June 6, 2021, 12:42pm UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/1 "2021-06-06T12:42:08Z")

</div>

I’ve only started Choice Script recently and i am sorry if this question was asked before, I was wondering if it was possible to make a variable dependent on another variable? percent-based skills don’t work that well for what i have planned so i was wondering if i could do something like say:  
Skill\_A\_prog = 100 x(2 x skill\_a tier)  
so that as skill A increases so does the progress needed to increase  
or should i do something like this:  
Skill\_A\_1\_prog = 100  
Skill\_A\_2\_prog = 400

and so on

Also as a side question, is it possible to use concatenation on numeric variables?

like:

Combat Performance= Skill\_a + Skill\_b+ Skill\_c- injury

---

<div class="post-metadata">

**Author:** ![Sargent](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sargent/32/108433_2.png) [@Sargent](https://forum.choiceofgames.com/u/Sargent)\
**Post date:** [June 6, 2021, 4:14pm UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/2 "2021-06-06T16:14:04Z")

</div>

Sure!

```
*create Skill_A_prog
*create Skill_A_1_prog 100
*create Skill_A_2_prog 400
...
*set Skill_A_prog 100 * (2 * Skill_A_1_prog)

```

You can add numeric values together as well. The main trick is that ChoiceScript only allows you to add or subtract two things, so you have to use parentheses to turn an expression like `Skill_a + Skill_b` into a single thing `(Skill_a + Skill_b)`. So for the example you showed:

```
*set combat_performance (Skill_a + Skill_b) + (Skill_c - injury)

```

---

<div class="post-metadata">

**Author:** ![Mastermind](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/mastermind/32/86031_2.png) [@Mastermind](https://forum.choiceofgames.com/u/Mastermind)\
**Post date:** [June 6, 2021, 4:22pm UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/3 "2021-06-06T16:22:21Z")

</div>

Thanks a lot!!

---

<div class="post-metadata">

**Author:** ![Nocturnal\_Stillness](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/nocturnal_stillness/32/100414_2.png) [@Nocturnal\_Stillness](https://forum.choiceofgames.com/u/Nocturnal_Stillness)\
**Post date:** [June 6, 2021, 5:17pm UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/4 "2021-06-06T17:17:17Z")

</div>

It is also possible to add two variables without the need for a third.

UnNatural for example has checks like

\*if ((physical + vampire\_lore) \>49)

---

<div class="post-metadata">

**Author:** ![Sam\_Ursu](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/sam_ursu/32/111478_2.png) [@Sam\_Ursu](https://forum.choiceofgames.com/u/Sam_Ursu)\
**Post date:** [June 7, 2021, 8:39am UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/5 "2021-06-07T08:39:05Z")

</div>

@Sargent already gave you the solution for using number variables to change other number variables, but keep in mind that you also can automatically change text (“string”) variables with text variables as well.

Of course, you can’t do any of the math stuff (divide, add, multiply) but you can still do some cool stuff with interlocking text variables.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/choiceofgames/original/3X/e/f/efe1497a762edecdb6d569a1c4abee87508bf002.png) [@system](https://forum.choiceofgames.com/u/system)\
**Post date:** [June 8, 2021, 8:39am UTC](https://forum.choiceofgames.com/t/is-it-possible-to-make-a-variable-dependent-on-another-variable/101930/6 "2021-06-08T08:39:06Z")

</div>

Closed on June 8, 2021, 8:39am UTC

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.
