Create account / Log in

Globals - delete piece on only the map?

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Globals - delete piece on only the map?

Postby DaveyJJ » September 12th, 2020, 11:43 pm

HI all,

I have a global command triggered by an end-turn action that removes certain markers from the main map window. I've just noticed that it removes those same markers from the scenario card window as well! That means a supply marker on the map goes away (perfect), but also every supply marker on the scenario card (that will be available in future turns) goes away as well (bad!).

How do i generally modify the delete command to only affect pieces in the main map window? Thoughts?
DaveyJJ
 
Posts: 18
Joined: May 16th, 2010, 11:44 pm

Re: Globals - delete piece on only the map?

Postby m3tan » September 13th, 2020, 1:01 am

There is a system property called "CurrentMap" which reports on which map each piece currently resides. So if the name of your main map is "Main Map", you want to add to your existing Beanshell expression {[EXISTING EXPRESSION] && CurrentMap=="Main Map"} to your Global Key Command. This will limit the GKC to only pieces on the Main Map. Those that are not on the Main Map would fail that expression test. Another way to solve the problem would be to add a Restrict Command to each affected piece with the expression {CurrentMap!="Main Map"} that would disable the key command that is executed by the GKC. This is a less efficient method, but I've had to resort to it in a few unusual circumstances.
User avatar
m3tan
 
Posts: 209
Joined: August 12th, 2018, 11:49 pm

Re: Globals - delete piece on only the map?

Postby DaveyJJ » September 13th, 2020, 3:46 pm

Perfect, thanks.
DaveyJJ
 
Posts: 18
Joined: May 16th, 2010, 11:44 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 2 guests