Howdy, Stranger!

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

Inventory system in Harlowe with Menu

Hello all!

Let me preface this by saying my coding knowledge is limited. I'm definitely new at this...
Would anyone be able to help me out with how to make an inventory system with a menu function using harlowe?

I have a character with a backpack, and inside the backpack there are several items and some have a number value like ammunition or number of items of food, so forth.
What I'd like to be able to do, is in one broad stroke inside one passage named something like, "Backpack", list all the contents for the player, along with the number of each item.

Throughout the story, the character will either be in a situation when he is using up items, like food or ammo, or he is in situations where he is forced to leave items behind, i.e the entire backpack, or just a knife or a gun or some ammo.

What I have is something like this:

Passage name - "Backpack"

(set: $backPack to true)

(set: $canned_beans to "CannedBeans:16oz canned beans, non-fat", true)
(set: $canned_beans_left to 2)

$canned_beans_left - 16oz canned beans, non-fat

(set: $shotGun to "Shotgun:double-barrel 12 gauge")
(set: $shotGun_shells to 2)
(set: $shotGun to true)
1 - 12 gauge shotgun, double barrel
$shotGun_shells shells

(set: $knives to (datamap: "Machete:Solid carbon steel 38cm fine edge on one side; 46cm high-
performance saw blade on the other; 64cm overall.", true, "Knife:8cm blade; 18cm overall blade,
serrated razor-sharp.", true, "Throwing knife:18cm with piercing points.", true))
(set: $machete to true)
(set: $knife to true)
(set: $throwingKnife to true)

1. I don't know how to show the player this information in a sort of bullet-point list, and the latter part of the code seems redundant since I've already told the datamap that those items are true. But they are super long and don't have short variable names. Which is why I put them in there at the end with shorter names. Is that not necessary? How do I show the player this information in a list in the same passage?

2. I also don't know how to make this a clickable menu item no matter where the player is in the story, the player should be able to reference the list of items and how much ammo and food they have.
Not only is this not really working well, there are huge gaps of white space in the items listed.

Is this possible in harlowe?

Thank you in advance!
(sorry for my ignorance - help me learn!)
Ps. for the future how do I get the code I'm referencing to appear in yellow in here like everyone else is doing?

Comments

Sign In or Register to comment.