Inventory not updating

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

Does the text

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]

displays?

1 Like

Hiya! yes, that displays
But when I check inventory, these items are not there

Hi, I found the problem, notepad++ is no longer saving the files , is saying they are protected and I need to run as admin
I don’t know how to fix but this is why nothing is workibg

EDIT- I reinstalled notepad ++ and this issue has gone, cannot find a fix to the inventory though

This error was cauzed by notepad not actualy saving! Fixed now

So the problem fixed for you?
It’s a good habit to develop fidgeting fingers habit, but over Ctrl + S.

It is fixed, it was a very interesting problem!
The choicescript stats file was locked , so what I was writing in notepad++ wasn’t saving to it
It looked as if I was making changes but they were just sitting in notepad++ and not going anywhere
I have no idea why or how the file got locked but I ended up reinstalling notepad++ and all good!
Cheers!

Np++ usually shows red sheet :page_facing_up: at the editor’s tab at the top, when the file you’re editing has changes but not yet written to the directory in your disk.

It goes white when you finally saved the changes.

Let’s see if I can snatch an SS or two to show

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.