Code not consistently working?

I have the code below that will work – the first time I try it during the first compilation of the code to test. It works just fine the first time but if I restart and try again it will not work. Sometimes the code works, sometimes it doesn’t.

Has anybody run into this before?

every turn during broadcasting:
	if player is in Personal_Office:
		if soundsafe is uncracked:
			if song title of radiosong is "Rhapsody in Blue":
				now soundsafe is open;
				now soundsafe is cracked;
				increase score by 15;
				say "You are listening to the radio when you hear a beep from the safe and it pops open.[paragraph break]";
				say "'See I told you so?' your psychiatrist says.  'Favorite zong.'";

That all looks very ordinary and free of surprises.

Is there a random setup of the radiosong, maybe?

There is a random setup of radiosong; however, the player can also choose the song to play.

Interestingly, I changed the code to:

every turn when player is in Personal_Office:
	if broadcasting is happening:
		if soundsafe is uncracked:
			if song title of radiosong is "Rhapsody in Blue":
				now soundsafe is open;
				now soundsafe is cracked;
				increase score by 15;
				say "You are listening to the radio when you hear a beep from the safe and it pops open.[paragraph break]";
				say "'See I told you so?' your psychiatrist says.  'Favorite zong.'";

and it worked…the first time. Does not work upon trying to repeat. This is wild.

Can you extract a minimal example where this happens?

Here’s the sequence of commands that will work (note that I use gonear to navigate quickly):


>gonear dj_booth
DJ Booth
In front of you is a large panel that is used by the DJs to manage all facets of broadcasting.  There is a computer terminal mounted into the panel and a keyboard mounted below it.  A large microphone is attached to a mechanical arm that allows it to be adjusted and moved.  The panel itself has a score of lights and different buttons, some blinking, some constantly lit, some black, all in a furious melange of electronic and digital luminosity that is exciting and at the same time confusing.  There is a radio sign above the doorway to the south.  The sign is unlit.  A square button on the console is blinking.

>press square button
You press the blinking button.  The sign over the door lights up and the button stops blinking.

Your mind is alive with the sound of rock and roll music!

>select rhapsody in blue
Queueing selection.....

Selection playing:  rhapsody in blue
Artist:  George Gershwin
Album:  Gershwin Plays Gershwin
Length:  14:22

The announcer says, "You're Listening to Deep Tracks on W*O*L*D".

rhapsody in blue                 George Gershwin

--
>gonear personal_office
Personal Office
A quaint little nook of a room that appears to have been added on after the building itself was constructed.  However, this makes no sense because row houses are huge and this one should have multiple floors that extend back several rooms.  This appears to be where your psychiatrist spends a lot of his time in-between patients, reading journals, writing articles, and keeping notes on his sessions.  A waist-high table is against the west wall with what looks to be a curious apparatus.

Hanging on the wall over the desk is a large, framed poster.

--

This time I tried releasing for testing. The first time I booted the testing release it worked. Now it won’t.

What I mean is do you have a complete runnable example, rather than just an every turn rule?

I actually figured it out, the text has to match exactly with capital letters. How do I make it so that it doesn’t matter if the player capitalizes this or not?

if song title of radiosong exactly matches the text "Rhapsody in Blue", case insensitively:

There’s probably a way to do this that doesn’t rely on exact string matches. A kind of value and a table, maybe.