I’m debugging a complex module, and I would like to leave all my debugging text labels and graphics, and disabling them while actually playing a game (they’re invasive for whoever wants just to play the game).
I’m wondering if there’s some Global Properties which allows me to determine if
the Module has been opened with “Edit” or “Open”
(in case of Edit) there’s a running game (loaded from save or “new game”) or not
I am not sure this is possible… You could perhaps limit the playtesting stuff to a concrete Player Side (“Playtester”), any other player would not be able to view the degugging stuff… But you would need to set many conditionals for testing the player side for these labels and graphics.
Otherwise only a custom Java code comes to mind, but I cannot help there at all.
I generally define a Global Option - which users may toggle from the module specific Preferences tool - called - say debug.
In various reportFormat, and Report Action traits, I then write BeanShell expression a la
{debug ? ("~"+BasicName+"....)+""}
so that such messages are only reported when the preference is enabled. I sometimes also do a similar thing for a verbose user preference.
You can see examples of this is practically all of my modules.
The strategy above does not filter on specific events, but only whether the user has enabled the debug preference. However, you can use global properties like ModuleGameFileName to check if a .vsav or .vlog has been opened, and CurrentMap=="" to see if a piece is in a piece palette rather than on some map. BTW, I’m not sure what you mean by “. (in case of Edit) there’s a running game” - if you have opened a module in the Vassal editor, there’s never a running game in that process. Perhaps you mean something else? Also note, that sometimes there might be a game going on but there’s no loaded .vsav or .vlog.
Yeah, i’ve put a Scenario Option for this, just to have a checkbox handy to toggle on and off.
When you edit a module, you may have an “empty” game (you’re just working on traits and properties etc), then you can start a New Game, or open a saved one, to drop some pieces, see how they looks and how they interacts. So I was asking if there’s a way to discern the two different … “game status”.