AM/PM and colon troubles

The game’s clock is on a standard 12-hour clock. In game, there are grandfather clocks that can be set to basically one specific time, 2:30 PM, but since grandfather clocks are obviously analog clocks, it really doesn’t matter whether the player set it to 2:30 AM or 2:30 (which just loops back to 2:30 AM). However the way I have it, the game won’t accept 2:30.

I’ve tried understand statements, but I can’t use colons in those.

I’ve tried rewriting my check that prevents other times other than 2:30 PM

Check setting: if the time understood is not 2:30 am or the time understood is not 2:30 pm: say "You play with the clock a bit before finally moving the hands back to the right time." instead.

and variations of that, but either it doesn’t do anything or Inform error-messages it.

I’m really not sure what I can do.

You’re on the right track. If the player doesn’t specify a time, Inform assumes that the time supplied is AM. So, you need to use “and”, not “or” in your check test.

Check setting: if the time understood is not 2:30 AM and the time understood is not 2:30 PM: say "You play with the clock a bit before finally moving the hands back to the right time." instead.

FYI, Inform will also see the commands “set clock to two thirty” and “set clock to half past two” as specifying 2:30 AM, so keep those in mind as you write your code.

–Erik

Thank you so much. Just a clarification, what exactly is the difference between “and” and “or” in Inform?

When talking about “if” statements and conditions, “and” and “or” behave the way they do in other programming languages.

You wrote “if the time understood is not 2:30 am or the time understood is not 2:30 pm”. Break that down logically, and you see that it’s always true – it’s always not one or not the other (or, more frequently, not both).

Oh wow. My grammar and logic skills must have deteriorated when I wasn’t looking. Thank you for clearing that up for me.

I don’t remember if I used to be better at this sort of thing, but since I’ve started using unit tests in Python, I’ve found myself picking logical operators by trial and error more often than thinking them through properly. At least my unit tests usually tell me if I’ve done something dumb…