Need help makeing a inventory for my game

I always get a choicescript_stats line 9: Non-existent variable 'smg_suppressed error pls help

Can you post your code?

This is under startup

*title The Pains Of War
*author Crav Steinbak
*scene_list
   startup
   Chapter_1
*create name "undetermined"
*create gender "undetermined"
*create rank "undetermined"
*create age "20"
*create inventory
*create willpower 50
*create control 50
*create perception 50
*create cqc 50
*create smg_suppressed false
*create stun_grenade false

this is under variables

*create willpower 50
*create control 50
*create perception 50
*create cqc 50
*create name "undetermined"
*create rank "undetermined"
*create age "20"
*create gender "undetermined"
*create inventory
*create smg_suppressed false
*create stun_grenade
*label gender
*if (gender = "male")
*set male "male"
 *goto nationality
*if (gender = "female")
*set female "female"

this is under choicescript

10/10 will look at my stats again
*stat_chart
   text name
   text gender
   text rank
   text age
*temp inventory ""
*temp comma false
*if (smg_suppressed != true)
   *set inventory &"smg_suppressed"
   *set comma true
*if (stun_grenade)
   *if comma
   	*set inventory &", "
   *set inventory &"stun_grenade"
   *set comma true
inventory: ${inventory}.
   percent perception
   percent willpower
   percent control
   percent cqc

Can you try using ``` at the top and bottom of your code so the indentation is preserved in the forum?

You have an if statement before you declared a variable.

Hmm, can you use the preformatted text tag so we can see the indentation?

The button looks like </> on the comment toolbar.


Other than that, I notice this one on your chocescript_stats

The code won’t recognize &"smg_suppressed".
Instead, try using &"${smg_suppressed}".

smg_suppressed is not a string, so it will display “false” or “true.”

What error message are you getting? Can you post a screenshot?

how do i take a screen shot

It depends. Are you on a PC?

yea i am on windows 10

Use the print screen function to take the screenshot

where should i upload it

On the forum. There’s a function to upload pictures.

k i uploaded it to the forum My error message heres the link

I scooted it over here for you so it’d all be in one place. (:

What do you mean by ‘under variables’? You only need to (and only are allowed to) *create variables in the startup.txt file. Once you’ve created a variable, you can *set it wherever you like, in any scene, to change the variable’s value.

well after some fiddleing around i can make the inventory be persistant on the choicescript_stat page or have it show up for a single scene in the actual story

to bad what i want it to do is show up in the inventory and then be able to remove it after i no longer need said item and while i suppose i could have it show up in the story it just doesnt look good.

I think you might want to take a look at this: Concatenation | ChoiceScript Wiki | Fandom

I’m not too sure, but I think the problem here is the *set inventory & "smg_suppressed" part. Can somebody please correct me if I’m wrong, but should this not be *set inventory inventory & "smg_suppressed"

To be honest, I don’t fully understand the problem just yet. I’ll look at it again after some caffeine makes it way to my brain.

By “show up in the inventory” do you mean when you click the stats screen?
And, are you trying to change gear from the stats screen?

Either way works fine. They’ll give a same result.
But ofc, *set bla "text"&bla will give a different one.