Weird indentation error


#1

I’m working on a ChoiceScript game, which is going quite well. But now I’m stumped by an indentation error I just can’t make heads or tails of. I’ve pared down the game to the following minimal code:

*temp descriptions 0

*label describe_Turandot
*fake_choice
  *hide_reuse #Sad
    So sad.
  *hide_reuse #Weary
    So weary.

*set descriptions +1
*if (descriptions < 2)
  *goto describe_Turandot

This game runs perfectly if you first choose Sad and then Weary; but if you choose the options the other way around, it crashes with the error “temp line 8: increasing indent not allowed, expected 2 was 4”. (I originally had five options, and crashes happening after the third choice with no very evident patterns in which combinations crashed and which didn’t.)

It looks to me as if the indentation is correct, and the fact that it sometimes runs without error seems to confirm this. Any idea what is happening here?

EDIT: It seems the issue disappears when you turn the fake_choice into a choice, but I don’t see how that makes sense.


#2

Congratulations, you appear to have fixed your own error. :slight_smile:

The wikia says

However, it should be noted that either purpose of this command is only of use in those cases where you specifically intend to allow the re-use of some or all parts of a particular *choice statement. In most cases a *choice statement is used only once within a particular scene, so a *hide_reuse condition will not be needed. http://choicescriptdev.wikia.com/wiki/Hide_reuse

Is that the issue that’s playing out? Or is it just that hide_reuse doesn’t like the fake_choice command?


#3

I understand what the wikia says, and as you see I’ve set the code up so that the choice is indeed presented multiple times. The problem that I have (or had, but not understanding what is going on is also a problem, as far as I’m concerned) is that:

(a) apparently, using hide_reuse in a fake_choice command leads to errors, but
(b) the error message doesn’t actually have anything to do with either hide_reuse or fake_choice, and
© using hide_reuse in fake_choice is supposed to be legal, as far as I can see.

So either I am making some mistake I don’t understand, in which case I’d like to understand it; or there seems to be a bug in the underlying fake_choice/hide_reuse code, in which case I’d like to report it. Anyway, thanks for thinking along with me!


#4

In your code, do you have hide_reuse under every single option? Or do you have one that isn’t hide_reuse? That’s what I was asking, since the wiki says you need to have one option that’s not hide_reuse. Although if it works with choice and not with fake_choice I’m not sure if that’s the issue.

I think it is preferred that choice is used instead of fake_choice. Fake_choice has been expanded to be far more flexible than it was, but I’m not sure if it has the complete functionality. If it’s something that choice does that fake_choice doesn’t that’s interesting.

If it’s an undocumented bug though @dfabulich might at least be able to look at it and fix the error text.


#5

the wiki says you need to have one option that’s not hide_reuse

Does the wiki really say that? I guess the phrase “you specifically intend to allow the re-use of some or all parts of a particular *choice statement” could be read that way, but if that’s intended, it is extremely implicit. I also can’t find any mention of this in the official documentation. It also seems that the very possibility to use “*hide_reuse” as an option for an entire scene means that this can’t be the case – for that automatically makes every option of every choice a hide_reuse option.

Obviously, the game will throw an error if no options can be chosen at all – but that’s not what is happening in my example (or real) game.

(I’ve notified Dan about it.)


#6

Yup, this is a bug with *fake_choice and *hide_reuse that I wasn’t aware of. It’d be tricky to fix, and there’s an easy workaround, so I’m not sure I’ll fix it any time soon. :cry:


#7

Though, to make a case for the other side (which is always easy when you’re not the one having to do the work! :wink: ), it is a bug that could easily creep into games without being noticed by the author.