Delete a type of markers

Hello,

I’d like to add a “delete” button on the toolbar to remove one particular type of markers by clicking it.

I am able to add the button and I know that I have to use the global keycommand feature on the marker, but it doesn’t work.

Could you help me with a step by step procedure to add this feature?

I’ve tried to copy it from existing modules but it did not work.

Thanks a lot.

Pascal

Please post a screen shot of the GKC that you have added (showing its properties in full).

In Air and Armor. I have a button the upon the end of a formations activation it removes all it’s markers. I broke it down so that each marker type is removed separately. which is why there are multiple delete commands.

Kevin

Here is the target unit for 'Action_11 GCK.
If you have any questions send me a message.

  1. Create a Prototype - named - say “Temporary Marker Prototype
    1. In that prototype add a Marker trait - say “Temporary Marker” with the value true
    2. Also add a Delete trait with a Key command - say deleteTemporaryMarker, and an empty Menu command.
  2. All the marker pieces that you need to be deleted you give the them the Prototype trait with Prototype name set to “Temporary Marker Prototype
  3. Add a Global Key Command to your map or module
    1. Set Button text, Tooltip text, Button icon, Global Key Command, etc. to what ever you want.
    2. Set the Named command of Hotkey to deleteTemporaryMarker.
    3. Set Additional matching expression to {TemporaryMarker==true} (strictly speaking, this is not needed if the hotkey is unique to your marker type, but it probably doesn’t hurt either).
    4. Alternatively, use the Pre-select (Fast Match), and select by property, Property name: Temporary Marker, Comparison: ==, and Property value: true.

When you press the button, all pieces that have the Marker trait TemporaryMarker set to true (i.e., those that have the Temporary Marker prototype) will receive the command deleteTemporaryMarker.

You can of course add more prototypes - say Battle Marker prototype, Fired Marker prototype, Rest marker prototype, and individual pieces can have multiple prototypes. Each prototype can define its own Marker trait and possibly their own Delete trait, though they could share that.

The main point is to use a Prototype - which is shared amongst specific pieces - to encode the behaviour. In that way, the code is in one place and can easily be updated or upgraded.

Yours,
Christian

2 Likes

Thanks a lot guys for your help.
But I must say that I see my limits here.
I haven’t been able to make it work with both of your methods…
I’msending a pm to Kevin.

Spot on Christian.