intfiction.org

The Interactive Fiction Community Forum
It is currently Sun May 19, 2013 6:09 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Tue May 15, 2012 2:48 am 
Offline
User avatar

Joined: Thu Nov 04, 2010 6:30 am
Posts: 984
Location: Gothenburg, Sweden
You get that error message, because you don't have an action called "making the first bed".

Either you haven't defined any action at all for making beds, or you have defined it along the lines of "Making is an action applying to one thing." or "Making a bed is an action applying to one thing." etc. (whereas the understand statement you tried would fit most naturally with "Making the first bed is an action applying to nothing.")

When creating a new action for something you do to or with an object, think general. You don't know what objects a player is going to try the action on, so for the general functionality of the action you mustn't refer to specific objects. (Instead, you add special behaviour for special objects as special cases.)

So:
Code:
Making is an action applying to one thing.
Understand "make [something]" as making.

Now, that will allow a player to try making anything ("making" is of course a very annoyingly ambiguous word for interactive fiction purposes). So you have to block it in most cases.
Code:
Instead of making when the noun is not a bed: say "You can't make much anything but your bed."

("The noun" is the thing you do something to/with.)

_________________
Man ska inte tro allt man tänker.


Top
 Profile Send private message  
 
PostPosted: Tue May 15, 2012 4:44 am 
Offline
User avatar

Joined: Tue Jun 22, 2010 2:39 am
Posts: 32
Location: Some dungeon or other
Hello Bobinator! Yeah, pretty much what Felix said, except he said it much more concisely.

Here, I did things a little bit differently and took them a little further.

This code should work. Essentially, there is no premade verb in the Inform library for make, because different people will want to handle that differently.

Code:
A bed is a kind of supporter. A bed is enterable. A bed can be made or unmade. A bed is usually made. A bed is usually scenery.

[Note that I made the bed a supporter. Supporters are like containers except things are "on" them rather than "in" them. This is good for kitchen tables, too. Also see the "usually" statements. This is what a kind has as a default value unless told otherwise.]

Making is an action applying to one touchable thing. Understand "make [something]" as making.

Understand "straighten [bed]" as making.

[Note that, as things stand now, straighten only works as a verb if you are referring to be something which happens to be of the bed kind. That is because there is no premade straighten verb. But we are using it as a sort of alias when talking about beds.]

Carry out making:
   say "That is either already made or beyond your ability."

Instead of making the first bed:
   if the first bed is unmade
   begin;
      now the first bed is made;
      say "You put in a tremendous level of effort hoisting the covers back onto the bed, carefully smoothing them back under the pillows. Why you do this, even though you know you'll just make a mess of them again, you aren't entirely sure.";
   otherwise; [If the bed is made, or whatever is the opposite of the condition in the if]
      say "There is no need for straightening the covers right now!";
   end if.

Instead of doing something other than examining to a bed that is not the first bed, say "I don't think your roommate would appreciate that idea.";

[A good way to avoid having to code making responses for every bed... if you don't want to have to do that :) ]

[I also changed some articles, check it out. You don't have to keep this, just an idea of how you can use a few pronouns to describe things. Test the changed part of the code by typing "examine bed".]

The first bed is a bed in Dormitory. Understand "my bed" as the first bed. The first bed is unmade. The first bed is proper-named. The printed name is "your bed". The description of the first bed is "Quite possibly one of the best friends you've made during your time at the school. Sure, you hate the way the covers are stitched in, leaving your feet to roast under them. Sure, you hate the way one of the springs jab into your back if you lean into it a certain way. But, when it all comes down to it, it helps you get to sleep.[If bed is made]The pea-green covers are neatly straightened out.[Otherwise] The pea green covers are dangling over the edge of the bed where you left them.[END IF]"

[Below, I took the liberty of adding a second bed for demonstration purposes.]

The second bed is a bed in Dormitory.  Understand "my roommate's bed" and "roommate's bed" as the second bed. The second bed is proper-named. The printed name is "your roommate's bed". The description of the second bed is "This bed has pea green covers, like yours. However, it is in much better shape, apart from the cracked headboard."

If you have any questions, of course, feel free to ask :)

_________________
- Ste/SteW aka Steve

Your friendly neighborhood IF enthusiast


Top
 Profile Send private message  
 
PostPosted: Wed May 16, 2012 4:03 am 
Offline

Joined: Sun May 13, 2012 10:02 pm
Posts: 20
All right, is this code correct, or am I entirely off here?

Code:
Knocking is an action applying to one touchable thing.
Understand "knock on [something]" as knocking.
Instead of knocking when the noun is not a door: say "You tap your knuckles against it, then feel kind of silly for it."

The bathroom door is a locked and closed door. It is scenery. It is east of Dormitory and west of Bathroom.

Instead of knocking on bathroom door:
if Jernon is in Bathroom
begin;
say "'Hang on, I'll be done in just a minute or two!' Jernon's voice calls out from behind the door.";
otherwise;
say "You get no response.";
end if.


I think my problem is I'm having trouble understand the more 'code'-esque parts of Inform, if that makes any sense. I've tried checking a few of the examples, like Emily Short's early Inform 7 stuff, but they don't give quite the explanation I'm looking for.


Top
 Profile Send private message  
 
PostPosted: Wed May 16, 2012 4:36 am 
Offline
User avatar

Joined: Tue Jun 22, 2010 2:39 am
Posts: 32
Location: Some dungeon or other
You'll probably have to replace "knocking on bathroom door" with this:
Code:
Instead of knocking the bathroom door:

It doesn't like the "on"... It's because Inform code isn't acquainted with some of the finer exceptions in the English language.

Most English verbs go like: hit ball, kick ball, throw ball, etc. There's no preposition between the verb and the object in most cases. But "knock on" is a different case. While "on" works in the game and in quotes and stuff, it doesn't work so well in Inform syntax.

Anyway, with that adjustment you can say "knock on door" while playing and it should work.

_________________
- Ste/SteW aka Steve

Your friendly neighborhood IF enthusiast


Top
 Profile Send private message  
 
PostPosted: Wed May 16, 2012 5:19 am 
Offline

Joined: Tue Dec 25, 2007 10:06 am
Posts: 887
Or you can just rename the action to "knocking on".

_________________
Vorple UI libraryBeta testing siteBlog


Top
 Profile Send private message  
 
PostPosted: Wed May 16, 2012 3:32 pm 
Offline

Joined: Wed Oct 13, 2010 1:42 am
Posts: 343
Also you need a colon rather than a semicolon after "otherwise". I'd also just put a colon at the end of the first line of the If statement and omit the "begin" line, although I think it would work either way.


Top
 Profile Send private message  
 
PostPosted: Wed May 16, 2012 11:05 pm 
Offline
User avatar

Joined: Tue Jun 22, 2010 2:39 am
Posts: 32
Location: Some dungeon or other
katz wrote:
Also you need a colon rather than a semicolon after "otherwise". I'd also just put a colon at the end of the first line of the If statement and omit the "begin" line, although I think it would work either way.

Using a semicolon after "otherwise" compiles and runs just fine for me. I take it you've had problems with it?

_________________
- Ste/SteW aka Steve

Your friendly neighborhood IF enthusiast


Top
 Profile Send private message  
 
PostPosted: Thu May 17, 2012 12:28 am 
Offline

Joined: Sun May 13, 2012 10:02 pm
Posts: 20
I'm having trouble with a couple of other things.

1. I'm trying to make it so if you drop things into a toilet, you'd get the message "If you put that in there, you'd never get it back."

Code:
Instead of putting [any touchable thing] in toilet:
say "If you put that in there, you'd never get it back."

doesn't seem to work, because when I try it, I can drop anything in there just fine.

2. How do I make it so an action that gives a different response the second time you try it, repeats the message you got the second time you tried it?

For example:
Code:
Instead of smelling Jernon for the first time:
say "He doesn't smell like much of anything, since he just had a bath. 'Is there any particular reason you're sniffing me, K'arnan?'"
Instead of smelling Jernon for the second time:
say "You're not THAT interested in how he smells."


EDIT: I've changed this to use [or] and [stopping] instead, which should hopefully do the same thing with less code.

(You may be wondering what all this interactivity is for. The answer: Not a lot, I just love adventure games that let you mess with every possible thing. That, and it's a nice way to learn.)


Top
 Profile Send private message  
 
PostPosted: Thu May 17, 2012 1:12 am 
Offline
User avatar

Joined: Tue Jun 22, 2010 2:39 am
Posts: 32
Location: Some dungeon or other
1.
Code:
Instead of inserting something into toilet:
say "If you put that in there, you'd never get it back."


2.
Code:
Instead of smelling Jernon:
say "[one of]He doesn't smell like much of anything, since he just had a bath. 'Is there any particular reason you're sniffing me, K'arnan?'[or]You're not THAT interested in how he smells.[stopping]".

The stopping tags and such indicate that the first time this action happens, the game should display the first message, and all times after that, the next message.

Read section 5.7 of the built-in manual for more handy shortcuts you can use :)

EDIT: Just saw your edit, Bobinator! :)

_________________
- Ste/SteW aka Steve

Your friendly neighborhood IF enthusiast


Top
 Profile Send private message  
 
PostPosted: Thu May 17, 2012 2:19 am 
Offline

Joined: Mon Oct 11, 2010 1:27 pm
Posts: 449
Bobinator wrote:
Before making the first bed:
if the first bed is unmade
begin;
now the first bed is made;
say "You put in a tremendous level of effort hoisting the covers back onto the bed, carefully smoothing them back under the pillows. Why you do this, even though you know you'll just make a mess of them again, you aren't entirely sure.";
stop the action


To add a small point to what people have said about making something, you can get Inform to assume which bed.

does the player mean making the first bed: it is likely;

This avoids disambiguation.

I agree with other people about looking through the standard actions. If I'd known about Index::Actions in the IDE, I'd have realized a lot sooner what is good stuff to implement first, and what people expect to be able to try.

Oh, and welcome!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot], planetfall666 and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group