I’ve been trying to make a basic list or inventory for some time now and I think I have the list right but I just can’t seem to get the right command to set items as true. I keep getting this error every time I try to set an item as true: “Invalid expression at char 14, expected OPERATOR, was: VAR [true]”
Inventory items should be listed in startup.txt, generally starting with a default value of false (not in player’s possession) e.g.
*create sword false
*create axe false
At any point in any ordinary scene file where the player acquires an item, you need to set that item to true, e.g.
The mercenary captain offers you your choice of weapon.
*choice
#I'll take the sword.
*set sword true
You take the sword.
*finish
#I'll take the axe.
*set axe true
You take the axe.
*finish
Where you include the inventory code in choicescript_stats.txt for display purposes, you now just need to make sure both ‘sword’ and ‘axe’ are included in there, so either / both will display once set to true at any point in the story, e.g.
If this player had accepted the axe, and already had a shield and helm set to true, on the stats page the above would display as:
Inventory: Axe, Shield, Helm.
If you still have any trouble getting it to work as required, post your problem code here using < pre> before and < /pre> after it (but without those spaces) so it displays like the above code (the forum loses your indentation otherwise).
Okay but when I try to set an item as true it isn’t read. Does it need to be listed as: *set sword true or *set Inventory “sword” true. I’ve tried both but with the former example the game just glosses over it and doesn’t read the command but if I try the latter I get the error I mentioned before: “Invalid expression at char 14, expected OPERATOR, was: VAR [true]”
The fact that it’s an inventory item is actually irrelevant (except on the Stats page).
If the game appears to be ignoring your use of that command, it must be in the way you’re coding it (e.g. it’s impossible to skip it in the way it’s used in the above example).
I’d recommend posting your code here, including a chunk before and after where you actually use the *set command.
Their cheers as you depart are incredibly gratifying and Cedric gives you an emphatic salute and a smile, you just made a friend.
*set Companions Cedric true
*set Companions empty false
*create empty true
*create Cedric false
*create Princess false
*create Companions ""
*create comma false
And here is the problem code:
Their cheers as you depart are incredibly gratifying and Cedric gives you an emphatic salute and a smile, you just made a friend.
*set Cedric true
*set empty false
Okay, I did that and no error came up but my stat screen still isn’t reflecting the change. After the line of code the Companions list still reads: “You are alone” even after I set Cedric true and empty false. I don’t know what else to do unless it’s a problem with my stat chart itself.
Did you *set Companion “Cedric” as well? You need to set the variable that changes the text to “Cedric”. Of course, we can’t be certain of the mistake until you post the full code