# How to use stats in if commands

**URL:** <https://narrat.discourse.group/t/how-to-use-stats-in-if-commands/381>\
**Category:** Help\
**Created:** [15 May 2025 14:58 UTC](https://narrat.discourse.group/t/how-to-use-stats-in-if-commands/381 "2025-05-15T14:58:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Local\_Lurker](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/local_lurker/32/439_2.png) [@Local\_Lurker](https://narrat.discourse.group/u/Local_Lurker)\
**Post date:** [15 May 2025 14:58 UTC](https://narrat.discourse.group/t/how-to-use-stats-in-if-commands/381/1 "2025-05-15T14:58:51Z")

</div>

I was wondering how to use stats in if commands or just how if commands work in general for variables?

This is what i tried first. It always says its untrue and goes straight to the else. From what I read on the docs it seems like this one should work but I’m not sure.

if (== get\_stat\_value day 1):

I also tried these variants since they didn’t give me an error. They both always read as true no matter what.

if (get\_stat\_value day == 1):  
if (get\_stat\_value day 1):

This is the stuff for that particular stat:

 ![image](https://global.discourse-cdn.com/free1/uploads/narrat/original/1X/9b07db9fcce04f070e164eebc317e2b44704a4f2.png)

Lastly, I tried to make a variable to see what it thought the day was:  
var day (get\_stat\_value day)  
“its the %{day} day.”  
And the error says that r is null so I’m not sure if I’m doing something wrong there too or what that means.

---

<div class="post-metadata">

**Author:** ![Rex\_Fox](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@Rex\_Fox](https://narrat.discourse.group/u/Rex_Fox)\
**Post date:** [15 May 2025 19:44 UTC](https://narrat.discourse.group/t/how-to-use-stats-in-if-commands/381/2 "2025-05-15T19:44:35Z")

</div>

From what I understand, get\_stat\_value is something that returns the value of a state.

If you want to use days, lets say in a system that divides weekdays (1-5) and weekends (6-7) for example, because 1-5 is not a good loop, it would have to be like this:

```auto
main:
  "A new day..."
  choice:
    "...a new dólar huh?"
    "Work.":
      "Oh shit, here we go again."
      jump week

week:
  if (<= $stats.(stat_id).value 5)
    jump work
  if (>= $stats.(stat_id).value 6)
    "Weekend!"
    jump end_week

work:
  choice:
    "What do you want to do?":
    "Money, money, money!":
      add_stat (stat_id) +1
      jump week
    "Health baby!":
      add_stat (stat_id) +1
      jump week
    "A nice and smooth love.":
      add_stat (stat_id) +1
      jump week
    "A good food to a hungry belly.":
      add_stat (stat_id) +1
      jump week
    "I dont know yet.":
      add_stat (stat_id) +1
      jump week

end_week:
  "A sacred moment of peace..."
  choice:
    "What are your plans for Saturday and Sunday?":
    "Shut up! Let me sleep.":
      if (>= $stats.(stat_id).value 7)
        set_stat (stat_id) 1
        jump week
      else:
        add_stat (stat_id) +1
        jump end_week
    "PARTYY! LETS GOOO!":
      if (>= $stats.(stat_id).value 7)
        set_stat (stat_id) 1
        jump week
      else:
        add_stat (stat_id) +1
        jump end_week

```

I left stat\_id because you can use it as anything else. HP, MP, Days, etc.

I hope I was able to help you.

Good luck!

---

<div class="post-metadata">

**Author:** ![liana](https://yyz2.discourse-cdn.com/free1/user_avatar/narrat.discourse.group/liana/32/428_2.png) [@liana](https://narrat.discourse.group/u/liana)\
**Post date:** [15 May 2025 21:39 UTC](https://narrat.discourse.group/t/how-to-use-stats-in-if-commands/381/3 "2025-05-15T21:39:30Z")

</div>

Try  
if (== (get\_stat\_value day) 1):

And  
“its the %{$day} day.”

(needs a $)

The syntax is functions in parenthesis and arguments with spaces, == is a function, so (== stat 1). But then getting the value of the stat is a function call itself so wrap that in it’s own parenthesis
