I’m developing a rather ambitious Twine game using Sugarcube 2.35. I’ve run into some roadblocks, so I’d love to post here when I need help!
Currently, I’m dealing with two main issues:
First, I can’t figure out how to make
<<links>> type out text. I’m looking for a sort of middle ground between a link-replace and a normal link. What I’m attempting to accomplish is a button to pick up an item;
<<link "Pick up item.">>. It runs an
<<if>> statement when clicked, checking if you have enough inventory space. If you have space, you’ll pick it up. If you don’t have space, then it’ll say “You don’t have enough inventory space!,” yet the link still remains (hence why it can’t be a link-replace). Any ideas on how I can do this? Placing simple text or even a print function into the
<<else>> of the if statement inside the link doesn’t seem to do anything.
Secondly, I’m trying to make a digestion system. If you eat something, it increases your “fullness;” if you’re too full, you can’t eat something that goes over your fullness (an idea that also suffers from the previous issue). When you eat something, it’s added to an array, with an HP stat and a weight stat. Every digestion tick (custom system I’ve already made), the first item in the aforementioned array will lose 1 point of HP, and will add 1x its weight stat to the player’s weight. My question here is, how can I make an array, where each index has its own stats? My idea was to simply make a nested array, but then I don’t really know how to select the first index of the digestion array, and then the first index of whatever’s being digested. Would it be something like
$digestion[0]? I also need to be able to read the first value of all these nested indexes, as the HP will be added up in order to calculate your fullness. Though this seems pretty straightforward, as once I know how to read nested arrays, I just need to take digestion.length and use a
<<for>> loop to add the HP values of each item inside digestion.length. EDIT: I’ve figured this one out! Although I’m leaving it here in case anyone has feedback to give on it–maybe I’m making some huge mistake programming it this way? ;0
I greatly appreciate any help I can get! Thank you so much for your time