Okay, so I'm using these macros
to help set up an inventory system. It's working just fine, and adding things properly, but I was wondering if there's a way to have it use the added info in a calculation so that it can display in a more immersive way. For example, the player starts with 80 units of food, stated in the story to be enough food for about a week. In the inventory, I don't want it to display as "80 food units", because this isn't the space future and food doesn't come in units. What I would want it to display is more like "Food: 8 days", with a background calculation of $food = 80/10. This is all so that later on as the player starts traveling, I can put into passages that to travel in X direction will subtract Y days worth of food (set $food to $food -30) and have it continue to display properly on the inventory page. Is this doable?
My other question, about the sidebar: is there a way to remove the forward/back buttons or have them selectively enabled? I don't want to hide the sidebar entirely, as the link to the inventory is there and I hope to use the save mechanic as well, but I feel like being able to go back will mess up the flow of the story.
I'm using SugarCube 2.0 in Twine.
The particular inventory macros you're using are more of a key item type—i.e. they don't track quantity. Additionally, you mention a $food variable, which really doesn't make sense in context of those macros.
Is the food tracking bit supposed to be separate from the inventory (macros)?
Not necessarily; I mean, it is a component of the inventory, but as it's affected by time and distance, and nothing else in the inventory really would be, I suppose it is sort of separate. But I still don't really have enough knowledge about how to construct macros to know how to do a separate thing just for food tracking.
For example, if simply displaying the player's food situation whenever you display the normal inventory is fine, then you could simply do something like: The call to toFixed(1) is simply there to keep the displayed decimal places under control.
I'm not trying to talk you out of putting the food into the inventory, however, to do so would require you to use different inventory macros—since, as I mentioned, the ones you linked do not track quantity at all.