I wrote a little bit of code and I am now stumped as to why its not working… It compiles and runs but when I type pour water onto van it get the failure option every time.
doorcool is a number that varies. doorcool is 0.
understand the command "pour" as something new.
pouring it onto is an action applying to two things.
understand "pour [something] onto [something]" as pouring it onto.
Instead of pouring the Water Bottle onto something:
if the second noun is van:
now the Water Bottle is nowhere;
move the Empty Bottle to the Player;
now doorcool is 1;
say "The water hisses as it hits the card door handle, cooling it off.";
otherwise:
say "Why pour the Water Bottle onto [the second noun]?"`Preformatted text`
Im confused, can anyone see an error?
Thanks
By “default outcome” I mean if you have actions turned on, it will say something like “pouring the water bottle onto the van failed the Instead of pouring the Water Bottle onto something rule” but behind the scenes that doesn’t matter unless you have other rules depending on the outcome being successful.
To prevent that, you’d want to split this into normal Check/Carry Out/Report rules.
Instead of pouring the Water Bottle onto something:
if the second noun is van:
now the Water Bottle is nowhere;
move the Empty Bottle to the Player;
now doorcool is 1;
say "The water hisses as it hits the card door handle, cooling it off.";
say "(debug - doorcool is [doorcool].);
otherwise:
say "Why pour the Water Bottle onto [the second noun]?"`Preformatted text`
You could write a check rule and then an After rule pertaining to the van.
Check pouring the water bottle onto something:
if the second noun is not the van:
instead say "Why pour the water bottle onto [the second noun]?"
After pouring the water bottle onto the van:
now the water bottle is nowhere;
move the empty bottle to the player;
now doorcool is 1;
say "The water hisses as it hits the car door handle, cooling it off."
Just a suggestion. And you don’t need the ‘Understand the command ‘pour’ as something new’–‘pour’ is not in the original lexicon.
Of course Hanon’s suggestion of Check/Carry out/Report rules is the best approach for new actions and how they are to normally be handled.
Oddly enough another place in my code has the almost exact same code and it works the way its supposed to…
Instead of throwing the rock at something:
if the second noun is cars:
now the Attendant is in More Parking Lot;
Move Van to More Parking Lot;
say “The rock shatters a window causing the alarm to go off, the Attendant rushes to you.”;
now the rock is in a van;
otherwise:
say “Why throw a rock at [the second noun]?”
So I replaced the code with the code here…and was stuill getting the error. Turns out I was using the alias of he noun name The actual text for the second noun should have been minivan as that is the original name of the object. Once I fixed that it all worked, including the oeiginqal code.
Thanks for the pointers and Ill use the check thing from now on.
(Each time Go or Replay is clicked, Inform tries to translate the source text into a working story, and updates this report.)
Problem. You wrote ‘Check pouring the water bottle onto something’ , which seems to introduce a rule taking effect only if the action is ‘pouring the water bottle onto something’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.
doorcool is a number that varies. doorcool is 0.
understand the command “pour” as something new.
pouring it onto is an action applying to two things.
understand “pour [something] onto [something]” as pouring it onto.
Check pouring the water bottle onto something:
if the second noun is not the minivan:
instead say “Why pour the water bottle onto [the second noun]?”
After pouring the water bottle onto the van:
now the water bottle is nowhere;
move the empty bottle to the player;
now doorcool is 1;
say “The water hisses as it hits the car door handle, cooling it off.”
Yeah, I didn’t get the “Check pouring the water bottle onto something” error message described above, but I did get a problem related to the van/minivan mix up that @DeusIrae points out. And his suggestion fixes that problem anyway.
The only thing I can think of here is that, if you are getting the ‘didn’t make sense as a description of an action’ error, maybe in some of the code you are calling the water bottle ‘Water Bottle’ capitalized. How are you defining the water bottle?