I suppose this would be the correct place for it since it's still Twine 2.0, but I'm curious if there's been any stats systems implemented for SugarCube in conjunction with inventory systems/item use? Particularly for an RPG type game?
I don't mind writing a scripted thing, but it'd be cool to have different options based on stats at the most to choose from.
I was looking at this thread but I can't get the code to work in a test environment. I understand what the code is doing and I could use it, but it's not working in SugarCube 1.x.x
Then clicking the according link, it ups strength to 1. Hopefully I can branch out from this and hopefully this is helpful to anyone else.
eg. In your StoryInit passage you would initialize your $strength variable to zero: ... next in one of your passages you would have something like the following: ... and finally within the Free Weights passage you would have something like:
Additionally, there's nothing wrong with doing each statistic as a separate variable, so what exactly about a few statistics calls out for a Map, specifically I mean? I'm not trying to be antagonistic here. It simply seems like since Maps are pretty much the only data structure Harlowe offers, which would be useful here specifically, you seem to be falling to the notion of Maslow's hammer.
I'm not saying Maps wouldn't be appropriate here, they would, but they're no more appropriate than using separate variables or other data structures, like generic objects.
I'm also not saying not to use Harlowe. If you like its syntax, then by all means do so. However, it's a bit disingenuous to imply that SugarCube lacks similar capabilities (or, for SugarCube 2.x, the exact same capability, Maps).
At this point in time, unless there's inventory code that I can switch to that works in Harlowe, I have to use SugarCube. The code for SugarCube seems easier to understand anyway @cressidahubris but I'm probably eventually going to move to Harlowe. I just like making RPG-ish stuff, so it made sense for me to start in SugarCube because I needed an inventory system, and I didn't find any working code in Harlowe for that, so, eh. Unless I didn't look hard enough.
Also thanks @greyelf, I thought the code had to be something like that but I was working on it after 5 or so hours and decided that would be fine. I was planning on having it where a person would be able to choose an option, and it would lead to a passage where the str+1 would be on it, and then they would continue on. Or a cha+1 or dex+1, etc, etc.
Also I was having trouble with the bit as well, but this solves it. Thank you!
The choice of which story format to use is a personally one but here are some things to look for when making that choice as a novice.
Having access to well written documentation with examples can be a major benefit to someone learning, they also help more experienced people as well.
b. Macro Syntax:
Flame wars have been started over which programming languages (and that is what the macros are) are easier to use than others, but the simple fact is that some people will find that one syntax makes more sense/feels more comfortable to them than another does and this is normal.
c. List of Available Macros:
It is a good idea to read through a story format's documentation to create a mental overview of the sort of macros that are available.
e. Update Frequency and Access to Story Format's Developer:
How quickly are bugs fixed and new features added? How easy is it to access the Developer to ask questions?
Though, honestly, I was looking at another RPG game in Twine 2 and the Harlowe dataset looks really easy to use. I just wish there was an inventory system with some established code or something I could use in Harlowe, cause then I would switch.
That, and I like being on the cutting-edge of things, lol.
As TheMadExile stated above, SugarCube supports all the datatypes that Harlowe does:
a. Harlowe: Array, Set (dataset) and Map (datamap)
b. SugarCube: Array, Set, Map and Object
Meaning, my personal preference, between the two formats, is to use Harlowe in that situation. It doesn't mean that you can't use SugarCube or that other people don't use SugarCube. It says exactly what I mean for it to say: I prefer to use Harlowe, and if the person asking the question is flexible and would switch to Harlowe to make their stat system, I could personally help them. If not, someone else would hopefully step up to help them.
And Greyelf came in and helped the person, so thank you.
EDIT: To be clear, this isn't about you, nor is this about Harlowe. I don't care which story formats people choose to use (I've given help on Harlowe before, and likely will continue to do so). This also isn't about what you intended to say. It's about your specific wording and the implication therein. I wouldn't have felt the need for my original post on this topic had you said something like, "You can also do this in Harlowe. In particular, I like using (datamap:) for this sort of thing.", which doesn't call out SugarCube or make any implications at all.
And I'm done with this derailment.
@TheMadExile it's cool lol
Oh and @greyelf so it's possible to work with an inventory in Harlowe then? Also by cutting edge, I just meant that Harlowe came with the release of Twine 2 or so I've been given an impression of, so I just meant it's newer.
Edit: Still working in sugarcube, by chance does anyone know how to make an if statement and a link but using a stat? I have:
Newer does not mean better. And, for that matter, SugarCube 2.x is newer (in most respects) than Harlowe, so that must mean it's more cutting edge and better.
Note: I am not actually saying that SugarCube 2.x is better than Harlowe, they're different and that's about all you can say, outside of personal preference.
I believe that the Harlowe page on neocities is the most complete source, though I think that it's a little outdated now.
If you haven't already, I'd suggest reading the SugarCube 1.x <<if>> macro documentation.
What are you setting those story $variables ($built, $pudgy, $sickly) to? What is their purpose? Where are you setting them? What do you actually want to test for in the <<if>> macros?
Assuming that you've set each of the $variables to the number 1 (not the numeric string "1"), then that should have worked. That said, those conditions will only become true if the $variables are set to exactly 1.
If you intended to test if they're greater-than-or-equal to 1, or something similar, then you need different operators (as described within the docs I linked).
Try the following to set your $variables: And the following to test if they're exactly 1: Or the following to test if they're greater-than-or-equal to 1:
Alternatively, if these $variables are supposed to be boolean flags (yes/no, true/false), then instead of using numbers, I'd suggest using actual booleans. For example, to set the $variables: And the following to test if they're true:
Also thanks for that documentation, I'll go have a gander at that but I'll probably be sticking with SugarCube for this story at least. Also, I have SugarCube 1.0.26, is there a newer version or something somewhere (not a beta version)?