New and need help

I am just getting started and I am having trouble finding answer to what is likely simple problems.

  • I have the player starting on a road with a broken down car. I want them to have to smash a window with a stick to get the items inside. How do I do this?
  • How do I keep items or objects hidden until the player searches?

Thanks for any help.

"Car" by "JRB".

The Road is a room.

The car is an enterable container in the road. The car is closed. The window is part of the car.

The big stick is a thing in the road.

Rule for writing a paragraph about the car:
        say "An old car sits here idly rusting. [if the car is closed]It's locked up, but you can't see anything valuable inside it from here[otherwise]The windscreen is broken, and you could search inside it if you wanted to[end if]."

Breaking it with is an action applying to one thing and one carried thing.
Understand "break [a thing] with [a thing]", "smash [a thing] with [a thing]" and "hit [a thing] with [a thing]" as breaking it with.
Instead of attacking the window:
        if the big stick is carried:
                try breaking the window with the big stick;
        otherwise:
                say "You're not holding anything suitable for that."
Carry out breaking the window with the big stick:
        remove the window from play;
        now the car is open.
Report breaking the window with the big stick:
        say "Smash! There is fragmented windscreen glass everywhere."

The set of keys is a thing.
Carry out searching the car for the first time:
   now the keys are in the car;
   say "You find a set of keys in the compartment."

(If you use “attack” instead of “break” as your main verb, it’ll include all the other synonyms like “hit”, “break”, etc automatically.)

Good catch. I didn’t know that.

Jrb, I really appreciate your help and how quickly you responded. This is what I wrote:

When play begins:
	Say "Oh great...

In your hurry to get to your friend's house before supper you were not paying attention to the red engine light going off. Now your car has broken down in the middle of nowhere.

You hear a crack of thunder. Examing your options you decide to head down the street hoping to either flag down a car or find a gas station to make a call."

The Lonely road is a room."You are on the lonely road in front of your crappy, broken down car. You hear a crack of thunder in the distance."
A car is an enterable container in the Lonely road. The car is closed. The window is part of the car.  The car is fixed in place.
Rule for writing a paragraph about the car:
	Say "Your useless crap car is sitting here. [If the car is closed] You can see your stuff through the window. [otherwise] your useless crap car is now even crappier with a smashed window. At least now you can get your stuff.[end if]"
Breaking it with is an action applying to one thing and one carried thing.
Understand "break [a thing] with [a thing]", "smash [a thing] with [a thing]" and "hit [a thing] with [a thing]" as breaking it with.
Instead of breaking the window:
	if the Heavy branch is carried:
		Try breaking the window with the Heavy branch;
		otherwise:
			say "What are you gonna break it with? your forehead?"
Carry out breaking the window with the Heavy branch:
				remove the window from play.
				now the car is open.
Report breaking the window with the Heavy branch:
	say: "You break the window, now your car is even more worthless."
	A map, gum and flashlight are in the car.
	Carry out searching the car for the first time:
		now the map, gum and flashlight are in the car;
		say: "You find your stuff sitting losely on the car floor."


A heavy branch is in the Lonely road. The description of the Heavy branch is "It must have fallen off a dead tree."

The description of the map is "This thing is impossible to understand."
The description of the gum is "Mmmm... mint!"
The description of the flashlight is "Good thing I just put in fresh batteries."

Instead of going north in the Lonely road, say "It would take hours to go back the way you came."
Instead of going east in the Lonely road, say "Nothing but woods. You are no outdoors person and they would surely find you dead before you got anywhere."
Instead of going west in the Lonely road, say "A steep cliff. I doubt Superman is around to catch you."



The South road is south of Lonely road. 
A creepy house is here. The description of the creepy house is "You stand before a creepy abandoned house that is mostly hidden by trees and overgrowth."
A wood door is south of the South road. The wood door is closed and locked. The wood door is a door.

I am still getting errors and unsure why.

Thanks for everyone’s help and I appreciate your patience.

Firstly, looks like there’s a problem with your indentations in the “Instead of breaking the window” rule. The “otherwise” needs to have the same indentation as the “if” that it’s responding to.

Your “rule for writing a paragraph about the car” needs a closing period or blank line. (A final period inside the " " works, and is actually best because otherwise the line-breaking may come out wrong. So just get rid of the periods in the two [if] cases, and put one after the [end if] instead.)

In two places you have a : after say which shouldn’t be there.

You don’t want the map, gum and flashlight to be in the car until the player searches it. (Counter-intuitive maybe, but trust me.) So just say “The map, the gum and the flashlight are things.” This will create them, but won’t put them anywhere yet.

It looks like Inform is objecting to “now the map, the gum and the flashlight are in the car;”. I’m not sure why, but never mind. You can separate it into three statements: “now the map is in the car; now the gum is in the car; now the flashlight is in the car;”.

Try putting those things right, and see if you’re still getting errors. if you are, let us know what they say.

As Draconis said above, you can get rid of the line "Understand "break [a thing] with [a thing]", "smash [a thing] with [a thing]" and "hit [a thing] with [a thing]" as breaking it with." and replace it with Understand "attack [a thing] with [a thing]" as breaking it with. You will get all the synonyms for free.

This is consistent with the way Inform treats conditions (that can be checked with “if” phrases and the like); you have to write out complete sentences. So if you were doing an if test you’d have to write:

if the map is in the car and the gum is in the car and the flashlight is in the car:

rather than

If the map, the gum and the flashlight are in the car:

Although “the map, the gum and the flashlight are in the car” has a clear English meaning, Inform doesn’t know how to break this up properly; you have to have complete sentences on either side of the “and.”

Since “Now…” always has to be followed by a condition (see Writing with Inform §8.11), you also have to write out the complete sentences if you want to do a “now.” (And you have to put them in separate “now” statements because, as the compiler explains, “Inform can only make one wish come true at a time.”)

You can use the abbreviated form in initial declarations like

A map, gum and flashlight are in the car.

(though as jrb said you don’t actually want that line) but in most other cases you need to write out the complete sentence.

Yes, you’re right, it does make sense. (Though I’m guess I’m still not sure why the condition syntax is different from the statement syntax.)

Peripheral question: Is there a plot reason that the player needs to break into their own car that they were just driving?

I know you’re not to story troubleshooting yet, but it seemed odd! Was the player so concerned about breaking down that they accidentally locked the keys in the car?

Partly to give the player a chance to learn the mechanics, and partly because they broke down and in a fit of pique forgot to get their keys before shutting the door.