Cant seem to make my equipment/invetory concept work!

Additional to what @svlin advised…

The information in your $clothing variable is what’s commonly knows as Stateless or Static, which basically means that once initialised it doesn’t change during playthrough…

Story variables are best suited storing Stateful or Dynamic information, like values that change during playthrough, or values supplied by the end-user (like a character name). This is because Story variable values are store in Progress History and Saves.

I suggest you move the data structure to the special setup variable, as its contents doesn’t get stored in History or Saves…

<<set setup.clothing to {
	head: {
    	name: "Gladiator helm",
        equipped: false,
        description: "A golden helm warn by the strongest of arena fighters, it grants +10 armor and muscle",
        stats: "<<set $muscle +=10>><<set $armor +=10>>",
        undostats: "<<set $muscle -=10>><<set $armor -=10>>"
    }
    chest: {
        name: "Gladiator chestplate",
        equipped: false,
        description: "A golden chestplate warn by the strongest of arena fighters, it grants +10 armor and muscle",
        stats: "<<set $muscle +=10>><<set $armor +=10>>",
        undostats: "<<set $muscle -=10>><<set $armor -=10>>"
    }
    	Arms: {
    	name: "Gladiator braces",
        equipped: false,
        description: "A pair of golden braces warn by the strongest of arena fighters, it grants +10 armor and muscle",
        stats: "<<set $muscle +=10>><<set $armor +=10>>",
        undostats: "<<set $muscle -=10>><<set $armor -=10>>"
	}
    	Belt: {
    	name: "Gladiator belt",
        equipped: false,
        description: "A golden belt warn by the strongest of arena fighters, it grants +10 armor and muscle",
        stats: "<<set $muscle +=10>><<set $armor +=10>>",
        undostats: "<<set $muscle -=10>><<set $armor -=10>>"
	}
   		legs: {
	    name: "Gladiator boots",
        equipped: false,
        description: "A pair of golden boots warn by the strongest of arena fighters, it grants +10 armor and muscle",
        stats: "<<set $muscle +=10>><<set $armor +=10>>",
        undostats: "<<set $muscle -=10>><<set $armor -=10>>"
	}
}>>

Which means that references like $clothing.head or $clothing['head'] would become setup.clothing.head and setup.clothing['head']

2 Likes