I’m beginning to learn how to develop for Vassal. I want to do a very simple thing using code: have a button that as soon as I press it will show a buffered image 300x300 with the number 1, which will stay on the map screen for 2 seconds, change into another image showing the number 2 and vanish, after 2 extra seconds, like counting.
I have gone through classes such as Map and Board to research their methods, but I’m really not sure how to approach the problem. I appreciate it if someone can point me to some documentation explaining the use of those classes other than the javadoc for vassal, or, at least, point me the classes which I must research for tackling this particular problem.
If that is the extent of your requirement, then the simplest way to handle this is probably to develop a Sleep(ms) Beanshell function.
You can do everything else with standard Vassal. E.g. have an invisible counter on the map that has the 1 and the 2 as layers, Then you can just drive it via a GKC initiated trigger. You can force the call to the
Sleep(2000); function by creating a Dynamic Property and have Key Commands that set its value to
Forget that suggestion. It does not work at all. Swing repaints when it want to, not when you want to
Have a look at how the CounterDetailViewer works. It does a similar sort of thing (though much more complex), but basically, when something sets it off, it draws and maintains an image over the screen for a while.
The other option would be to build a custom trait to do it.
I’ll have a look at it. Thanks.