I’m having trouble with the inventory, it works on one scene and not another.
The error I’m getting is that items bought in a shop in an earlier scene update, items in another scene do not
My code looks like this, startup is set as follows (edited to just the relevant bits):
*create gold 20
*create empty_inventory true
*create translation false
*create dynamite false
*create gun false
*create knuckle false
*create provisions false
*create poisons false
*create map false
*create boxing false
*create instant_win false
*create machete false
*create backpack false
*create rope false
*create matches false
*create suit false
*create hook false
The choicescript stats looks like this:
*stat_chart
text Skill
text Stamina
text Luck
text Gold
*if bullets_number !=0
Bullets: ${bullets_number}
*temp inventory ""
*temp comma false
*if (empty_inventory)
*set comma true
*set inventory &"You are carrying nothing"
*if (translation)
*set comma true
*set inventory &"Translation Book"
*if (dynamite)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Dynamite"
*if (gun)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Gun"
*set bullets_number + 6
*if (bulletclip)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Clip of 6 bullets"
*set bullets_number + 6
*if (knuckle)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Knuckle Duster"
*if (provisions)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Provisions"
*if (poisons)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Book on poisons"
*if (map)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Map"
*if (machete)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Machete"
*if (backpack)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Backpack"
*if (rope)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Rope"
*if (matches)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Matches"
*if (suit)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Safari Suit"
*if (hook)
*if comma
*set inventory &", "
*set comma true
*set inventory &"Grappling Hook"
Inventory: ${inventory}
*line_break
The working bit looks like this:
*if (translation = false)
*selectable_if (gold >= 5) #That translation book looks useful
“I think someone once said that to learn another language is to offer the hand of friendship” says the shopkeeper.
*set empty_inventory false
*set translation true
*set gold -5
*goto top
But this code is not updating the inventory (but it does update Gold)
Your luggage is in the room. Lady Jane has provided equipment for the adventure in the form of a [i]machete, backpack, rope, book of matches, safari suit, a grappling hook and 5 gold coins.[/i]
*set empty_inventory false
*set machete true
*set backpack true
*set rope true
*set matches true
*set suit true
*set hook true
*set gold + 5