intfiction.org

The Interactive Fiction Community Forum
It is currently Wed Jun 19, 2013 1:16 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Thu May 24, 2012 2:47 am 
Offline

Joined: Mon Oct 11, 2010 1:27 pm
Posts: 473
Quote:
Would anybody know what I'm doing wrong here? By the way, thank you so much for the help. I know I'm... really pretty new at this, but I'm learning. I think.


Yes, that error is a bit--vague to new programmers.

But I think where Inform gets confused is, you haven't defined 'making the first bed.'

I took the liberty of chopping up your code to make it more general.

Code:
"firstbed-bobinator" by Andrew

A bed is a kind of container. It is enterable. A bed can be made or unmade. A bed is usually unmade.
[note: this is more general than saying bed 1 can be made or unmade. It also allows you to try to make bed 2 w/o much additional code.]

Dormitory is a room.

bedmaking is an action applying to one thing.
[this is the key thing that is missing. Inform doesn't know bedmaking is an action or what it applies to. When you said Making the First Bed, it could've been an action applying to nothing--but that'd get confusing because it, well, was meant to apply to 1 thing.]

Before bedmaking:
   if noun is not a bed:
      say "You can only MAKE beds in this game." instead;
   if noun is unmade:
      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." instead;
   otherwise:
      say "This is added to the example to make sure there's a message if you try to make the bed twice. You did, so, bam." instead;

Understand the command "make [something]" as something new.
[you also need this before understanding something as something concrete.]

Understand "make [something]" as bedmaking.

The first bed is a bed. the first bed is in Dormitory.

The printed name of first bed is "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]"


No problem about the help. It's good you're dropping by to say thanks. I hope the advice is making things clearer!

One thing to try if an error message is confusing is to write down what you did wrong and what it gave for the next time. Also you can try deleting certain lines from sample documentation code you -know- works. Then you can see what the errors mean. One piece of documentation I would *love* would be one that categorizes samples and common mistakes that lead to semi-cryptic Inform errors and examples of how to get certain errors and specific things to check. That could save a lot of time and frustration.


Top
 Profile Send private message  
 
PostPosted: Tue May 29, 2012 5:00 pm 
Offline

Joined: Sun May 13, 2012 10:02 pm
Posts: 20
Hey, I know it's been a while, I've just been busy with other things. A couple of quick questions, though:

1. How do I make it so that if the player tries to go in a direction from a specific room, they get a special message for it, instead of just "You can't go that way?"

I tried doing it like this:

Code:
Carry out going east from Main Grounds:
   say "That way leads over towards the movie theatre. While you'd love to catch 'Boy Gets Hit In Face With Rather Large Pie 2' again, you're too busy right now."
After going west from Main Grounds:
   say "That wasy leads towards the classrooms. Since you've got a good excuse today to skip class, you'd rather make use of it."
After going northwest from Main Grounds:
   say "That goes towards the girl's dorms. If you wanted to sneak over there, it'd be better to not do it in broad daylight."
After going northeast from Main Grounds:
   say "That way leads to more dorms that don't belong to you."
After going southwest from Main Grounds:
   say "A crowd of students block any movement towards that direction."
After going southeast from Main Grounds:
   say "Nothing's over that way besides some training grounds, which you have no time for at the moment."


I've tried all of these with Instead and Before rules, too, and that didn't work, either.

2. How do I have a character not follow the player into a certain room? My following code works like this:

Code:
Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player:
      let the way be the best route from the location of Jernon to the location of the player;
      silently try Jernon going the way;
      say "Jernon follows after you.";


The problem is this means that Jernon will follow the player into the bathroom, and... well. That's something I'd rather fix.


Top
 Profile Send private message  
 
PostPosted: Tue May 29, 2012 5:29 pm 
Offline
User avatar

Joined: Sat May 08, 2010 9:25 pm
Posts: 1004
Location: The Seattle Massive
Bobinator wrote:
Hey, I know it's been a while, I've just been busy with other things. A couple of quick questions, though:

1. How do I make it so that if the player tries to go in a direction from a specific room, they get a special message for it, instead of just "You can't go that way?"

I tried doing it like this:

Code:
Carry out going east from Main Grounds:
   say "That way leads over towards the movie theatre. While you'd love to catch 'Boy Gets Hit In Face With Rather Large Pie 2' again, you're


Quote:
I've tried all of these with Instead and Before rules, too, and that didn't work, either.


a) this is one of the most common problems in the book. Going a direction from a room happens only when the movement has already succeeded; going a direction in a room happens before that's checked.
b) you want to use an Instead rule for this, thus:
Code:
Instead of going east in Main Grounds: say "That way leads over towards the movie theatre..."


Quote:
2. How do I have a character not follow the player into a certain room? My following code works like this:


You could just add a little bit into your condition:

Code:
Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player and the player is not in the bathroom:
      let the way be the best route from the location of Jernon to the location of the player;
      silently try Jernon going the way;
      say "Jernon follows after you.";

But that might get annoying if you had a lot of rooms you didn't want Jernon to enter, so you could do it with a value instead:
Code:
A room can be forbidden or permitted. A room is usually permitted. The bathroom is forbidden.

Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player and the player is not in a forbidden room:
      let the way be the best route from the location of Jernon to the location of the player;
      silently try Jernon going the way;
      say "Jernon follows after you.";


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 2:57 am 
Offline

Joined: Sun Dec 05, 2010 11:07 am
Posts: 321
Location: ኢትዮጵያ
maga wrote:
But that might get annoying if you had a lot of rooms you didn't want Jernon to enter, so you could do it with a value instead:


Or if you have different parts of the map you don't want Jernon to enter for different reasons -- perhaps under different conditions -- you can use regions.

Code:
A jacket is a wearable thing. Arctic is a region. Ice Floe is a room in Arctic. Snowy Field is a room in Arctic, north of Ice Floe. Base Entry is north of Snowy field.

Jernon is a man in Base Entry. Yourself is in Base Entry.

Jernon Follows is a scene. Jernon Follows begins when play begins.

To decide if (R - a room) is Jernon-friendly:
   if R is regionally in Arctic and Jernon does not wear the jacket, no;
   yes.

Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player:
      if the location is Jernon-friendly:
         let the way be the best route from the location of Jernon to the location of the player;
         silently try Jernon going the way;
         say "Jernon follows after you.";
      otherwise if the player was in the location of Jernon:
         if the location is regionally in Arctic and Jernon does not wear the jacket:
            say "Jernon hangs back. 'I'm freezing already!'"


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 7:46 am 
Offline

Joined: Wed Feb 29, 2012 2:00 pm
Posts: 706
maga wrote:
Code:
A room can be forbidden or permitted. A room is usually permitted. The bathroom is forbidden.

Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player and the player is not in a forbidden room:
      let the way be the best route from the location of Jernon to the location of the player;
      silently try Jernon going the way;
      say "Jernon follows after you.";


You probably should use this.

Code:
A room can be forbidden or permitted. A room is usually permitted. The bathroom is forbidden.

Every turn when Jernon Follows is happening:
   if the location of Jernon is not the location of the player and the player is not enclosed by a forbidden room:
      let the way be the best route from the location of Jernon to the location of the player;
      silently try Jernon going the way;
      say "Jernon follows after you.";


Otherwise, if you have a toilet (an enterable supporter) in the bathroom, Jernon will enter the bathroom as soon as you get on the toilet! :o

_________________
"Will you stop breaking the fourth wall? It's costing me an absolute fortune to replace it!"


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 6:58 pm 
Offline

Joined: Sun May 13, 2012 10:02 pm
Posts: 20
OK, I think I'm getting close to finishing this game. It's very short, but that's because it's more of an interactive story than anything else. There is one final 'puzzle' I'd like to make, though.

Basically, how do I make it so you have a car you can start by putting the key in the ignition and turning it? Would I make the key slot a container?


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 7:06 pm 
Offline
User avatar

Joined: Mon Oct 03, 2011 12:03 pm
Posts: 645
Location: Stoke Barehills
Yes, the ignition would be an open, unopenable, container, and a part of the car. Also, throw in a rule to prevent putting other things in the ignition. (e.g. Check inserting something into the ignition: if the noun is not the keys, say "That's a monumentally ill conceived plan." instead). Inform's Standard Rules already define a turning action that you can use for turning the key (Check turning the key when the key is in the ignition: etc.)


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 9:05 pm 
Offline

Joined: Sun May 13, 2012 10:02 pm
Posts: 20
By the way, I'm having a weird issue where if you try to do an action without a specific target, it always assumes it's talking about the player's underwear. How would I fix this so it just doesn't DO something without a specific target?


Top
 Profile Send private message  
 
PostPosted: Wed May 30, 2012 9:45 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 2129
The parser won't infer an object if there is more than one possibility around. So this probably won't happen once you've put more objects in the starting room.


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

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 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