Need help makeing a inventory for my game


#1

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


My error message
#2

Can you post your code?


#3

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

#4

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


#5

You have an if statement before you declared a variable.


#6

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}".


#7

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

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


#8

how do i take a screen shot


#9

It depends. Are you on a PC?


#10

yea i am on windows 10


#11

Use the print screen function to take the screenshot


#12

where should i upload it


#13

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


#14

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


#15

#16

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.


#17

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.


#18

I think you might want to take a look at this: http://choicescriptdev.wikia.com/wiki/Concatenation

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.


#19

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?


#20

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