Goto_scene help

I’m having trouble with… the goto_scene command

The error I’m getting is when I test the #option to try and wake up the barkeep, the text “The man is a heavy sleeper…” displays along with text at the end of the sentence from the *goto_scene barkeep1.

My code looks like this:

*choice
	#Try to wake him up and get information.
		The man is a heavy sleeper and it takes an uncomfortable amount of force to finally wake him up. He looks up at you and gives you a stupid grin as the side of his face still rests against the counter.
		*goto_scene barkeep1

	#Pick a table and wait for your contact.
		You pick a table in the center of the tavern and sit facing the entrance with your feet propped on the table. Some time passes and you start to get frustrated that your contact isn't showing. You have had a long journey and you begin to feel thirsty.
		*choice
			#Yell for the barkeep.
				The man stirs and seems a bit surprised someone showed up.
					*goto_scene barkeep2
			#Fall asleep.
				You are awakened as someone enters and approaches.
					*goto_scene rogue2

I need help trying to figure out what the issue is here.
I also have another question, and that is if there is a way to condense scenes. As you can see, there is a barkeep1 and barkeep2 scene. Do I have to have two different scenes for these two different interactions, or can I put both interactions onto one scene and somehow hide the other interaction?
Not sure if i’m supposed to have a ton of scenes or not. So far I have begun labeling scenes specific to the rogue character as rogue1, rogue2, and so on as a representation of pages in a book. Should I in the end have tons of scenes?

I am so sorry. I know i’m asking for a lot of information here. I’ve only just started using choicescript and can’t seem to find anyone else that has had the same problem as I do right here. I’ve been playing with this script all day and i’m still learning.

Thanks.

2 Likes

I don’t quite know what you’re trying to do here in regards to the text. Do you not want the text from the scene to show up after the first sentence? If so, you could probably insert a *page_break there.

As for condensing scenes, absolutely. You just need to create a label (easily done with a simple *label miniscenename) further down in whichever scene you’re going for, and use *goto instead of *goto_scene.

2 Likes

So is kind of This:

What if instead it was this:


*choice 
  #Try to wake him up and get information. 
    The man is a heavy sleeper and it takes an uncomfortable amount of force to finally wake him up. He looks up at you and gives you a stupid grin as the side of his face still rests against the counter. 
    *page_break
  *goto_scene barkeep1

The ‘*page_break’ command will make the content of barkeep1 be in the page after the player click next

1 Like

I tried inserting the pagebreak and it worked. Thanks, I had forgotten about this command.

*choice 
  #Try to wake him up and get information. 
    The man is a heavy sleeper and it takes an uncomfortable amount of force to finally wake him up. He looks up at you and gives you a stupid grin as the side of his face still rests against the counter. 
    *page_break 
    *goto_scene barkeep1

The only thing I did differently was put the *goto_scene and the *pagebreak on the same indent. I am not sure if it matters or not by indenting it further in.

1 Like

So should I have a single scene which contains many labels that I can “*goto_label”
Like a rogue.txt scene I am able to refer back to repeatedly depending on each #option?

Thanks for helping so quickly. I am going to mark Nahim’s post as the solution.
I hope this post doesn’t close prematurely before you can reply, FantaPop.
If it does, I hope you please send me a message.

2 Likes

I believe it really depends on your own preference.

If you’d like to have a main scene and go to specific scenes depending on class/etc., you absolutely can, though I believe it’s recommended to keep scenes under 250kb of data. Another way you can do it is have everything in one scene and just jump to specific labels in the scene to continue the narrative. Either way, you can format your code however you like to keep it straight.

A quick example of the latter from my own code:

*choice
    #It sounds like a fox.
        Words here.
        *goto trap
...

*label trap
More words
*goto trap2

*label trap2
etc.
*finish

Thanks. I will try this out.

1 Like

The term “scene” may have led you to believe that each story scene needs its own file. The truth is, you can use *goto commands to control which parts of the scene file get “poured” into the browser window for the player to see. Personally, I’ve actually never used *goto_scene because I haven’t needed it. You can organize the different passages of your code in whatever way is easiest to keep track of, for you personally. It might help to take a look at how your favorite game or WIP does it.

2 Likes

You probably already now that right now, but took me ages to realize things like that you can access specific labels written in other scenes without exiting a sub routine. Thatnks to commands like:

*gosub_scene "scenename" "labelname"

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