[messages] [Module Design] How to - implement a button on a board ?

kerkael kerkael at gmail.com
Thu Mar 15 20:26:53 CET 2018


Solution :
Create a GP in the Map
->In fact, this is the GP you want to act on, so you probably alredy
have it
Optionaly, create a Modifier GP
That's another GP, called Modifier, for which you can define a positive
value, and that would be added to or taken from the other GP when you
click on the button created just after ...

Create an At-Start Stack
-> create a single piece in that stack
-->the basic piece being the image of the button you want to use
-->Action button defines the size of the button interactivity, and the
Invoke Key Command to call the GP you want to act on
--> does not stack : select piece normally, never move (so your button
stays in position)
-->set global property : using the GP you created first, locate in
current map, with a Key Commands that will do the math. 
For example, my button acts by adding +1 to the GP. It's called by the
Key Command mentioned in the Action Button, with a type of increment
numeric value, increment by 1 ... or Set value directly, with a New
value of the GP name + a GP modifier

This way, you can have a nice button, acting as you wish on your GP.

Optionaly, you can place a layer in the single piece definition, showing
a different view of the button when it's pressed. However, this means
you want the button to remain pressed and hold, ans it will probably
execute the calculation in the set global property definition each time
you click on it, even if it's to release the button.

Maybe some additional test can be done so it can be pushed and released
without acting twice.

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=54996#p54996


More information about the messages mailing list