too many if variations?

Sorry for posting so many topics recently but this is just really confusing me.

[code]"I heard a slow groan which made me turn around fearing the worst. Sure enough,

[if the lantern is active]‘Ah, my eyes!’[otherwise if the bedroom window is active]‘Brrrr it’s cold in here!’[otherwise]‘Mrmrmrm, I’m up I’m up! Do I have to go to school today?’[end if] It was my brother, goggily sitting up and gazing around the room still half asleep, his eyes slowly focused on me, ‘What are you doing out of bed?’

I was frozen in shame, I had not wanted to wake John up and felt bad that I had deprived him of his peacefull looking dreams.

‘Well?[if the bedroom window is open]Why is it so chilly in here[end if][if the bedroom window is open and the lantern is on] and w[end if][if the bedroom window is closed and the lantern is on] W[end if][if the bedroom window is open and the lantern is off]?[end if][if the lantern is on]hy is the god damn lantern burning a hole through my eyes?[end if] are you going to answer me or just stand there the the moron we both know you to be?’ Well, it looked as if he still had his sharp tounge even while half asleep.".[/code]
produces a big long error message

[code]"I heard a slow groan which made me turn around fearing the worst. Sure enough,

[if the lantern is active]‘Ah, my eyes!’[otherwise if the bedroom window is active]‘Brrrr it’s cold in here!’[otherwise]‘Mrmrmrm, I’m up I’m up! Do I have to go to school today?’[end if] It was my brother, goggily sitting up and gazing around the room still half asleep, his eyes slowly focused on me, ‘What are you doing out of bed?’

I was frozen in shame, I had not wanted to wake John up and felt bad that I had deprived him of his peacefull looking dreams."[/code]
does not

and

[code]I heard a slow groan which made me turn around fearing the worst. Sure enough,

[if the lantern is active]‘Ah, my eyes!’[otherwise if the bedroom window is active]‘Brrrr it’s cold in here!’[otherwise]‘Mrmrmrm, I’m up I’m up! Do I have to go to school today?’[end if] It was my brother, goggily sitting up and gazing around the room still half asleep, his eyes slowly focused on me, ‘What are you doing out of bed?’

I was frozen in shame, I had not wanted to wake John up and felt bad that I had deprived him of his peacefull looking dreams.

‘Well?[if the bedroom window is open]Why is it so chilly in here?[end if] [if the lantern is on]Why is the god damn lantern burning a hole through my eyes?[end if] are you going to answer me or just stand there the the moron we both know you to be?’ Well, it looked as if he still had his sharp tounge even while half asleep."[/code]
does as well

the error message ends with

wtf?

My guess is a punctuation mistake or too much of something. The trouble with Inform errors that happen in response to punctuation going out of whack is that, from the moment it does go out of whack (EG one misplaced double quote), the interpreter is no longer interpreting any if your code correctly. So everything it reports after that point can seem nonsensical. And often the first point of trouble is not specified by the error report, because the interpreter briefly succeeded in carrying on for a little while after that point before everything went to pot.

But with the code you’ve shared, it’s hard to say exactly what might be wrong without a verbatim posting of the code. For instance, you don’t include the part that presumably says “Say (all of the stuff you wrote).”

You may find that just breaking up the material over more say phrases on separate lines will do the trick.

When I have a complicated series of if… otherwise… things in a say phrase, I often turn it into its own action. That way I can edit it in isolation, and I find it easier on the eye and brain to follow.

For instance, your last paragrph is:

Well?[if the bedroom window is open]Why is it so chilly in here[end if][if the bedroom window is open and the lantern is on] and w[end if][if the bedroom window is closed and the lantern is on] W[end if][if the bedroom window is open and the lantern is off]?[end if][if the lantern is on]hy is the god damn lantern burning a hole through my eyes?[end if] are you going to answer me or just stand there the the moron we both know you to be?' Well, it looked as if he still had his sharp tounge even while half asleep.".

What I’d probably do here is replace it with the following:

say "Well? [the open window conversation]."

And then add a piece of code defining ‘the open window conversation’:

To say the open window conversation: if the bedroom window is open: say "Why is it so chilly in here[run paragraph on]"; if the lantern is on: say " and why is the god damn lantern burning a hole through my eyes? "; otherwise: say "? "; otherwise: if the lantern is on: say "Why is the god damn lantern burning a hole through my eyes? "; say "Are you going to answer me or just stand there being the moron we both know you to be?'[paragraph break]Well, it looked as if he still had his sharp tongue even while half asleep"

I threw in a few typo fixes.

There are a few subtle points to do with the line breaks in there. Leaving a trailing space at the end of a say phrase works the same as saying “run paragraph on”, meaning what is next printed will come on the same line. So note where I put those trailing spaces.

I let the original phrase print the period that ends the whole thing. Note how I didn’t include the period at the end of the open window conversation code, which is after ‘even while half asleep’. This prevents extra line breaks.

Also, see how I forked the logic questions you’re asking into two major forks. First it checks if the bedroom window is open and works out what to say if that’s the case. OTHERWISE it looks at what to say if the window is closed.

Someone else may come along and say “I know exactly why the original code failed”, but hopefully what I’ve said here can help you anyway :slight_smile:

[I edited this post a couple of times to get all the code punctuation right.]

  • Wade

Thanks for the help, I guess it would just be better to use a substitution.