# Difficulty with variables

**URL:** <https://forum.choiceofgames.com/t/difficulty-with-variables/56670>\
**Category:** ChoiceScript Help\
**Created:** [May 11, 2019, 5:34am UTC](https://forum.choiceofgames.com/t/difficulty-with-variables/56670 "2019-05-11T05:34:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dillpickle1996](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dillpickle1996/32/168039_2.png) [@dillpickle1996](https://forum.choiceofgames.com/u/dillpickle1996)\
**Post date:** [May 11, 2019, 5:34am UTC](https://forum.choiceofgames.com/t/difficulty-with-variables/56670/1 "2019-05-11T05:34:01Z")

</div>

Is there a way for writers to run something that counts each + or - to a stat, and gives you a grand total for how high or low the stats can go?

---

<div class="post-metadata">

**Author:** ![Szaal](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/szaal/32/112202_2.png) [@Szaal](https://forum.choiceofgames.com/u/Szaal)\
**Post date:** [May 11, 2019, 6:51am UTC](https://forum.choiceofgames.com/t/difficulty-with-variables/56670/2 "2019-05-11T06:51:41Z")

</div>

Count the change/mod. to a var, or check the new value of the var?

* * *

To print the value of a variable, use `${varname}` syntax

---

<div class="post-metadata">

**Author:** ![Kicks132](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kicks132/32/90253_2.png) [@Kicks132](https://forum.choiceofgames.com/u/Kicks132)\
**Post date:** [May 11, 2019, 6:52am UTC](https://forum.choiceofgames.com/t/difficulty-with-variables/56670/3 "2019-05-11T06:52:00Z")

</div>

What do you mean, like if you have 43% in strength and you want to add more?

---

<div class="post-metadata">

**Author:** ![lunawisp](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/lunawisp/32/85423_2.png) [@lunawisp](https://forum.choiceofgames.com/u/lunawisp)\
**Post date:** [May 11, 2019, 7:41am UTC](https://forum.choiceofgames.com/t/difficulty-with-variables/56670/4 "2019-05-11T07:41:28Z")

</div>

There’s nothing built-in that I’m aware of. You’ll have to code it yourself. You can create a subroutine to do it and call it with \*gosub (or \*gosub\_scene). You can add parameters to your call for your subroutine to act upon.

I use quite a few code blocks that are called from all over the place. Saves a lot of repetition and messing about.

If you’re going to do that, you should take a look at [https://www.choiceofgames.com/make-your-own-games/choicescript-advanced/](https://www.choiceofgames.com/make-your-own-games/choicescript-advanced/) - specifically the sections about gosubs and redirection (which they call ‘Truly bizarre references’ for some obscure reason).
