How do I do the Indiana Jones puzzle: If player takes a ball he dies. But if he puts a meat on the pedestal before he takes the ball, he succees?
Blue room is a room.
A pedestal is in blue room.
On the pedestal is a ball.
A Ball is a thing.
A meat is a thing.
The meat is carried by player.
For this, you want to write an Instead rule. In writing the rule, you need to be very logical. Here’s a simple version that I whipped up:
[code]The Test Lab is a room.
The pedestal is in the Lab. A golden sphere is on the pedestal. The player carries meat. The indefinite article of the meat is “some”.
Instead of taking the sphere:
if the sphere is not on the pedestal:
continue the action;
otherwise if the meat is on the pedestal:
continue the action;
end the story saying “Knives shoot out of the wall and slice you apart!”[/code]
Also, by the way, you don’t need to write “A ball is a thing” or “A meat is a thing.” Inform will figure that out without being told. You only need to add that sentence when the thing starts the game off-stage, and is later brought into play.
In some month’s I haven’t opened inform at all, and now when I try to remember what I did in the start of the year, I found this topic. I tried to execute the example, but I got an error:
This is the report produced by Inform 7 (build 6G60) on its most recent run through:
Problem. The phrase or rule definition ‘Instead of taking the sphere’ is written using the ‘colon and indentation’ syntax for its 'if’s, 'repeat’s and 'while’s, where blocks of phrases grouped together are indented one tab step inward from the ‘if …:’ or similar phrase to which they belong. But the tabs here seem to be misaligned, and I can’t determine the structure. The first phrase going awry in the definition seems to be ‘if the sphere is not on the pedestal’ , in case that helps.
This sometimes happens even when the code looks about right, to the eye, if rows of spaces have been used to indent phrases instead of tabs.[/i]
If I remember correctly, I have had this kind of errors when I try to copy/paste codes from the forum. How these can be fixed?