C. Everett's Problems/Questions (1 PROBLEM+0 QUESTION)

NEW PROBLEM:
I have a few things whose descriptions will change a bit if the player has already looked at certain other things. I think I need an if statement in brackets before the added text, but I’m not sure how to word it. “If x is/has been examined/looked at/discovered”?

[rant=SOLVED PROBLEMS]NEW PROBLEM:
I don’t know what I need to do to let the player activate the drone. Code so far is:

The drone is either active or inactive.  The drone is inactive.  Activating is an action applying to one thing.  Activating is making the thing active.  Understand "activate [something]" as activating.  



Instead of going when drone is inactive:
	say "testing 2"

(I’m going to fill in ‘testing 2’ later.)[/rant]

[rant=ANSWERED QUESTIONS]NEW QUESTION:
I need to make a few usable computers in my game, which will primarily be used to view journal entries and retrieve certain pieces of information. How exactly would I go about doing this?[/rant]


Slogging through the documentation is giving me a headache, so if you just want to tell me of a specific part of it (the documentation) that’ll fix my problem, instead of trying to explain it yourself, feel free to.

First problem. The game I’m working on now (my first) centers on the A.I. of a small, abandoned, research lab wandering around through a work drone proxy. I want the player to have to perform an action like “activate drone” or “sync drone” before being able to move, basically. Except I have no idea how to go about this.

Second problem. This is probably a stupid, newbie problem, but anyway: the starting room is called “A.I. Personality Core”. I don’t know how to get the periods in the ‘A.I.’ abbreviation, or if I even can.

Third problem. Not really that vital, I was just wondering if there’s a simple way to have a door have a different name depending on which side of it you’re on. Like “door to Richard’s Quarters” becomes “door to Hub” when you’re in Richard’s Quarters. I seem to remember seeing something about “double-faced doors” somewhere, but I have no idea where that was.

And I just want to say I feel lazy asking for help instead of scouring the documentation, so feel free to tell me to bugger off if the mood strikes you.

(Oh, and I’ll try to dump any more problems I encounter in this thread, instead of starting a bajillion others.)
(Thread previously called “More (assorted) problems”)

You could add a before rule:

[code]Activating is starting up.
Syncing is starting up.

The drone is either active or inactive. The drone is inactive.

Before doing something when the drone is inactive and the current action is not starting up:
say “You can’t do that while the drone is not activated!”;
stop the action.[/code]

Edit: I may have misread the question, so if you mean that only moving to other rooms should be disallowed then just:

Instead of going when the drone is inactive: say "The drone can't move while it's inactive."

You can call the room something else in the code and give it a printed name (see example 18 in chapter 3.11):

The AI Personality Core is a room. The printed name of the AI Personality Core is "A.I. Personality Core".

See example 61 in chapter 5.5 and use the printed name property just like with the room name.

Nitku gave some good answers while I was writing a reply. Since I was already done writing before I noticed, though, here’s what I had in mind:

If you have question that you’ve taken the time to post, then it’s likely that 5 (or 50, or 500) people also have the same question but for whatever reason were reluctant to ask. We’re all here to learn about Inform, but if no one starts any threads no one else will learn anything. In other words, ask away. :slight_smile:

Second and third problems:
You want to use a property called “printed name” that can be assigned to things; this property defines what appears in the test game when Inform wants to refer to the item (but only in the test game; not in your actual code). One complication here is that the player will only ever see this printed name, so you’ll want to make sure the test game will understand what the player means when they refer to something by the printed name you’ve chosen by using the phrase “Understand…as.”

For example:

[code]Room1 is a room. The printed name of room1 is “A.I. Personality Core”.

A door called the multinamed is south of room1 and north of room2. The printed name of multinamed is “[if the location is room1]door to Richard’s Quarters[otherwise]door to the A.I. Personality Core[end if]”. Understand “door” or “door to richard’s quarters” or “door to ai personality core” as the multinamed.

The printed name of room2 is “Richard’s Quarters”.[/code]
If Inform ever gives you a problem about the printed name of something (for example, regions can’t have the printed name property) could just write:

Rule for printing the name of whatever: say “Insert your message here”.

I made your example more complicated in one additional way. If we have something that will have periods in its name, this could present a problem (note I didn’t write Understand “door to a.i. personality core” as the multinamed). There’s an extension automatically included with Inform 7 called “Punctuation Removal.” If you take a look at the documentation for that extension, it’s fairly self-explanatory.

Your first question could be much more complicated, and a little more information will be needed to answer it. Does the player act through the robot some of the time, or all of the time? Are there multiple characters to be played, or are you attempting to set up a situation in which there is a main character who gives orders to a robot avatar (like that old game, Suspended)?

If you’re just starting out and having trouble with the documentation for Inform 7, there’s a good resource that’s helpful and easy to understand linked at the Inform website under the news item “Jim Aikin’s Inform Handbook completed”.

First, I just want to say thanks to both of you. I’ve nearly got the bones of my game world in place now.

Second:

There are three possible bodies in the game. The drone, which is what the player uses for most of the game, an organic artificial body, and an advanced robotic body, the latter two of which are each used in a different ending.

It’s not so much a main character giving orders to a robot avatar, it’s more like the A.I. character controlling the drone through a direct link. So, the drone acts as the player for most of the game, but the player can switch into one of two different artificial bodies near the end of the game.

Nitku’s first suggestion, “Before activating…” should basically be all you need for the various robots. If not, or if you need help refining the particulars, feel free to ask.

Re: “New problem”

Hmm, I was really surprised to see that the code you posted even compiled, as I’ve never seen anything written that way before; I say that not as a knock on you, but as an expression of frustration with Inform’s often arcane ways. Here’s what I would suggest:

a) The drone can be active or inactive. The drone is usually inactive.
This sets a flexible either/or state for the drone.

If you need to touch the drone to activate it, the definition of the action as you wrote it is mostly fine; if the drone is activated remotely, you’d want to change the definition as applying to one visible thing. For example:

b)either:

Activating is an action applying to one thing. Understand “activate [something]” as activating.

or

Activating is an action applying to one visible thing. Understand “activate [something]” as activating.

Then you just need a carry out and a report rule for the “activating” action to 1) make the action do something, and 2) let the player know something in the world has changed. You probably want a check rule as well, to prevent confusion. For example:

c)

[code]
Check activating something:
unless the noun is the drone:
say “That’s not something you can activate.” instead;
otherwise:
if the drone is active:
say “[The noun] is already activated.” instead.

Carry out activating the drone:
now the drone is active.

Report activating the drone:
say “You activate [the noun].”.[/code]

Re: “New Question”
The easiest way to do this is to use the “Menus” extension included with Inform; that’s what I’ve used several times to simulate interacting with a computer, and I was happy with the results. You can use that extension to set up pages with submenus to display information, and you can also use it to have menus that directly change conditions in the game world. The best way to learn how to use the extension is to experiment with it, but if you try that and can’t figure it out feel free to ask for more help.

(to Endosphere:)

Thanks! I’ve solved the drone problem (for now, at least), and I’m getting the hang of the Menu extension.

The wording is “if we have examined x”.

(By the way, it would be easier at least for me to follow this thread and probably to those who read it afterwards if you would post new questions as new posts at the end of the thread instead of editing the first.)

Thank you, and I will do that. It’ll probably be faster anyway.

QUESTIONS:

I pretty much have all of my game world set, and now I’m going to start laying down puzzles/inventory items, etc.

This is a list of some things I will need to do. Could someone tell me if the documentation covers these topics, and what section?

–Password guarded computers, using the Menus extension for the computers.
–Switches that need to be flipped to allow actions on computers.
–Items that need to be combined/attached to other items/objects/things in order to perform certain actions.
–Inventory items representing data that the player needs to be in possession of in order for them to carry out certain tasks on computers.

I think there were more, but they escape me at the moment.

Sorry if any of that makes no sense what-so-ever. It’s just that the game I’m working on is for a competition, and I wanted to get all this out there while I had the “push” to do so, so I’m writing kind of fast here.

The following solution doesn’t let you use the Menus extension, but it might be more suitable in other ways, if you don’t mind the shameless self-plug: I have an extension out just called “Computers”, which makes it easy to create password-locked computers, implement search engines and email tables, and have option menus or operating systems. There’s also some rudimentary implementation for data ports that can accept disks/USB drives/DVDs/etc. One of the examples shows how you might use a USB drive to add information to be found by the computer’s search engine.

I’ve just updated the extension to version 2; you can find the details here:

emshort.wordpress.com/2010/01/20 … ension-v2/

The computers do have to be switched on to operate, which I assume is what you have in mind with “switches that need to be flipped”.

As for

…that’s a little on the vague side for me to give specific advice about, but you might want to look at the Recipe Book section called “Simple Machines” – the “What Makes You Tick” example demonstrates a fishing rod that can be put together from component parts in any order.

–Switches that need to be flipped to allow actions on computers.

If you mean something like an on/off switch for the computer, the general idea would be to make a switch that is part of the computer, and then change the description of the computer based on whether or not the switch is on/off. You would also make whatever means you choose for interacting with the computer simply dependent on whether this switch was on or off. Perhaps there are better examples I’m not thinking of, but the basic idea of the “No Relation” example in the Inform documentation could be adapted for this purpose.

–Inventory items representing data that the player needs to be in possession of in order for them to carry out certain tasks on computers

Do you mean an object (like a dvd or a security keycard) that the player must use with the computer, or do you instead mean something the player-character must know (like “All the directory names look like a jumble of random letters” unless the character read somewhere what to look for specifically)?

–Items that need to be combined/attached to other items/objects/things in order to perform certain actions.

Another example of this in the documentation is “Some Assembly Required.”

Your basic rule would probably end up looking something like:

Check doing something to a gadget: if the noun incorporates a widget: do stuff; otherwise: say "[The noun] isn't working at the moment."

-Password guarded computers, using the Menus extension for the computers.

That new “Computers” extension does indeed look pretty interesting. If you wanted to use “Menus” instead, though, you’d probably want to implement the password check by asking the player a question that must be answered properly (i.e. with the proper password) before bringing up the menu. Some examples from the documentation that show how to ask the player a question are “Identity Theft” and “Baritone, Bass.”.

The computers extension does let the computers be turned on and off, but if you specifically want to model a switch as a separate object, “Model Shop” is probably the best example to borrow from.

Thanks much, both of you. As for the switch, there is a part in my game where the player has to switch network connections for the computers of the area back on, so certain information may be transferred from one computer to another that can actually do something with it.

Now I’m having a problem with the multiple choice program. I can get it running fine, but when I enter ‘type 1’ or ‘enter 1’ or ‘type entry 1’, it gives me this:

This is my code:

Table of Cath's Entries index title description -- "Entry 1" "blah blah" -- "Entry 2" "BLAH blah"

What am I missing?

The multiple choice program is looking for a rule (called “effect”) that it can follow, not text to print. (If you look at the ATM example, you’ll notice all the entries in the table are rules, not text descriptions.) That means that the multiple choice program is capable of doing things other than text printing, like moving objects in the game world, or whatever, but it’s probably not the most efficient method if what you want is just to let the player read some text files. (Something to think about for version 3, perhaps.)

However! There’s an easy way to add that functionality. Put the following into your game and it will make your menu just print text, instead:


The new pick a number rule is listed instead of the pick a number rule in the input handling rules.

An input handling rule for a multiple-choice program (called chosen software) (this is the new pick a number rule):
	let N be indexed text;
	let N be "[the topic understood]";
	repeat through the options table of the chosen software:
		let numero be indexed text;
		let numero be "[index entry]";
		if N is numero:
			say "[description entry][line break]";
			rule succeeds;
	say "[out of bounds response of the chosen software][paragraph break]";
	try examining the chosen software.

Thanks again.

Could you recommend any tutorials on implementing puzzles/puzzle-like obstacles? Or what sections of the documentation I should pay particular attention to?

There are some tutorials out there on designing puzzles – like, working out what makes a good or bad one. But tutorials for coding puzzles? Not exactly, because that’s too broad a question: a puzzle could involve anything in the world model. So it’s hard to give advice about “how to code a puzzle” without knowing what the puzzle is that you want to code.

But let me try to break it down a little conceptually.

Typically in IF a puzzle involves something that the player wants to get, reach, or achieve – some action he wants to do – but can’t, until he’s fulfilled some previous requirement. So it might be a door he can’t open, a room he can’t go into, a trophy he can’t take, a woman he can’t dance with. But all these things are tied up with some action that the player might type into the game, for which he should get refusals until he tries under the correct circumstances.

That means that to code the puzzle, we need to keep track of some information:

– has the player fulfilled the requirement for doing the puzzle-solving action? E.g., is he carrying the key that opens the door? Is the tall lady carrying the rose that the player is supposed to give her before dancing with her? That sort of thing.

– has the puzzle already been solved once? (If we’re keeping score, we need to know this for scoring purposes so that we don’t give the player more points each time he opens the same locked door, for instance.) We might keep track of this with a special attribute – like “The tall lady can be ready to dance or finished dancing.” and then set that attribute from “ready to dance” to “finished dancing” when the player manages to dance with her.

And we also need to put a restriction on the action the player is trying to do, until the requirement is fulfilled. In Inform, that might mean writing rules like

Instead of dancing with the tall lady when the tall lady does not carry the rose:
say “The lady doesn’t seem at all interested. Perhaps you’ll need to get her attention with a token of your admiration first.”

And of course we also need a rule to say what happens when the player succeeds:

Instead of dancing with the tall lady when the tall lady carries the rose:
if the tall lady is ready to dance:
say “She is delighted to dance with you!”;
award five points.
now the tall lady is finished dancing;
otherwise:
say “She has already danced enough for the evening.”

Notice that this rule will only occur when the player has achieved the prerequisite (handing over the rose somehow); then it will check to see whether the puzzle is previously unsolved (if she’s “ready to dance”). If so, it awards the points and describes the success case, and marks the lady as “finished dancing”. The next time the player tries the same thing, we’ll instead get the refusal message (“She has already danced enough…”) and no more points will be awarded in the future.

There are many much more complicated ways to code puzzles depending on the world model features involved, but it usually comes back to the same concepts:

– check whether the player is allowed to do the action that completes the puzzle
– check whether this is the first time he’s doing so, if you’re tracking points or have a puzzle that can’t be repeated
– if this is a valid solution attempt, print the message describing success and give whatever rewards the player has earned (such as raised score, new objects to play with, etc)
– (if appropriate) flag that the puzzle is done.

I thank you once again. Time will only tell, but I think that helps me a great deal in visualizing coding puzzles. Did you just write that now, or is it copypasta? I only ask because I think that if you haven’t posted it somewhere on your blog already, it might help people like me (who can write, but have never before come within twenty yards of programming before) if you did.

I also have another question. Is it possible to have the printed name of something change depending on whether or not the player has read one of the entries on the computer? As in, ‘data module’ becomes ‘pattern data’ or ‘module w/ pattern data’ if the player has read the entry telling them what it is.

I just wrote it on the spur of the moment. I’m not sure it’s quite thought-out enough to be blogworthy, but I’ll think about it.

Re. your other problem: you could do something like

The data module can be unidentified or identified. The printed name of the data module is “[if unidentified]data module[otherwise]pattern data[end if]”. Understand “pattern” as the data module when the data module is identified.

That last line would let the player use the same in-game terminology that you use when printing the name.

And then I would just use the effect column of the table to change it from unidentified to identified, right? The bit of code you gave me for displaying the journal entries as text won’t mess with the effect column, will it?

Okay. I’m getting near the end of my game, I think. But I’m having problems with the ultimate goals.

Basically, in my game the player is the A.I. of a research complex that was evacuated for whatever reason. To escape, he needs to fashion a suitable body for himself and then download his programming/personality/soul/whatever. I offer two ways to do this in the game: one, a robotic body, or two, an artificial organic body.

For the organic body, the player needs to have an item, ‘pattern data’, inserted into the master terminal, and something called a ‘wet frame’ in one of the growth vats in order to cultivate/grow the organic body. Then, to download themselves, they need to have an item called ‘Galatea Protocol’ inserted into the master terminal.

For the android/robotic body, the player needs to attach a pair of appropriate arms and legs to a chasis with a head already provided. All they need to do to download themselves is hook the android up to the lab’s computer.

…And I am just having the biggest mental block, even after your conceptual breakdown. I’m pretty sure what I need to do conceptually, it’s just when I start trying to figure out how to code these two sets of actions that my brain starts to melt.

I feel sorta bad about asking for help with this, because I don’t know how anyone can help me without just coding it for me. But I will be more than grateful for any kind of help anyone can offer.