I think—though I’m not absolutely certain—that *gosub_scene retains all your settings from the initial scene (and plain *gosub certainly does).
If I understand correctly, *gosub and *gosub_scene essentially are the equivalent of plopping that section of code into your scene file—just, it’s conveniently tucked away somewhere else for tidiness and easy of access. (:
Edit: Oh yes, the Wiki says you are fine. From here:
It is the basic nature of ChoiceScript to “unload” one scene when it loads another (i.e. when using either the *finish or *goto_scene commands), meaning that any existing scene-specific *temp variables and #option _reuse states (*hide_reuse, *disable_reuse & *allow_reuse) are lost from memory - mostly because they’re no longer actually needed once the game advances to a new scene file.
*gosub_scene, however, essentially (if briefly) loads the indicated file behind-the-scenes and does not actually “unload” the current scene file in the process, meaning that unlike for a *goto_scene, all of the current scene’s *temp variables and #option _reuse states are retained in memory and will still apply after the subroutine has been used.
Honestly, as you can tell I have a pretty limited understanding of gosub due to not having used it elsewhere in the story. I set it up this way because in the original post Alexandra made, that was how she referenced it, as a subroutine in a separate scene file.
@Szaal, if there’s a better way, definitely let me know. I have only implemented it in part of one chapter to test it (it worked), so I still have time to go a different route.
My (hopefully) last question before this monument to my noobness goes idle (at least, until my next project).
I am on my last playtest before submitting. All is well, except an achievement I have tied to getting a stat above 25 keeps popping up with the message every time you go to the stat screen, as if you just unlocked it. How do you get it to stop showing once the achievement’s been gotten?
Are you triggering the achievement from the stat screen? And if so, do you particularly want to carry on doing so rather than from a chapter’s end? (As is, if it’s from the stat screen, this would mean people who don’t check their stats would never receive the achievement—and I don’t know what it’d do to, say, the iOS tablet view where the stats are always visible alongside the code).
Anyway, there’s also the very convenient check_achievements command. You can use:
You could just check at the end of a chapter, or you could use *gosub every time you raise that particular stat to go to a bit of code that checks if it’s over 25 and if the achievement’s already been reached, and then if not it gives the achievement.
Maybe, if you’ve not yet, try taking a look at the wiki page for a detailed explanation on how to use the *check_achievements command, with some ready-made samples? If that doesn’t help, I can try explaining it as well, if that’d be useful.
So i was randomtesting but i got the error:
RANDOMTEST FAILED: Error: line 301: No selectable options
But in the line 301 i have a hide_reuse + selectable_if command. The code looks like this;
*label packing
You've got ${hoursleft} minutes to pack up.
*line_break
*line_break
What wouldyou like to do…
*choice
*disable_reuse *selectable_if (hoursleft > 30) #Take a shower. (30mins)
*set hoursleft -30
*goto packing
*disable_reuse *selectable_if (hoursleft > 15) #Put all the clothes you like into your bag. (15mins)
*set hoursleft -15
*goto packing
*disable_reuse *selectable_if (hoursleft > 45) #Put all your clothes, skin care products and your memory box into your bag. You might not come back again at all. (45mins)
*set hoursleft -45
*goto packing
*disable_reuse *selectable_if (hoursleft > 00) #Caffeine! It always helps...
*set hoursleft -30
*set caffeine +1
Some text in different language here.
*line_break
*line_break
Text in different language.
*page_break
Text in different language.(Then) You have always been a dreamer, haven't you?
*choice
#Yes, i've always liked to dream.
*set Dreamer +50
*goto packing
#Yes, i've liked to dream occasionally.
*set Dreamer +25
*goto packing
#I like to dream sometimes but i don't escape from the truth.
*set Dreamer +0
*goto packing
#I dream rarely. I don't like to escape from truth.
*set Dreamer -25
*goto packing
#No! Dreaming is for losers.
*set Dreamer -50
*goto packing
*disable_reuse *selectable_if (hoursleft > 30) #Text in different language.. (30dk)
*set hoursleft -30
*set Combat +3
Text in different language
*goto packing
*disable_reuse *selectable_if (hoursleft > 30) #Text in different language. (30dk)
*set hoursleft -30
*set Persuasion +3
*set Intelligence +3
Text in different language.
*goto packing
*disable_reuse *selectable_if (hoursleft > 00) #You leave.
*goto check_dreamer
*label check_dreamer
Since i was too lazy to translate some of them right now, i just put "text in different language. I guess what randomtest couldn’t get through is that it tries all the options and run out of time so it becomes unable to choose some of the options. But how is it possibleto pass randomtest when you have a code like this ?
I would delete the *selectable_if on #You leave entirely… you always have 0 or more hours left, so it can’t do anything useful.
Similarly, I’d assume that once you decide to leave, you’re done with this section of the game, so probably the *disable_reuse option isn’t doing anything there, either.
So changing that line to just #You leave with no modifiers will probably fix it.