Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

having trouble with basic inventory

Hello I am completely new to this and I have been pouring over forum links and the Harlowe wiki and for the life of me I can't figure out what is wrong.

I started with this site which gave the the basics but its an array. I am going to use just word based things so I think a data set would be better (ds:) so i added that instead.

I would like to have a thing that only displays a link if you have something in your inventory.
here is my code:
"I dont know much, but I know I am feeling like spagetti. Here is a list of ingredients."
(set: $inv to $inv + ("list"))

[[Do you have any money?|money]]
(if: $inv is in ("some money"))[[Go outside|outside]]

and I keep getting
the number 0 cannot contain any values, let alone the string "list"
and I can't figure out how to fix it. Did i get the syntax wrong?

Comments

  • Please state the name and full version number of the Story Format you are using, as answers can by different for each one. Based on the fact you are mention the (ds:) short-cut for (dataset:) I will assume you are using Harlowe v2.0.0

    note: You don't include the initialisation of the $inv variable in your example so I will assume it is something like the following, and that for testing purposes you have added an "some money" item to your $inv dataset.
    (set: $inv to (ds:))
    (set: $inv to $inv + (ds: "some money"))
    

    There are a number of syntax errors in your examples:

    1. You are missing the ds macro name in your (set:) statement, which is needed when adding a new element to an existing dataset collection.
    2. You have reversed the right and left sides of your is in operator.
    3. Your (if:) macro is missing its associated unnamed hook.
    4. [optional] You have unneeded parentheses around the String "some money"

    Try the following:
    "I dont know much, but I know I am feeling like spagetti. Here is a list of ingredients."
    (set: $inv to $inv + (ds: "list"))
    
    
    [[Do you have any money?|money]]
    (if: "some money" is in $inv)[ [[Go outside|outside]]]
    
Sign In or Register to comment.