Best way to do modular scenes


Suppose I have 3 cities, and the pc can go to any 1 of them first and return to cities once they’ve been there. What is the best way to do that coding wise? goto_scenes? Then how would you code the scene_list in the original startup file, which usually needs to be in chronological order?

You just need to place choice “where to go” before the text of visiting. It could be in the separate scene (then it should be listed before any city scene in the startup file) or in the beginning of whatever city is listed first in startup.
Something like

Where are you going?
  #City A
    *goto_scene cityA beginningA
  #City B
    *goto_scene cityB beginningB
  #City C
    *goto_scene cityC beginningC

After that you should be careful with *goto at the end of the scenes, so the player won’t be caught in a loop of traveling from one city to another.

If each city deserves its own chapter–then yes, *goto_scene is your best option to keep everything tidy.
If you end the chapter with another goto_scene it doesn’t need to be in the scene list

1 Like

While the above suggestion is what you want you also need to be aware is that will send you to the same place every time you go on it. So you’d need a few additional variables to check how many times the player has visited the city.

Edited to add an example based off the suggestion above. (Although my example is if the city scenes are all in the same file)

*create city_a false
*create city_b false
*create city_c false

*label journey
"So where are you going?" the coachman asks.
  #"To City Alpha please."
    *goto city_alpha
  #"To City Bravo please."
    *goto city_bravo
  #"To City Charlie please."
    *goto city_charlie
  *if (((city_a) and (city_b)) and (city_c))
    #"Take me home."
      *goto home

*label city_alpha
*if not (city_a)
  *set city_a true
  This is the first time you've visited City Alpha. It is beautiful and full of nature.
  *goto journey
  You've returned to City Alpha, the beauty has faded somewhat.
  *goto journey

*label city_bravo
*if not (city_b)
  *set city_b true
  This is the first time you've visited City Bravo. It is a technological marvel.
  *goto journey
  You've been to City Bravo before, it feels like you've traveled even further into the future.
  *goto journey

*label city_charlie
*if not (city_c)
  *set city_c true
  This is the first time you've visited City Charlie. The building rise up into the sky.
  *goto journey
  Walking into City Charlie again, you notice a few of the buildings have collapses.
  *goto journey

*label home
You safely reach home.