How to check when a module is edited and when it is played

I can’t find how to check whether a module is edited or played. I want certain trait functionality to work only while playing because inside editor it would be meaningless and could cause some NPEs. I know there are methods in AbstractLaunchAction (isInUse, isEditing) but they require a File object and I don’t know where to get it. Also, I may be looking at wrong thing to use. Any hints?

Thus spake “morvael”:

I don’t know the answer to your main question, but: AbstractLaunchAction is
part of the Module Manager; it should not be instantiated or used from the
Player or Editor.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Maybe I will rephrase the question. Is there a difference between pieces shown in module editor and pieces in game piece palette and those pieces that were created in game by dragging them from palette? Something like only those created have game piece id or something that I could check for? So that for example custom drawing code or dynamic key commands initialized from code would not try to render themselves in module editor and piece palette. That’s what I’m looking for.

Pieces in the Game Palette or displayed in the module editor are not on a Map and so the CurrentMap property is null and can be checked with the property expression

CurrentMap=

or in custom code:

(getproperty(BasicPiece.CURRENT_MAP) == null)

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks Brent, you are truly VASSAL’s Keeper of Knowledge!