Goto statements within fake_choice + variables

Hello! I’m relatively new with any form of programming (I’m 100% not the best yet and my code would probably make any actual programmer cringe to their lower intestine) but whatever errors I’ve had I’ve largely been able to figure out and fix myself without too much hassle. I’m a bit stumped here, however.

*fake_choice
  *selectable_if (fakestat1 < 1) #Ask what first drew him to service.
   *set fakestat1 +1
   *goto compalt1
  *selectable_if (fakestat2 < 1) #Ask Where he got the alcohol.
   *set fakestat2 +1    
   *goto compalt2
  *selectable_if (fakestat3 < 1) #Ask what type of Daemon he is. 
   *set fakestat3 +1
   *goto compalt3
  *selectable_if (fakestat3 = 1) #Stage an intervention. He's had enough to drink.
   *goto extra1
  #I have nothing to say to him.    
   *if (fakestat3 < 1)
       *goto scream1   
   *if (fakestat3 = 1)
       *goto rage

What I’m attempting to do is direct the reader to different dialogue options based upon previous interactions with the character they are currently speaking with. I hope doing this will give decisions a more exaggerated sense of importance but my motivations are unimportant right now. For the most part, that very very very messy coding works. Except for in the final few lines. The #I have nothing to say to him., option, to be specific. When getting to this point in the randomtest and even going through it myself I just get an infinite loop of the same text. It’s supposed to direct to another scene. For some reason, the goto statements are just being ignored and the option skips straight to the dialogue for another choice written below which has no relation. This is likely a basic error with my spacing but I’m not getting any feedback because it technically works just not in the way I want it.

Anyway, I’d appreciate a response. Thanks!

Does it do the same if you just use *choice instead of *fake_choice? Because if all choices have a *goto then I don’t think there’s a need for a *fake_choice

I

I agree with @Jaitzche on the *fake_choice part. Mostly these types of codes use just a simple *choice.
However what I can see is the matter of spacing as well. In some parts, you’ve used only one tab of space in your coding. When continuing on with code on another line, there needs to be a two tab space compared to the coding above it (hope that makes sense).
Hope this helps.

Yeah use choice not fake choice. Sometimes fake_choice doesn’t play nice with gotos or selectable_if’s and you have to move things around. Since you’re redirecting after each choice with a goto anyway, just do that.

Fake choice is best used for for simple things where you have a section of text after each choice then the story continues without redirecting anywhere.

Edit: Personal preference, but I recommend using tabs not spaces. It’s so much easier to find a spacing problem if you do that. (One extra press of the spacebar is all you need to mess up the code if you use spaces and it can be hard to see.) It looks like you’ve used spaces for most of the choices but tabs for the last couple of lines? You can’t mix them, need to choose one or the other.

3 Likes

This should be an if/else clause. The second if only covers the exact opposite condition as the first, so it should properly be replaced with else. That means there are no conditions where you reach the end of the passage, and don’t know where to go next.

3 Likes

Scream and rage?


Anyway, why don’t you use *disable_reuse command? It works just like how your code would do, except cleaner without all those fakestat +1. You can also use boolean [true/false] instead of that finicky [< 1 | = 1]

2 Likes

Also a good point.

I changed the *fake_choice to *choice as @Jaitzche suggested but it seems to have have made little difference, unfortunately.

As for the spacing, would you be willing to give me specific examples as to where it’s gone wonky?

I’ve used spaces for every line of coding as for some reason tabs don’t seem to work for me? (At least for what I’ve tried. I’ll have to address that another day) But the reason that final line is so spaced out is that it doesn’t seem to register there’s another command there if it isn’t. I have absolutely no idea as to why. I have a similar command placed later in the text with the exact same formatting which works perfectly, so I can’t exactly say as to why it’s stopped doing that when incorporated with a choice.

1 Like

I used your code (hope you don’t mind) and added the *choice and the needed spacing, also tweaked it a bit at the end.

*choice
  *selectable_if (fakestat1 < 1) #Ask what first drew him to service.
    *set fakestat1 +1
    *goto compalt1
  *selectable_if (fakestat2 < 1) #Ask where he got the alcohol.
    *set fakestat2 +1
    *goto compalt2
  *selectable_if (fakestat3 < 1) #Ask what type of Daemon he is.
    *set fakestat3 +1
    *goto compalt3
  *selectable_if (fakestat3 = 1) #Stage an intervention. He's had enough to drink.
    *goto extra1
  #I have nothing to say to him.
    *if (fakestat3 < 1)
      *goto scream1
    *elseif (fakestat3 = 1)
      *goto rage

Thank you so much! This seems to have fixed the problem. I knew it was going to be a spacing error and just - ugh! For some reason, I’m still getting an infinite loop with the randomtest that’ll probably crash my computer if I let it run long enough, but when I go through the game myself it works fine and the quicktest doesn’t seem to catch anything. So that’s a little strange but whatever.

Thank you again! I appreciate it.

Edit: Figured out how to stop the loop - was an error with a repeating *goto statement.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.