New Chapter which strays from the navigator in the mygame.js file



Depending on the choices that the reader makes in the story I would like different chapters to be read. How do I go about this? In the navigator section in the mygame.js file, it just has a concrete order of chapters, no matter what.

Anybody help?




It acts just like a *goto, except it sends you to the start of a scene, rather than a label.


Ok, but what happens after that scene? Does the navigator send it to the chapter it would have sent it earlier?



The sceneNavigator is a sequential list, so if you have e.g. 5 scene files listed, chapters1-5 in that order, a *finish command in chapter3 will always load chapter4, and a *finish in chapter4 will always load chapter5.

With *goto_scene you can choose which scene to send it to, whether or not that particular scene is listed in the sceneNavigator.


If you *finish a scene, it just sends it to the next one on the list. So if you have scenes lettered A to Z, and from scene B, you *goto_scene T, if you *finish it’ll go to scene U. If you want it to instead go to scene C, rather than *finish scene T, just *goto_scene C.

Edit: Fricken ninja >.>


*whistles innocently, while juggling with his shuriken*


Poor reaperoa… xD


@bradhal Just a thought, if you intend to do quite a bit of *goto_scene jumping backwards & forwards between different scene files, it may be worth including something like a “return_to_scene” string variable in mygame.js, intended to carry such as a scene name. You can leave it blank to begin with, using double quotes:

,return_to_scene: ""

Then, for example, if jumping to chapter4 from chapter1, but you actually want to return to chapter1 in this instance, before the *goto_scene chapter4 you would:

*set return_to_scene "chapter1"

At some point in chapter4 you would then need to add a label section roughly as follows, to handle the return to the correct (originating) scene name.

*label redirect
*if return_to_scene = "chapter1"
  *goto_scene chapter1
*if return_to_scene = "chapter2"
  *goto_scene chapter2
*if return_to_scene = "chapter3"
  *goto_scene chapter3

With that you would be able to return to the exact scene from whence you came.

Of course, at the very start of chapter1 you would then need to add additional scripting to determine what to do if the game returned here from another chapter, rather than being a new game (or loaded sequentially via the sceneNavigator). For example:

*if return_to_scene = "chapter1"
  *set return_to_scene ""
  *goto specific_label

Note that there’s also no reason why you could not also define a “return_to_label” string variable as well, set that accordingly before the jump from chapter1 to chapter4, and upon returning to chapter1 it would use *if conditions in place of that *goto specific_label line above, in order to now jump to the exact required label in chapter1.

(N.B. All credit to @Reaperoa for the original design of this scene-jump-return system, just to make up for ninja-ing him earlier in the thread. :smiley: )


I like that. Was gonna ask if anyone’s done a gosub-return thing in between different chapter files. This one will do.


@FcA It’s very useful, I’ve used it a lot in Vendetta since @Reaperoa first came up with the concept. It’ll be added to the Wiki soon, on a page covering various useful tips & tricks and likely to be called something like “Basic Scripting Techniques” or similar.