Can module detect which VLOG (or VSAV) was loaded?


Is there a way for a module to detect which VLOG was loaded by the user? Is there some global property that contains the name (or the like) of the VLOG? I’ve looked around (docs and code), but I couldn’t seem to find any place where such a property is set, or similar.

The use case: The user fires up a module and selects to run the tutorial. The module should then pop-up the Notes window which will contain the tutorial messages for the user to read.

Concretely, I would expect something like

  • A Startup Global Key that fires if a global property - say GameLoaded (or something otherwise appropriate) - contains a specific string - say tutorial.vlog
  • The Startup Global Key may have to trampoline through a regular Global Key for the condition (`GameLoaded==“tutorial.vlog”).

A similar approach could be used if the module wish to give additional information if a specific predefined setup or similar is loaded.

It seems to me that

  • should accept another argument of class String, which if is not empty would set the global property GameLoaded (or similar).

  • The overload decodeSavedGame(File) can use File.getPath (or similar) to propagate the filename to the InputStream overload.

  • Now, clearly the class would need to have the filename information too, as would derived (perhaps these should be passed the PredefinedSetup and Tutorial objects directly so that the loaders can extract both content and file name directly).

    • Perhaps the base class SavedGameLoader should accept a prefix to prepend to the file name.
      • For PredefinedSetup this could then be predefined: - e.g., the GameLoaded could have the value predfined:EasternFront.vsav
      • For a tutorial it could be tutorial: (defined by TutorialLoader) - e.g., the value of GameLoaded could be tutorial:Tutorial.vlog
      • For disk files (or perhaps remote files) it could be empty to match
  •,InputStream,boolean) (and loadGameInForeground) should also pass it’'s String argument to decodeSavedGame.

The only other alternative I can currently see is to

  • Define the module, including some special interface that sets the global property IsTutorial,
    and the Startup Global Key to fire up the Notes window.
  • Open the module and start logging.
    • Activate the special interface to set IsTutorial
    • Build the tutorial using the Notes window.
    • End logging
  • Rebuild the module, but disabling the special interface, and attaching the tutorial.

This, however, scales rather poorly to other cases.

My apologies if I missed something.



1 Like