Need help with descriptions in Inform 7

Hi there.

Name’s Mark Bauermeister. I’m the new one :slight_smile:

I started programming in Inform 7 two days ago and so far, everything went swift and easy. However, I ran into a problem, lately.
Basically, I want descriptions which are more like the ones in the Magnetic Scrolls games (without the whole “You see item 1, item 2, item 3, etc.”) The text should read something like “Awoken by the sound of a thunderstorm,
you find yourself in the middle of your living room. Tabby, your cat, is strolling around the floor, desperately looking for something to play with. A ball of wool is within the reach of Tabby. Closely examining your table, you find a buttercream cake conveniently placed around the center, while an apple is lying on the chair nearby”

Something along those lines.

Now how would I do this without having any unnecessary line-breaks/paragraphs in between? The [no line break] command doesn’t seem to work here.

My source code:

Does anyone see my mistake? Those paragraphs between the main room-description, “Tabby, your cat …” and the “The ball of wool …” are quite annoying.

1 Like

Hi Mark,

Probably the easiest (and most blunt) is an Instead Of Looking rule. Typing from memory:Instead of looking: say "[the description of the location] "; repeat with item running through every thing in the location begin; unless the item is the player, say "[the initial appearance of the item] "; end repeat; say line break.

That obviously makes a lot of assumptions and excoriates much built-in functionality, but it’s easy to understand, easy to modify with various special cases, and it gets the job done.

1 Like

Thank you, Ron.

I can’t really test it since class starts in a minute, but what I tested looks jolly good (the Tabby and ball of wool texts worked. Got a run-time error, because I did not define a initial appearance for some items, but that’s fixable).

1 Like

Ok. It solved part of the problem. But not without creating new ones.

Instead of looking:
say "[the description of the location] ";
repeat with item running through every thing in the location begin;
unless the item is the player, say "[the initial appearance of the item] ";
end repeat;
say line break.

Does work, as far as items in the room are concerned. However, it doesn’t work for items placed on other items (the apple which is place on the chair. The cake which is placed on the table). Also, the picture vanished (I suppose it’s tied to the look command, in some way).

EDIT:

That’s what the code looks like, as of yet.

1 Like

You are entering into rather complicated territory when you look at doing this kind of thing. Presumably, you’re more interested right now in learning the breadth of Inform (rather than the depth), but if you want to explore that territory, I’ve posted some resources below. A potentially easier solution–though I don’t have a copy of Inform on hand to verify this with-is to place a space after the final period of each of your initial appearance property texts. This may cause them to flow into a single paragraph, or it may simply remove the space between lines; I’m not sure exactly how the apparatus for printing object descriptions works. (You could also try using the “[run paragraph on]” token in place of that final space.)

Now, if you want to go the complicated route and learn about all the things Inform is doing under the hood to write room descriptions: There is an extension called Room Description Control that is designed to make it somewhat easier for you to change the way in which room descriptions are put together. Three other extensions, Ordinary Room Description, Single Paragraph Description, and Tailored Room Description, may help you better understand how Room Description Control works. In face, Single Paragraph Description may do exactly what you’re looking for.

Also, Jeff Nyman has written a nice tutorial to understanding aspects of the room description system; almost none of what he discusses is covered in the I7 manual. I believe that it’s no longer on the web (Jeff’s reworking it, I think), but if you PM with your address I’d be happy to email you a copy. Again, it may be more detail than you’re interested in right now, but you might like it later.

–Erik

1 Like

Thanks.

Tried Tailored Room Description, Room Description Control and Single Paragraph Description.

The first two seem nice, but are far too complex and take up too much valuable room IMHO. Heck, I used to program in object-based languages. I should be used to organize things in a certain grid, but handling those two extensions is too much for me :blush:

Single Paragraph Description is exactly what I was looking for. Is look just as good as Ron’s approach + graphics work now.

The only thing I still couldn’t figure out: How to include initial appearances of objects that are in the room but on another item, like the table? I tried all I could think of. Making the table an open container, writing ‘An apple is in the room on the table’ or ‘An apple is on the table in the room’. But nothing of this works. Am I missing something? Don’t say I need another extension :laughing:

1 Like

The problem was in the way you had defined your apple and chair objects. See the revisions here:

[code]Include Single Paragraph Description by Emily Short.

Living Room is a room.
“Awoken by the sound of a thunderstorm, you find yourself in the middle of your living room.” Tabby cat is an animal in the Living room.

The initial appearance of a fireplace is “”

The initial appearance of the tabby cat is "Tabby, your cat, is strolling around the floor, desperately looking for something to play with. ".
The initial appearance of a ball of wool is "A ball of wool, Tabby’s favourite plaything, is lying under the table. ".
The initial appearance of a small wooden table is "The table itself is made of sturdy oak wood. A fine craftsmanship you brought from Dover, several years ago. ".
The initial appearance of a buttercream cake is “Closely examining the table, you find a buttercream cake on it”.
The initial appearance of an apple is ", while an apple is lying on the chair nearby. ".
The initial appearance of the chair is “”.

A ball of wool is in the Living room. The ball of wool is fixed in place.
A small wooden table is in the Living room. The description of the wooden table is “Quite ancient”.
A buttercream cake is on the table.
The chair is a supporter in the Living room.
An apple is on the chair.
A fireplace is a scenery in the Living room.[/code]

–Erik

1 Like

Whenever I place something on the supporter (chair) the whole text (chair + apple) places itself above all other descriptions.

“Awoken by the sound of a thunderstorm, you find yourself in the middle of your living room. The chair itself bears the ornaments of the late Earl of York. while an apple is lying on the nearby chair Tabby, your cat, is strolling around the floor, desperately looking for something to play with. A ball of wool, Tabby’s favourite plaything, is lying under the table. The table itself is made of sturdy oak wood. A fine craftsmanship you brought from Dover, several years ago. Closely examining the table, you find that a buttercream cake is on it,”

I’m quite sure the solution is easy. But I don’t have any time left for this week (French & Economics exams). Damn.

EDIT: Never mind. Fixed it. Probably a typo or a mislead full stop or a gap between the quotation marks. Retyped those 2 initial appearances and now everything works as it should.

Thanks again.

1 Like

Oh, instead of “in the location” try “enclosed by the location”. (I think it’s called “enclosed by”.)

1 Like

Thanks Ron. I appreciate it.

Should the supporter code ever fail, I make sure to use the enclosed by command.

I’ve actually mastered all direction commands I need, for now.

Went on and created 4 other rooms and a door (fireplace). Experimenting with triggers right now. They seem to work well, the only thing I can’t quite figure out: How to unlock the fireplace at precisely 3:09? The fireplace is basically the portal to another (quite fantasy-esque) dimension. I coded most of the world behind it, but I can’t enter it since the fireplace stays locked. Tried “At 3:09 am: Unlock fireplace” but that doesn’t work.

I’m quite in a hurry, actually.

I want to publish the demo at precisely 3:09 am this Sunday (as a marketing gag, obviously) and all that stands in my way is the fireplace (+ some additional work on behalf of my homepage/FTP server)

EDIT: Actually. Opening the fireplace shouldn’t be a requirement. I could just describe the opening of the fireplace and then teleport my character right into the next scene, couldn’t I?

EDIT: Me dummy :laughing: “At 3:09 am: Move Player to Ancient Gate” is probably the smoothest solution. No need to leave the player in the room. Now I need to move Tabby the cat in there as well, and I’m all set.

1 Like

“At 3:09 AM:
move player to Ancient Gate;
move Tabby to Ancient Gate.”

should work, if I’m not mistaken. (Which is entirely possible."

I think if you wanted to unlock the fireplace at 3:09 AM, you’d do it thus:
“At 3:09 AM: Now the fireplace is unlocked.”
“Unlock the fireplace” is an action, which is something the player does. So if you write something like “Try unlocking the fireplace,” it’ll fail if the player doesn’t have a matching key, I think. To change the status of the fireplace at a given time you need to do it directly.

1 Like

Thanks Matt.

Already figured this out myself (see last edit).

I’m working on my homepage, right now. The demo will hit at precisely 3:09 am (GMT), this Sunday.

1 Like

Let us know where to find it! My curiosity is piqued now, and I’m all for cute pictures of kitties in games.

1 Like

Hehe.

The kitty picture isn’t mine, though. Found it on this mysterious thing those new age believers call THE INTERNET. Never heard of it before but now that I’ve tried it, it got me hooked :laughing:

Joke aside, I’m probably going to paint my own using this google picture as a sample.

BTW: Why is it that neither Inform 7 (MacOSX) nor Zoom (MacOSX) support audio?

EDIT: Nothing but issues from the homepage front.

Had to put a 2nd minus into the address, since the original name got overwritten shortly after registering the sub-domain and now I can’t even log into cPanel.

Might have to put it on Rapidshare, which is a lot slower (both download and upload).

1 Like

Would the IF archive be a place you could upload your thing? I don’t know what kind of issues you’re having, and I’ve never uploaded anything to it, but there’s no way that it could be as big of a pain to use as Rapidshare.

ifarchive.org/

Matt

1 Like

Rapidshare has never been my problem. My crappy domain provider was.

I’m going to upload it to IFArchive and Rapidshare.

Tinkering with the last big problem, right now. Inform simply won’t take any “if” command as it is supposed to be. It won’t take "If buttercream cake is carried by the player, say “Y.u.m.m.y. Troll likes cake” [otherwise] say “No cake! Troll angry! Troll slits you open!”

It won’t even take anything before the [otherwise] and if I simply type “If buttercream cake is carried by the player” all it does is adding an item named “If buttercream cake” to the inventory.

What I simply want to do: The player meets a cake loving troll who will only let him pass if he carries a cake. If the player doesn’t carry a cake or has eaten it, the troll exclaims and kills the player. After being killed, the player is moved to another room.

EDIT:

Ok two of three possible outcomes.

Instead of eating the buttercream cake in the presence of a troll: say “Argh”.
Instead of giving the buttercream cake to troll: say “Thank you”.

Now how do I link the “move player to” command to each of those sentences?

And how could the troll check if the player had a cake in his inventory?

Solved two out of three. Seems like I should better get used to colons :slight_smile:

1 Like

I’m pretty new to all this, but I think you want something like:

Instead of eating the buttercream cake in the presence of a troll: say “Argh”; move the player to The Graveyard.

The commands can be linked together with semicolons. (If you’re doing very complicated stuff, you want to indent things with tabs – I usually wind up doing that with a little trial and error.)

1 Like

Already did that, already did that.

And now here’s that damn demo.

I hope you guys aren’t too harsh in your critiques.

rapidshare.com/files/366094376/A … ire.gblorb

BTW: It was precisely 3:09 am (GMT) by the time I uploaded the file. I’m proud of myself. Kept to a darn tight deadline.

Time to go to bed now. *yawn.

EDIT: If anyone is puzzled by this kobold and why he’s talking such gibberish. I got that idea after playing through the bar part of Secret of Monkey Island (Gob: “Ask me about Loom”).

1 Like