Inventory code help

#1

I want to have items that can be put in and taken out of my inventory but when ever I take something out, it just doubles everything else.
ex. before I take out synthale

“You have: FC Card, GPL, Synthale.”

ex. after I take out synthale

"You have: FC Card, GPL, SynthaleFC Card, GPL. "

*if (fc_card)
    *set inventory &"FC Card"
    *set comma true
*if (gpl_coin)
    *if comma
      *set inventory &", "
    *set comma true
    *set inventory &"GPL"
*if (synthale)
    *if comma
      *set inventory &", "
    *set comma true
    *set inventory &"Synthale"

I have no clue how to fix it

1 Like
#2

I guess to help you, you should post the code, that extracts the synthale too, that might be useful.

2 Likes
#3

You have to *set inventory "" at the start. (Or *set inventory "You have: " depending on what it initially was.)

4 Likes
#4

Yes, every time you have *set text & "general text", it just adds the general text to the end of whatever already exists in the text variable.

I recommend what @ParrotWatcher says: just clear the text variable in the beginning, and then let it add all the things back.

3 Likes
#5

I think what my problem was that I was trying to take out the synthale from the stats page??

This is what it looked like before, I’ll just make the options happen in game instead of the stats

 *if (synthale) #Drink
    horrible
    *set synthale false
    *set hunger +5
    *goto dnk
#6

Can you post your whole code? Both for the inventory list and the subroutines handling it.

1 Like