Hi,
I have two devices that can be turned on. The chart plotter can only be switched on when the breaker board is switched on.
If the chart plotter is examined before the breaker is switched on, it says ‘The chart plotter is off’.
After switching on the chart plotter but before the breaker is switched on, it says ‘There is no power to the chart plotter.’.
If the breaker board is switched on, but before the chart plotter is switched on and the chart plotter has been examined, it says ‘You switch on the board, and now the chart plotter has power.’
If the breaker board is switched on, but before the chart plotter is switched on and it has not been examined, it says ‘You switch on the board, you now have 12v power on the boat.’
And finally, if the breaker board is switched on and the player turns on the chart plotter, it says ‘You turn on the chart plotter and the screen comes to life.’
So far I have this code:
The chart plotter is a device in Cockpit. The chart plotter is scenery. The description is "The chart plotter is a 7 inch colour screen, used to display electronic charts. On the right is an on/off switch.". Understand "chartplotter" and "plotter" as chart plotter. The chart plotter can be switched on. One on/off button is part of the chart plotter.
previous_attempt is a truth state that varies.
The Breaker Board is a device in the Engine Room. The Breaker Board is scenery. The description is "A breaker board with a switch marked 12v". The Breaker Board can be switched on. One on/off button is part of the Breaker Board.
Before printing the name of the chart plotter while examining when the chart plotter is switched off and previous_attempt is false and the board is switched on:
say "The chart plotter is off."
After switching on the chart plotter:
if the Breaker Board is switched off:
say "You try to switch on the chart plotter, but nothing happens.";
otherwise if the Breaker Board is switched on:
say "You turn on the chart plotter and the screen comes to life.";
Instead of switching on the chart plotter when the player tries switching on the Breaker Board:
if previous_attempt is true:
now the chart plotter is switched on;
say "You switch on the board, and now the chart plotter has power.";
otherwise:
now previous_attempt is true;
say "You switch on the board, you now have 12v power on the boat.";
The previous_attempt is introduced so that if they turn on the breaker and they haven’t examined the chart plotter, it just says “You now have power on the boat”. If they have checked the chart plotter before turning on the breaker, when the breaker turns on it tells you you have power to the chart plotter.
But Inform is tripping up and says:
You wrote 'Instead of switching on the chart plotter when the player tries switching on the Breaker Board' , which seems to introduce a rule taking effect only 'when the player tries switching on the Breaker Board'. But this condition did not make sense, so I am unable to accept this rule.
I tried changing it to this:
Instead of switching on the chart plotter after the player switches on the Breaker Board:
And Inform tells me
'chart plotter' has the wrong kind of value: a device rather than an enumerated value.
I can’t work out if this is my logic or my syntax.