Hi,
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 - sayGameLoaded
(or something otherwise appropriate) - contains a specific string - saytutorial.vlog
- The
Startup Global Key
may have to trampoline through a regularGlobal 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
-
VASSAL.build.module.GameState.decodeSavedGame(InputStream)
should accept another argument of classString
, which if is not empty would set the global propertyGameLoaded
(or similar). -
The overload
decodeSavedGame(File)
can useFile.getPath
(or similar) to propagate the filename to theInputStream
overload. -
Now, clearly the class
VASSAL.build.module.WizardSupport.SavedGameLoader
would need to have the filename information too, as would derivedVASSAL.build.module.WizardSupport.TutorialLoader
(perhaps these should be passed thePredefinedSetup
andTutorial
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 bepredefined:
- e.g., theGameLoaded
could have the valuepredfined:EasternFront.vsav
- For a tutorial it could be
tutorial:
(defined byTutorialLoader
) - e.g., the value ofGameLoaded
could betutorial:Tutorial.vlog
- For disk files (or perhaps remote files) it could be empty to match
VASSAL.module.build.GameState.decodeSavedGame(File)
.
- For
- Perhaps the base class
-
VASSAL.module.build.GameState.loadGameInBackground(String,InputStream,boolean)
(andloadGameInForeground
) should also pass it’'sString
argument todecodeSavedGame
.
The only other alternative I can currently see is to
- Define the module, including some special interface that sets the global property
IsTutorial
,
and theStartup 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
- Activate the special interface to set
- 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.
Thanks.
Chrisitan