*fake_choice and *gosub


I was messing about with *fake_choices. I included a *gosub in the middle of each disparate section under my fake_choice options (if that makes any sense), because I had one repeating paragraph but wanted to add a few flavour paragraphs on either side.

Quicktest ran happily and didn’t report any falling out errors, but randomtest gave the “illegal to fall out of a *choice statement” though I was using fake choice.

I wasn’t sure if it was a bug, or an aspect of randomtest, or if I just shouldn’t use *gosub around *fake_choice.


I vaguely remember somebody on the forums saying that when they decided that their *fake_choice would work better as a *choice, they just added code under it and treated it as a *choice and randomtest accepted it.


Use *choice when using *gosub


At the end of each disparate part, after *gosub, place a *goto. Although I haven’t really done much with *gosub, I have done a lot with *fake_choice (to the point where I don’t use *choice at all)… quicktest will give a fall-out if there are sub-choices in the fake choice, but this can be cleared by adding *goto after each body of choices on that line. (hopefully this too makes sense)


*fake_choice and *choice should work but whichever you use will require a *goto at the end of the dialogue.

Are you gosubing to another response or is the repeated section outside of the choice?


Thanks, all!

I did change the *fake_choice to *choice straightaway, so I could test without crashing With my simplistic coding abilities, I always try to use *choice when I need to use *goto anyway, just to keep things clear for myself.

I was just curious as to whether it was intentionally designed so that *fake_choice and *go_sub don’t get along, or whether it was a randomtest-related problem. I’ve discovered a few issues where I have to code a certain way so that randomtest runs properly - like using

*if (perspective > 60)
  You perceive!
  *goto foresight
  *goto noforesightforyou

Instead of using:

*if (perspective > 60)
  You perceive!
  *goto foresight
*if (perspective <= 60)
  *goto noforesightforyou

It took me rather a while to figure out why the second version was breaking randomtest, especially since the passage in question was pretty complex . . . It occurred to me eventually that I had read in the wiki about the glories of *else, and that this was probably one reason why.

This time around, I was able to fix it right away by substituting *choice and *goto, but I was curious as to whether it was an intentional design or just part of randomtest being what it is, and why so.

@Kelvin That’s an interesting thought. I put the repeated section at the very bottom, underneath the final *goto_scene, like I do with all subroutines so it won’t muddy up any of the other code. Would that make a difference?


Your randomtest seems outdated? Mine works just fine on something like the second example- except instead of (perspective <= 60) I’d code (perspective < 61).


Possibly? I’m using @CJW’s beta CSIDE, and I thought the current build had the latest version.


In this case, try just pulling your code out, and pushing it into a fresh copy of CS. (I also recommend using the .bat version of testing if you can.) See if either of those change what you’re getting back.


That second snippet works fine on the Windows version, are you sure it’s not something else that’s causing a problem? I think it’s the latest, but even if it’s not, I can’t see that there’s been any recent changes that would cause such behaviour.


Thanks! I’ll play with it a bit once I’ve finished with this current update.

@CJW Any thoughts about *fake_choice and *gosub? Is that a bad combination generally?


I actually rarely use the standard *choice command myself because more often than not when I write a choice I’m changing variable values, not redirecting players explicity, so I dislike that you’d have to have a load of redundant *goto after_this_choice labels.
*gosub makes both *fake_choice and *choice much more readable than it would if you crammed in 5, 10 or however many lines you like needed under each of the choice options.