Page 1 of 1

Place marker before send to location

PostPosted: October 23rd, 2015, 3:59 am
by GJK
Probably asked before but I'm not finding quite what I'm looking for in a search.

I have a prototype for my playing pieces. This prototype will place a marker (blood) if the piece is marked as being knocked down on the board. This works (and I'm using map layers to put the marker beneath the piece - works great). The problem: the piece can also be sent off to a dead pile which is another map window. He goes there with a 'send to location' trait in the prototype. I would like for it to also leave a blood marker BEFORE it leaves the main map. No matter what I've tried, it first moves the piece to the other map and then places the blood marker. I've experimented with trait order but no luck.

A quick breakdown:
ctrl+S "stuns" the piece, which knocks it down on the main map and then ctrl-alt-x places the (blood) marker. This works.
shift+k "kills" the piece and the send to location is executed, sending the piece to the kill pile.
My trigger action is watching for both of those keystrokes and if spotted, is to execute the ctrl-alt-x.

What is a the best approach to change this behavior?

Thanks!

Re: Place marker before send to location

PostPosted: October 24th, 2015, 3:09 am
by GJK
I'm convinced that there's no way to place a marker (piece/graphic) in one spot before the master piece is sent off to another location. Perhaps a proper request would be to add a "keyboard command to execute before the move" component to the Send To Location trait.

Re: Place marker before send to location

PostPosted: October 24th, 2015, 5:53 am
by Foobarius
If I understand your problem correctly, I believe what you need is for shift+k to be handled by a single Trigger Action trait, rather than having both a Trigger Action and a Send to Location trait which handle the same keystroke. The new Trigger Action will execute two keystrokes in order, the first to place the blood marker and the second to move the piece to the other map.

That is, you need a new keystroke (not visible to the user, so you can use a 'named keystroke') - let's call it moveKilledPiece. Your Send to Location trait should handle moveKilledPiece rather than shift+k, and your existing Trigger Action also should no longer handle shift+k. Then you add a new Trigger Action which does handle shift+k. This Trigger Action just executes ctrl-alt-x and then moveKilledPiece.

Re: Place marker before send to location

PostPosted: October 26th, 2015, 3:47 pm
by JoelCFC25
As a general recommendation, I would strongly discourage the use of "Shift +" keystrokes. I've seen too many occasions where they get inadvertently triggered by typing messages into the chat while a piece is selected.

Using named keystrokes (especially for things that happen behind the scenes that aren't exposed to the end user) will make your life dramatically easier as the number of key commands goes up--you won't have to constantly be reminding yourself whether it's Ctrl+Alt+something or Ctrl+Shift+something that a piece needs to be handling.

And Foobarius is correct with his diagnosis and recommendation--don't use a single Trigger Action to handle multiple keystrokes that do different tasks.

Re: Place marker before send to location

PostPosted: October 27th, 2015, 4:12 am
by Rindis
JoelCFC25 wrote:As a general recommendation, I would strongly discourage the use of "Shift +" keystrokes. I've seen too many occasions where they get inadvertently triggered by typing messages into the chat while a piece is selected.

Yeah, I took over maintenance of the Pursuit of Glory module simply because I was eliminating units and the like while chatting during play with a friend.

Re: Place marker before send to location

PostPosted: October 28th, 2015, 11:23 pm
by GJK
Some great points - I've seen that with the shift key in this module. So, named keystrokes...is that the name of the trait as I'm not seeing one by that name? Or is it a sub-trait of another trait? My VASSAL is rusty so please excuse the amateur questions.

Re: Place marker before send to location

PostPosted: October 29th, 2015, 12:06 am
by JoelCFC25
You just start typing some alphanumeric string in the place where you would normally enter the key command. So for instance the Clone piece trait usually defaults to:

Menu text: Clone
Key command: CTRL+C

One example of a named keystroke equivalent would be:

Menu text: Clone
Key command: CopyPiece

Anything using named keystrokes cannot ever be triggered by the physical keyboard, and it gives you a great deal of flexibility in giving commands that govern the inner workings of a module descriptive names that will help you keep everything straight.

Re: Place marker before send to location

PostPosted: October 29th, 2015, 3:13 am
by GJK
Excellent, I never knew about that feature. Thanks Joel.

Re: Place marker before send to location

PostPosted: October 31st, 2015, 2:37 am
by GJK
I just wanted to thank each of you, especially Foobarius. Once I wrapped my head around what you said in your suggestion, it implemented perfectly and works great. I even used the Named Keystroke to have it play a sound when a piece is moved off to the dead pile. This is for the VASSAL Blood Bowl module by the way for those interested (www.garykrockover.com/BB).

Thanks again!