Specific input

Wow! I’m totally confused now. I can’t figure out how these suggestions fit into my code, which is:

Check singing into microphone: if guitar is untuned: say "Sam grimaces as he listens in the control booth.[line break] ['] You need to get that axe tuned,['] he says through the intercom and points toward the door."; now player is in A Street; otherwise: if guitar is tuned and player's command matches "Shamba Lamba Wamba": say "Sam nods his head approvingly as you sing your song, and when you finish signals a [']V['] for victory from the control booth.[line break] [']This here's solid gold!['] he shouts. [']This here is a million-seller! Moon Studios is saved!['][line break] And of course, Sam is right. Not only is Moon Studios saved, but you get rich. You tour the country to rave reviews and the screams of teenage girls; buy your mama a pink Cadillac; move into a big ole house in the Winterhaven community of Memphis; marry one of those hot waitresses from the Kit Kat Club, and get yourself a pair of blue suede shoes.[line break] Life couldn't be much better ...[paragraph break] And then you get your draft notice."; end the story; otherwise: say "[']Those aren[']t the lyrics you wrote,['] Sam says from the control booth. [']Sing what you wrote, hillbilly![']".

Change “and player’s command matches” to “and the topic understood matches”.

I think you also need to change “Check singing into microphone” into “Check singing it into microphone”, since that’s the syntax of the new action you added a few posts ago.

I got this:

Problem. You wrote ‘Check singing it into microphone’ , which seems to introduce a rule taking effect only if the action is ‘singing it into microphone’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

This is my latest attempt:

[code]Singing [something] into is an action applying to one topic and one thing. Understand “sing [something] into [something]” as singing [something] into.

Check singing [something] into microphone:
if guitar is untuned:
say “Sam grimaces as he listens in the control booth.[line break]
[’] You need to get that axe tuned,[’] he says through the intercom and points toward the door.”;
now player is in A Street;
otherwise:
if guitar is tuned and the topic understood matches “Shamba Lamba Wamba”:
say “Sam nods his head approvingly as you sing your song, and when you finish signals a [’]V[’] for victory from the control booth.[line break]
[’]This here’s solid gold![’] he shouts. [’]This here is a million-seller! Moon Studios is saved![’][line break]
And of course, Sam is right. Not only is Moon Studios saved, but you get rich. You tour the country to rave reviews and the screams of teenage girls; buy your mama a pink Cadillac; move into a big ole house in the Winterhaven community of Memphis; marry one of those hot waitresses from the Kit Kat Club, and get yourself a pair of blue suede shoes.[line break]
Life couldn’t be much better …[paragraph break]
And then you get your draft notice.”;
end the story;
otherwise:
say “[’]Those aren[’]t the lyrics you wrote,[’] Sam says from the control booth. [’]Sing what you wrote, hillbilly![’]”.[/code]

This is the result:

Problem. You wrote ‘Check singing into microphone’ , which seems to introduce a rule taking effect only if the action is ‘singing into microphone’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

This seems like it ought to work, but I7 says it doesn’t:

[code]Singing into is an action applying to one topic and one thing. Understand “sing it into [something]” as singing [text] into.

Check singing into microphone:
if guitar is untuned:
say “Sam grimaces as he listens in the control booth.[line break]
[’] You need to get that axe tuned,[’] he says through the intercom and points toward the door.”;
now player is in A Street;[/code]

Problem. You wrote ‘Check singing into microphone’ , which seems to introduce a rule taking effect only if the action is ‘singing into microphone’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

I am stumped.

Computer programming is not pretty, and Inform does force you to jump through some rather odd hoops. Here’s some code that I’m pretty sure does what you have in mind. You may want to study how I’ve organized the three new actions (singing, singing into, and singing it into). You’ll want to adjust the results of various singing actions so as to fit your story, but the results should be reliable. You can paste it into a new, blank game and run the ‘test me’ command to see what it does.

[code]The Studio is a room. “Wow, look at those drums!”

The microphone is in the Studio. Understand “mic” and “mike” as the microphone.

The player carries a guitar. The player has some text called the lyrics. The lyrics of the player is “shamba lamba dingdong”.

Singing is an action applying to nothing. Understand “sing” as singing.

Report singing:
say “You try singing a few notes. The engineer behind the glass hits the talkback button and says, ‘Dude, are you done rehearsing now?’”

Singing into is an action applying to one thing. Understand “sing into [something]” as singing into.

Check singing into:
if the noun is not the microphone:
say “The engineer hits the talkback button and says, ‘Dude, that’s the microphone over there – see it?’” instead;
else:
say “The engineer hits the talkback button and says, ‘Dude, have you forgotten the lyrics already?’” instead.

Singing it into is an action applying to one topic and one thing. Understand “sing [text] into [something]” as singing it into.

Check singing it into:
if the second noun is not the microphone:
say “You yodel a few licks into [the second noun]. The engineer behind the glass raises his middle finger to you in a salute.” instead;
else if the player does not carry the guitar:
say “As you start to sing, the engineer hits the talkback button and says, ‘Dude, are you going to play the guitar while you sing, or should I hire somebody who can actually handle the gig?’” instead;
else:
let L be the lyrics of the player;
if “[the topic understood]” exactly matches the text L:
continue the action;
else:
say “The engineer hits the talkback button and says, ‘Dude, those are not the lyrics!’” instead.

Report singing it into:
say “You bellow ‘[the topic understood]’ into the mic. The engineer stops picking his nose long enough to give you a thumbs-up. He hits the talkback button and says, ‘Dude, I think we got a keeper!’”

Test me with “sing / sing into guitar / sing into mic / sing louie louie into mic / sing shamba lamba dingdong into mic”.[/code]

You probably want to say

Singing it into is an action applying to one topic and one thing.

The “it” in the action name is actually Inform syntax: it allows you to write rules like

Carry out singing a text into something:

and Inform will recognize this as referring to the action “singing it into”, even though the action name doesn’t literally appear.

For the grammar token, you want

Understand "sing [text] into [something]" as singing it into.

One thing to know is that square brackets outside quotation marks are for comments. Inform ignores them. So when you write

singing [text] into

it’s ignoring the “[text]” part.

(Edited to add code tags.)

Potentially confusing comment, as the quoted bit is IN quotation marks. Matt is referring to the last four words in this bit of holmes’s code:

Singing into is an action applying to one topic and one thing. Understand "sing it into [something]" as singing [text] into.

Yes, that was getting me confused as well. Thanks for the clarification.

Yeah, I’ve edited the original post to put in code tags. Moral: Always code tag!

I adapted Jim’s code as well as I could to the existing code. Here is what I wrote:

Check singing it into: if guitar is untuned: say "Sam grimaces as he listens in the control booth.[line break] ['] You need to get that axe tuned,['] he says through the intercom and points toward the door."; now player is in A Street; otherwise: let L be the lyrics of the player; if guitar is tuned and [the topic understood] exactly matches the text L;: say "Sam nods his head approvingly as you sing your song, and when you finish signals a [']V['] for victory from the control booth.[line break] [']This here's solid gold!['] he shouts. [']This here is a million-seller! Moon Studios is saved!['][line break] And of course, Sam is right. Not only is Moon Studios saved, but you get rich. You tour the country to rave reviews and the screams of teenage girls; buy your mama a pink Cadillac; move into a big ole house in the Winterhaven community of Memphis; marry one of those hot waitresses from the Kit Kat Club, and get yourself a pair of blue suede shoes.[line break] Life couldn't be much better ...[paragraph break] And then you get your draft notice."; end the story; otherwise: say "[']Those aren[']t the lyrics you wrote,['] Sam says from the control booth. [']Sing what you wrote, hillbilly![']".

Here is what I7 reports:

Problem. In the sentence ‘if guitar is tuned and exactly matches the text L’ , I was expecting to read a text, but instead found some text that I couldn’t understand - ‘exactly’.

I was trying to match one of these phrases:

  1. (exactly - text) matches the text (l - text)

  2. (exactly - value) matches (text l - description of values)

  3. (exactly - snippet) matches (text l - topic)

I recognised:

l = a temporary named value, holding a text

But I didn’t recognise ‘exactly’ or ‘text l’.


Problem. You wrote ‘otherwise’ : but that makes two unconditional ‘otherwise’ or ‘else’ clauses for this ‘if’, which is forbidden since ‘otherwise’ is meant to be a single (optional) catch-all clause at the end.

The error message actually tells you exactly what’s wrong: you wrote a line of code and commented out some of it, so now Inform reads it as “if guitar is tuned and exactly matches the text L”.

Outside of a quote (that is, a text), bracketed Inform 7 code counts as a comment. Comments aren’t read by Inform, they’re just there for the programmer to document what they’re doing. You want “the topic understood” to be without the brackets.

Thanks, Eleas, I took out the brackets and it compiled, though I still didn’t get the results I expected.

[code]The player has some text called the lyrics. The lyrics of the player is “Shamba Lamba Wamba.”

Understand “mic” as microphone. Understand “mike” as microphone.

Singing is an action applying to nothing. Understand “sing” as singing.

Singing into is an action applying to one thing. Understand “sing into [something]” as singing into.

Singing it into is an action applying to one topic and one thing. Understand “sing [text] into [something]” as singing it into.

Check singing it into:
if guitar is untuned:
say “Sam grimaces as he listens in the control booth.[line break]
[‘] You need to get that axe tuned,[’] he says through the intercom and points toward the door.”;
now player is in A Street;
otherwise:
let L be the lyrics of the player;
if guitar is tuned and the topic understood exactly matches the text L:
say “Sam nods his head approvingly as you sing your song, and when you finish signals a [‘]V[’] for victory from the control booth.[line break]
[‘]This here’s solid gold![’] he shouts. [‘]This here is a million-seller! Moon Studios is saved![’][line break]
And of course, Sam is right. Not only is Moon Studios saved, but you get rich. You tour the country to rave reviews and the screams of teenage girls; buy your mama a pink Cadillac; move into a big ole house in the Winterhaven community of Memphis; marry one of those hot waitresses from the Kit Kat Club, and get yourself a pair of blue suede shoes.[line break]
Life couldn’t be much better …[paragraph break]
And then you get your draft notice.”;
end the story;
otherwise:
say “[‘]Those aren[’]t the lyrics you wrote,[‘] Sam says from the control booth. [’]Sing what you wrote, hillbilly![']”.[/code]

Transcript:

[Abstracted.]

sing Shamba Lamba Wamba into mic
‘Those aren’t the lyrics you wrote,’ Sam says from the control booth. ‘Sing what you wrote, hillbilly!’

(Note: guitar was tuned before abstracting to recording studio.)

I made the same mistake when I was creating the prototype code. You have a period inside the quotation marks for the lyrics of the player. You need to put the period outside the quotation marks.

Also, note that “exactly matches” is case-sensitive. The parser will convert everything in the input into lower-case before your code gets a chance to process it, so the lyrics “Shamba Lamba Wamba” will never be matched, no matter where you put the period.

O happy day! It all works. Thanks all!