some Noob questions

howdy

I´m currently learning Inform 7 in order to write a text adventure

so I want to know which of the following things are possible in IF7:

-) displaying text in a different colour (to provide dual narration)
-) multiple choice dialogues with consequences
-) talking to npc about certain predefined topics (like talk to man about weather)
-) hidden scores

thanks

Yes. See the extension Basic Screen Effects by Emily Short that comes pre-installed.

Yes. See http://www.inform-fiction.org/I7/Download%20-%20Extensions.html#topic27, for example Quip-Based Conversation by Michael Martin should do the trick.

Yes. See chapter 7.6. in the manual.

Yes. (I assume “hidden score” means keeping score that isn’t visible to the player. The exact technique depends on what purpose the score is ultimately used for.)

how does one apply multiple clauses to an action: like e.g. “instead of dropping the pen when you are in room 2 AND wear a girdle”?
can’t get this to work…

The player character must be referred to as “the player” in the code, and “location” is used for “the current room the player is in”. Also note that all parts of the phrase must be written fully, that is “when the player has the duct tape and the hammer” won’t work but “when the player has the duct tape and the player has the hammer” will. Try this:

Instead of dropping the pen when the location is room 2 and the player is wearing a girdle: [...]

ok, that works now

but how to add exclusions, like Instead of dropping the pen when the location is room 2 and the player is wearing a girdle UNLESS something something… e.g. the player carries the magic wand

or another case: if any 2 of 3 given conditions are fulfilled…

thanks

I am not completely sure about how to do this either, but I think you would use something like this (tested): Instead of dropping the pen when the location is room 2 and the player is wearing a girdle and the player is not holding the magic wand: [...] Hope this works!

This is basically the same as requiring the opposite condition.

Instead of dropping the pen when the location is room 2 and the player is wearing the girdle AND the player is NOT carrying the magic wand

There is no built-in logic for this, but you could write a procedure of your own to do it.

[code]Instead of dropping the pen when the required conditions is at least 2

To decide which number is the required conditions:
let X be zero;
if the location is room 2, increase X by one;
if the player is wearing the girdle, increase X by one;
if the player is not carrying the magic wand, increase X by one;
decide on X.[/code]

Note that “the required conditions” is an arbitrary label. We could also say “the magic ingredients” or “foobozzle” or whatever.

Actually, here’s a way that reads a little better:

[code]Instead of dropping the pen when sufficient conditions are met:
[etc.]

To decide whether sufficient conditions are met:
let X be zero;
if the location is room 2, increase X by one;
if the player is wearing the girdle, increase X by one;
if the player is not carrying the magic wand, increase X by one;
if X is at least 2, decide yes;
otherwise decide no.[/code]

some more questions:

  1. how do you do something WITH a thing, e.g. cut me with knife…?

  2. how do you get multiple outcomes of a random selection : e.g. 1/3 chance “Yes”, 1/3 “Maybe” and 1/3 “No”, and only one of these is the result, not 1/3 chance for every event (don’t know how to explain this better)

[s]1. There might be another way to do this, but I think this is the most useful when you get into more complex coding:

Check cutting something: if the noun is yourself, say "Ouch!" instead.[/s]Edit: Oops! I forgot that you wanted to cut something with something. Disregard the above text, and look on the next page for a better answer.

  1. Chapter 5.6 in the documentation has some good information about having random text, and 8.17 has more information about randomness in general; both of the descriptions there are probably better then I could explain it here.

There’s no “cutting something with something” action in the standard library, so you’ll have to make one yourself. See chapter 12.7. in the manual and especially chapters 6.1. and 6.2. in the recipe book.

You would have to define a new action. Start with something like this:

[code]Slicing it with is an action applying to one thing and one carried thing.

Understand “cut [something] with [something preferably held]” as slicing it with.[/code]

You would then have to write check, carry out, and report rules to make it do the things you want it to do in your game. Check the documentation, 12.7-12.9 and 12.17.

If you’re talking about just displaying random text, you would use a [one of]…[sticky random] construction:

say "You shake the magic 8-ball. It says, '[one of]Yes[or]No[or]Maybe[sticky random].'"

That picks a random choice the first time the text is printed, then sticks with that choice for all subsequent times it is printed.

If you’re doing something more complicated, you can declare a value that varies, randomize it once in your code, and then refer to that value whenever you want.

[code]The outcome is a number that varies. When play begins: change the outcome to a random number from 1 to 3.

if the outcome is one, […];
otherwise if the outcome is two, […];
otherwise […];[/code]