Ultimate Noob Coding

Hi, me again. I’ve got a choice where I’m using disable_reuse (because it’s a question segment), and I keep getting an error where there’s “no selectable options,” despite there being an option to continue on.

 *disable_reuse #"How far away is Thessama Ridge?"
    Yapping
    *goto Question1

 *disable_reuse #"Are we getting any support?"
    Yapping
    *goto Question1

 *disable_reuse #"What kind of enemies can we expect?"
    Yapping
    *goto Question1

 *disable_reuse #"When do we get our relief?"
    Yapping.
    *goto Question1

 #No questions.
    Yapping.
    *finish```
Question1 is labeled before the choice.

It’s probably an indentation issue. Make sure that all choices have the same number of spaces before them.

1 Like

Yup, they all only have one space before them. Did not work.

Still can’t help wondering if indents are the trouble (since they usually are). The fragment you’ve shared reads a little oddly – alternating between one-space and four-space indents. Is that how you’re doing it consistently in your WIP? And is it working for you elsewhere?

I’ve done it elsewhere and randomtests at least have not caught any issues. Here I even tried cutting down the number of indents from 4 to 2 and that still didn’t work.

Have you tried 2 and 4, rather than 1 and 4?

2 and 4 indents?

Two-space indents (instead of one-space) in front of your *disable_reuses and four-space ones (as at present) in front of Yapping etc.

Edit: in the event that’s not it, could you post the whole block from *label Question1 on down? I don’t see a problem in what you’ve shown us, so it’s worth checking up and down a bit.

When I tried that I got an error about increasing indents. When I fixed that, it went back to the error of saying there’s no selectable options. Here is the full thing with no paraphrasing:

*comment Getting a no selectable options error here, even though the last option breaks the loop. Maybe check back later and it'll work? Use seed "56"
*choice
  *disable_reuse #"How far away is Thessama Ridge?"
    “Five kilometers, give or take. May feel like more because of the terrain, but it’s only five kilometers.” He responds, glancing upwards and behind him. Sounds like a bit of a hike, but it’s far from the longest you’ve gone with a full combat load.
    *goto Question1

  *disable_reuse #"Aren't we supposed to be supported by other units? Why are they only sending in a company?"
    Tinnes seems to grapple with the question for a few moments before giving you an answer. “The rest…of the Karmon division here is otherwise engaged. As for the rest of the 2nd Brigade, we've outpaced them. We just moved faster than they did and are being used to shore up the line.” You can tell that he’s not telling the entire truth, but you decide against pressing him for more answers. With Petra glaring daggers at you from the side, you decide it might be best to drop it for now.
    *goto Question1
*comment TypeError: Cannot read property 'endLine' of undefined, WHATEVER THAT MEANS.
  *disable_reuse #"What kind of enemies can we expect on the Ridge, lieutenant?"
    Tinnes smirks. “Valmarans, of course.”
    
  A nervous chuckle goes up from the assembled platoon, only to abruptly stop when a shell whizzes overhead- thankfully very far off target. You silently think to yourself that it may be best to lay off the jokes.
    
  "Reports are spotty at best. The enemy likely doesn't have cavalry deployed in the area due to the rough terrain. It should just be infantry and shellfire to contend with, but be ready for anything." He nods at you.
    *goto Question1

  *disable_reuse #"When do we get our relief?"
    Tinnes frowns at you, the question obviously having displeased him. “No need to worry about our relief. We just got here, after all. Worry about that tomorrow.”
    
  [i]Tomorrow?[/i] This may be a more drawn out affair than you would have been lead to believe.
    *goto Question1

  #"No questions, sir."
    Tinnes can offer only a whisper of a smile before he pulls out his service sidearm and flicks off the safety. “Keep your wits about you, and we’ll all be better off. Platoon, on me.” With that, he turns on his heel and continues to lead the platoon up and out of the draw, towards your designated position. The other platoons of the company follow behind you dutifully.
    *finish```

Ah excellent, that shows the actual problem. :slight_smile: First and foremost it’s this line:

*comment TypeError: Cannot read property 'endLine' of undefined, WHATEVER THAT MEANS.

Because that comment is unindented, it’s breaking up your choice block. By having code (even a comment) at that indent level, you’re essentially telling the computer that the *choice and everything following it is over. So the computer never parses any of the options below that point, including the “No questions, sir.” It thinks you have a two-option block, with both options starting with *disable_reuse.

If you indent the *comment to be at the same level as *goto Question1, you’ll not have that problem.

Of course you’ll still have the error it’s describing. To fix that, I reckon you also need to indent the lines starting with “A nervous chuckle…” and “Reports are spotty…” and “Tomorrow?…” to be at the same level as “Tinnes smirks.” and *goto Question1

Otherwise that will also throw errors. Right now it looks like those lines are indented to the same level as your *disable_reuse #Options. The computer will choke on that…it needs everything at that indent level to be an #Option until the end of the choice block.

HTH, let me know if it still doesn’t work.

That worked (I think, I’ve been running randomtests and it hasn’t snagged there again) but I am having an issue with another piece of code saying that it’s illegal to fall out of a choice without a goto or finish command, even though there’s already a goto command at the end. This indentation is identical to every other option in the scene.

       "Hello?" You open, seeing the person's head whirl around towards you. The person in question is a young woman, her azure eyes wide and every muscle in her body tense. She obviously hadn't been expecting company in the rain, and as she sizes up her uniform she begins to try to covertly ease away from you. 
       
       "I just want to talk, okay? I just want to know who you are."
    
       It's clear that the dark coated soldier obviously doesn't understand you, but she makes no moves either away or towards you. At the very least, you have her attention.
       *goto_scene deserterquestioning```
1 Like

Just to check: the scene deserterquestioning.txt exists and isn’t blank?

Yes.

Well, whatever the problem is, it’s not in the bit of code you’ve shared. :slight_smile:

There are other options before it, but I can clearly see where each of those ends up. There’s else and if statements there too, but like before those end with going to another scene. As far as I can tell it’s not an indentation issue because it’s only flagging that option- and it’s indented like everything else.

If you share the whole choice block that it says you’re falling out of, I might be able to see what’s going on.

*choice
   *if (Intelligence >=30) #No sense in hurrying. You stay where you are and observe.
    Something suddenly clicks in your mind. While you're not close to the border, you vaguely remember something about the Lyseran Empire utilizing a certain dark colored dye in their uniforms, resulting in a very distinctive color. Then again, what would a Lyseran soldier be doing so far from home? You're reasonably certain that they ought to have their hands full defending their own borders.
    *goto desertion

    *else
     As you observe this mystery person like a deer in headlights, you see them unhook a canteen from their belt and dunk it into the rushing stream, still painfully oblivious of your presence. You can barely make out black leather webbing that hangs loosely off of their form, but as far as you can tell they're unarmed.
    *goto desertion
   #They're not wearing a Karmon uniform, so as far as you're concerned they must be the enemy. You rush them down.
    *if (Intelligence >=30)
      As far as you're concerned, the only people around here wearing uniforms should be you and your company, which means that they're one of the enemy. You rapidly close the distance, and the mystery person looks up just in time to see your knee descending into their face. There's a solid crack as your knee makes contact, sending them sprawling onto the dirty ground.
    
      The sudden onset of combat (or the fact that you just jammed your knee into their now bleeding nose) seems to have stunned them, as they lay there confused. You rest your foot firmly on their chest, preventing any further movement.
    
      Your target in question is a young woman, her azure eyes wide and shortened black hair covered in muck.
    
      "Non mandarmi indietro. Per favore…"
    
      While the Valmar Tsardom has many ethnicities who speak many different languages, you're reasonably sure that whatever she just said isn't one of them. Her plea is desperate, the gravity of the situation seeming to set in with a vengeance. She begins clawing at your boot with a newfound ferocity.
      *goto makethechoice
    
      *elseif (Intelligence >=40)
        As far as you're concerned, the only people around here wearing uniforms should be you and your company, which means that they're one of the enemy. You rapidly close the distance, and the mystery person looks up just in time to see your knee descending into their face. There's a solid crack as your knee makes contact, sending them sprawling onto the dirty ground.
    
        The sudden onset of combat (or the fact that you just jammed your knee into their now bleeding nose) seems to have stunned them, as they lay there confused. You rest your foot firmly on their chest, preventing any further movement.
    
        Your target in question is a young woman, her azure eyes wide and shortened black hair covered in muck.
    
        "Non mandarmi indietro. Per favore…"
    
        You recognize the Lyseran as soon as it leaves her lips. While you cannot speak to the authenticity of the accent, you at least recognize the language. Her plea is desperate, the gravity of the situation seeming to set in with a vengeance. She begins clawing at your boot with a newfound ferocity.
        *goto makethechoice

      *else   
       As far as you're concerned, the only people around here wearing uniforms should be you and your company, which means that they're one of the enemy. You rapidly close the distance, and the mystery person looks up just in time to see your knee descending into their face. There's a solid crack as your knee makes contact, sending them sprawling onto the dirty ground.
    
       The sudden onset of combat (or the fact that you just jammed your knee into their now bleeding nose) seems to have stunned them, as they lay there confused. You rest your foot firmly on their chest, preventing any further movement.
    
       Your target in question is a young woman, her azure eyes wide and shortened black hair covered in muck.
    
       "Non mandarmi indietro. Per favore…"
    
       Her plea is desperate, the gravity of the situation seeming to set in with a vengeance. She begins clawing at your boot with a newfound ferocity.
    
       "Mi sparano se mi mandi indietro! Per favore!"
    
       While her struggles are annoying, it's nothing that you can't deal with. However, there is the question as to what to do with this person.
        *goto makethechoice

   #You decide to try to talk things out. No reason that you can't do this peacefully.
       "Hello?" You open, seeing the person's head whirl around towards you. The person in question is a young woman, her azure eyes wide and every muscle in her body tense. She obviously hadn't been expecting company in the rain, and as she sizes up her uniform she begins to try to covertly ease away from you. 
       
       "I just want to talk, okay? I just want to know who you are."
    
       It's clear that the dark coated soldier obviously doesn't understand you, but she makes no moves either away or towards you. At the very least, you have her attention.
       *goto_scene deserterquestioning```
2 Likes

Your indentation is all over the place. The else’s and elseif’s should be indented the same amount as the if’s, and the goto’s should be indented the same amount as the text blocks they belong to.

Also, you’ll want to check the higher value of a stat first. Now you’ll never be able to activate the elseif (Intelligence >=40) option, because the player with an intelligence >= 40 already ended up in the if (Intelligence >=30) branch of the option.

1 Like

Thanks for sharing!

First some advice: consider editing your whole game’s text so far to use a consistent number of spaces for every indent level, and having that number always be more than 1. (So indent levels of 2, 4, 6, 8… or 3, 6, 9, 12…)

Feel free to ignore this, bc at the end of the day whatever comes naturally may be the right answer for you as long as it passes RT/QT. But indent errors can be easier to catch if they’re >1 space and a consistent distance.

Now bug catches. (1) This text will never be reached:

*else
 As you observe this mystery person like a deer in headlights...

It’s at the same indent level as *goto desertion, so the computer reading code at that level will have already gone to *label desertion and never get to the *else.

If it did see the *else, it would choke for a couple of reasons. (1A) It wouldn’t know “else of what?” There’s no *if on that indent level.

The nearest *if above it is

*if (Intelligence >=30) #No sense in hurrying. You stay where you are and observe.

But that’s an #Option. Remember that for every choice block, you need an indent level that is nothing but #Options…the middle level in this example:

Game text
*choice
    #Option 1
        Option 1 text
        *set var
        *goto label
    #Option 2
        Option 2 text
        *goto label
    *if (var > othervar) #Option 3
        Option 3 text
        *goto label

If you’ve got an #Option behind an *if, you can’t follow it at the same indent level with a bit of text behind an *else. And if you change the indent levels, the computer won’t know “else of what?”

In this case, either keep the *if on the Option (in which case only intelligent MCs will be able to select it, and you don’t need text that displays for less intelligent MCs) or do what you did in the next Option and have the *if/*else be on the next indent level below the #Option.

Also, (1B), the code is “falling out” of that *else right now.

    *else
     As you observe this mystery person ...
    *goto desertion

There’s no *goto at the level of the text; having one just at the level of the *else will throw an error.

(2)

    *if (Intelligence >=30)
      As far as you're concerned, the ...
      *goto makethechoice
    
      *elseif (Intelligence >=40)
        As far as you're concerned, the ...
        *goto makethechoice 
      *else
        As far as you're concerned, the ...
         *goto makethechoice
         

A few problems here. Cecilia already pointed out one of them. Another is that your *if is on a different indent level than your *elseif and *else. This will have the effect we’ve already discussed above-- the game will never see the *elseif.

That’s also at the root of the error you are seeing. With the indents set as they are, any int < 30 player never reaches a *goto.

Finally, even if you fixed the indents to put the *elseif and *else on the same level as the *if, you’d still be getting the error because your final *goto makethechoice is indented further than the rest of its option text. The computer will read the text after the *else, find no instruction at that indent level telling it where to go, and break. It won’t read the next line as a relevant instruction, bc it’s at a different indent level.

This is the kind of error that’s a little easier to spot when using >1 space indents, like I suggested up top. Or using tabs rather than spaces.

Ai, there’s a lot wrong with this section. Thanks for sticking with me so far, I highly doubt I would’ve figured all this out on my own.

So just to recap the issues (because I feel like I’ve gotten a bit lost)
*The Intelligence scores are overlapping and one of the paragraphs will never be reached.
*An “else” is at the same indentation level as one of the “gotos” meaning it will never trigger. The solution for this is to indent the gotos further…?
*an “if” command is on a different level that the “elseif”/“else” when it needs to be on the same indent level.
*The label “makethechoice” needs to be brought in line with its option text

I’ve likely missed something here or misinterpreted your statement, so please correct me!

1 Like