Hey, guys. I had a really good idea for an text-based RPG. It would have global variables, and it would be driven by player options: such as
Are you a man or a woman?
I am a man
I am a woman
So my question is: how can I write options in inform, and also apply global variables such as stats, hit points and levels?
For options, this is what i have started with:
Are you a man [A] or a woman [B]?
Understand [letter] as selecting.
“An choice called optionA is a choice” .The choice [A] is [A=I am a man]
“A choice called optionB is a choice”.The choice [B] is [B=I am a woman].
what exactly have i done wrong?
For global variables, you can do something like this:
The difficulty rating is a number variable. The difficulty rating is 2.
But that isn’t all that useful for things like levels and hit points, which you’re going to want every character to have. So you’d want something more like this:
A person has a number called level. The level of a person is usually 1. The level of the player is 3. The level of Gshograt the Antepenultimate is 184.
For asking multiple-choice questions: it seems as if you’re basing your code there at least in part on the example Down in Oodville, which is fine, except that Oodville is a moderately complicated example, and you’ve yanked some bits of it out and ignored others, so it won’t work. (Selecting, for instance, is not a standard I7 action; you need to define it before you can refer to it.) The other issue is that your code is very malformed; in some cases you’ve used Oodville code but written it out incorrectly (Understand won’t apply to things not in quotes, and [letter] isn’t recognised in I7 the way that [number] is), and mostly you’ve just made wild guesses about how to express things, which is never likely to work.
Probably more appropriate to your needs is the extension Questions. Even with that, though, you will need to be methodical and meticulous about how you write your code. Inform 7’s natural-language style can make it seem as if you’re allowed to just say whatever you want; in reality, you have to be as careful and exact as you would in any programming language.
I’m not meaning to be cruel here; it’s just important to recognise that I7 demands that you be somewhat rigorous about what you write.
Well, you could just write “you” directly. I assume you want this for stuff like “The monster can see [the player]”, but in most cases that has to be special-cased anyway because of verb conjugation ("[The noun] is wounded" would become “You is wounded”).
how do I do it, so that there is a list of available options, such as a, b, c, d, e, f, g and so on?
That is to say, making it a choose your own adventure style thing, as oppose to a traditional adventure.
If you want to use Inform 7 to write a CYOA style game, you should go to this extensions page, download either ‘Simple CYOA by Mark Tilford’ or ‘Adventure Book by Edward Griffiths’.
After download, open the Inform application and choose ‘Install Extension’ from the File menu. You can now use the extension in any Inform project you choose by putting a line like this in your source for that project: “Include Adventure Book by Edward Griffiths.” or “Include Simple CYOA by Mark Tilford.”
You can find a list of all Inform extensions that are installed on your computer from inside the Inform application; and you can also read the documentation for the extensions from there. (You can also find the documentation on the site with the downloads above.)
If you want to write CYOA, why do it with Inform? There is absolutely no advantage. You’d be much better off with a system specifically designed for this purpose, such as Quest (using gamebook mode) or Inklewriter.
Inklewriter, at least, is really not designed for a traditional CRPG or CYOA RPG; Jon has written about how its design philosophy is very unlike that of RPG gamebooks. Undum or Choicescript are more explicitly set up for that kind of thing. (I cannot speak to Quest.)
“In Choicescript, I gather, your design is constrained by the Choice of Games design philosophy – which is great if you want to make a Choice of Games -like work, but difficult or impossible if you don’t.”
I want to make a CYOA but with a complex levelling system. Does choicescript allow for that?
Uh, depends what you mean by ‘complex levelling system’. With ChoiceScript you can track level, and have stats change upon levelling up. You can also probably have the player make choices on what class they level up in (or whatever your system has) but you couldn’t have them do this in the middle of doing other parts of the story. The kind of game you want to make is probably not a choicescript game. But why not play through a few and decide for yourself?