When you assign an Object to a variable like so
<<set $Keys to {
"name": "Keys",
"Description": "Your house Keys"
}>>
... the variable actually contains an Object Reference to where the actual Object is being stored in memory, and you can't use the <array>.contains() function to look for an Object Reference.
Background information:
Each time a Passage Transition occurs then current state of all known story variables of copied, the original is added to the History system and then copy is made avaiable to the Passage about to be shown.
This means that after a Passage Transition your $Phone variable no longer references the same Object it did before that transition and the same is true for the $inv Array, which also means that the story variable and the Array are now referencing two different copies of the original 'Phone' Object.
This is why we recommend defining your Object using "keys" like so
<<set $items to {}>>
<<set $items["SchoolTimeTable"] to {
"name": "School Time Table",
"Description": "Shows you what class you have at what time."
}>>
<<set $items["Phone"] to {
"name": "Phone",
"Description": "Your Phone"
}>>
<<set $items["Keys"] to {
"name": "Keys",
"Description": "Your house Keys"
}>>
... and to use those "keys" when doing things like tracking inventory like so
<<set $inv = []>>
<<set $inv.push("SchoolTimeTable", "Phone", "Keys")>>
You can now use those "keys" to determine if the $inv story variable Array contains a specific item, and also access the properties of a specific item.
<<if $inv.contains("SchoolTimeTable")>>
The inventory contains a <<= $items["SchoolTimeTable"].name >>
<</if>>
<<if $inv.contains("Phone")>>
The inventory contains a <<= $items["Phone"].name >>
<</if>>
<<if $inv.contains("Keys")>>
The inventory contains a <<= $items["Keys"].name >>
<</if>>
NOTE:
If the properties of an Object do not change after it has been initialised then you should define it on the special setup Object instead, that way it doesn't consume storage space in either History or Saves.
<<set setup.items to {}>>
<<set setup.items["SchoolTimeTable"] to {
"name": "School Time Table",
"Description": "Shows you what class you have at what time."
}>>
<<set setup.items["Phone"] to {
"name": "Phone",
"Description": "Your Phone"
}>>
<<set setup.items["Keys"] to {
"name": "Keys",
"Description": "Your house Keys"
}>>
<<set $inv = []>>
<<set $inv.push("SchoolTimeTable", "Phone", "Keys")>>
<<if $inv.contains("SchoolTimeTable")>>
The inventory contains a <<= setup.items["SchoolTimeTable"].name >>
<</if>>
<<if $inv.contains("Phone")>>
The inventory contains a <<= setup.items["Phone"].name >>
<</if>>
<<if $inv.contains("Keys")>>
The inventory contains a <<= setup.items["Keys"].name >>
<</if>>