I’m attempting to write my first game in Inform 7, and I want something to happen to the player after attempting a type of action two or three times. I’m sure this is an issue of me not quite understanding action rules, but I haven’t found exactly what I need in the documentation.
Any guidance would be appreciated!
Here’s a simplified version of my code:
The Cell is a room. "Your standard escape room. There's a bare mattress on the floor." The player is in the Cell. A mattress is scenery in the cell. The mattress is a supporter. Mattresspushing is an action applying to nothing. Understand "push mattress" as mattresspushing. [This is obviously a clunky workaround. I don't want the mattress to be pushable between rooms.] Carry out mattresspushing: say "You bend over and push the mattress around the limited floor space.". Instead of looking under the mattress: say "You grab the edge of the mattress with both hands and lift it up. You find nothing but bare concrete underneath.". A pole is in the cell. Looking under the mattress is straining. Mattresspushing is straining. Taking the pole is straining. After trying straining for the second time: say "You feel a bit of strain in your left wrist.". After trying straining for the third time: say "The muscle strain sharpens into pain. You drop everything and massage your wrist."; now everything carried by the player is in the cell.
One obvious issue is that the “instead” rule for looking under the mattress isn’t triggering the “straining” rule. I’m not sure how to avoid the “You find nothing of interest” automatic response without using “instead.”
But that’s not my only problem. I’d ideally like whatever action to be fully carried out before printing the player reactions. E.g., if the player picks up the pole as the third “straining” action, I’d like the game to print “Taken.” and only then go into “The muscle strain sharpens …” That order works with “mattresspushing” but not taking the pole.