Triggered Button Image Change possible?

I am currently looking for a way to change the button image for a toolbar button vai a keycommand. I read all the docs and tried around, but it seems there in no implementation for this currently.

Just to make sure im right, and save me some work ;)

I will extend the sybolic dice component’s funtionallity in this case. Idea is to add keycommand triggerablity of sides on an optional basis.

I want to use this to give a visual indicator for the weather states in zones (wif mod). I need this to integrate in the menu bar, because i want to minimize on the windows open needed to play. Guess it is more a design goal i want to archieve for my module than a mising feature here.

Thus spake “Dab”:

Is the weather random? If so, you should look at how this is done in
the HeroQuest module. It uses images for displaying die faces on buttons,
and it should be possible to trigger a roll from a key command.

BTW, are you creating a WiF module from scratch? Because there already is
one.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Random yes, but not two dimensional. There is a table that determines a set of weather data for the 6 zones. I dont see a way to implement this tables logic into the module with the features Vassal currently provides. However, I will have a look at the “Hero Quest” module.

There are currently 6 Symbolic Dice buttons that have icons for the 5 possible weather states. You have to click until the right choice pops. This is unsatisfactory but ok for the moment.

I attached the weather table, so you can have a look at the case in particular. I dont think there is a way to implement within my requirement to have this stay visual in the menu bar. For the wif weather: you throw 1d10 and up the result in the column for the current turn for the current turn (J/F meaning Jan/Feb …). There are some conditional modifications to the dice as well.

For the module: yes and no. Its build from scratch but a graphical rip-off of the cyberboard module. The current WiF module does not meet the requirements of my gaming group. In efficency (jpgs gifs and a size of about 100mb) and funtionality (map+counters, nothing more).

It would seem to me, looking at the chart that the way to implement this is
to create 6 separate dice (1 for each turn month set that are hidden and not
on the toolbar but display in their own window).
Make a GP that records what the current month is throughout the game (so it
is always up to date).
Then have a Global GKC button that will roll the correct turn month set die
based on the GP Value and have right window pop up with result.

You could also do this in a different manner using a single regular hidden
dice 1d10?, GKC to fire the sequence/dice roll, a couple of GP’s - one to
store month, one to store roll result, one to store roll modifier and one to
store the final result and a bunch of at start stacks in each of the zones
denoting the weather. The at start stacks all have layers (1 per month set)
to show the weather and follow a property based on the final roll result /
game turn GP
Either way, all this is done with just one universal GKC button in your
toolbar if you set it up right

Post generated using Mail2Forum (mail2forum.com)

@TIM
Thanks for the idea! I can think of some good implementations for this…but i want it on the toolbar. I want to minimize on the windows that have to stay open during play.

Is there a property to set a symbolic dice to a specific face? This would do what i want perfectly for now.

Also this just is a visual indicator for the state, not a button to compute the turns weather. I do not intend to compute the table logic at all… if so i’d make up a custom class instead of work arounds.

@JOEL
Well the HeroQuest module just utilizes the symbolic die button. Nothing special helping me in my case :confused:

I noticed with the current WiF module there is a menu item for every individual chart for each nation. A much better solution would be to create a Chart window called, say, “Production” then create tabs containing each nations production chart. It would decrease the screen real estate taken up by menu items.

I actually started modding the WiF module to fix this but decided it needed to be done from scratch.

thats the way i do it

have a look at the module, its in the list as “World in Flames alternative”. alpha though

Looks good!

I first tried it with the VASSAL 3.1 Alpha, it doesn’t like your module at all. :slight_smile:

Thank you!
I meant the module to be in alpha state ;) works fine with 3.0.17, have to look into what makes it broken for the current trunk

Thus spake “Dab”:

If it doesn’t work with the most recent build found here

nomic.net/~uckelman/tmp/vassal/

then there’s a bug we need to fix. Please let us know in what way it
your module doesn’t work.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Dab”:

The simplest thing to do might be to make a custom “roller” which returns
1-5 in sequence, so that you don’t have to suffer through waiting for
the weather you want to appear.

I think what would be more suitable is a button with a pop-up menu from
which you could select the weather.

Do you have a plan for making the counters? I seem to recall that there
are a lot of repetetive designs—you might look into SVG for doing that.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thus spake “Dab”:

Thanks for reporting this bug.

Because you had a SpecialDiceButton where you specified an image
which doesn’t exist in your module, javax.swing.ImageIcon was
being handed a null on creation. ImageIcon is a class which doesn’t
expect that (though it’s not documented), and so throws a
NullPointerException.

The solution is to check whether the image loaded successfully
before creating the ImageIcon which goes on the button.

This is corrected as of svn3332.

Also, the odd problem with button icons sometimes not appearing until
you pass the mouse over the button is fixed here as well.

nomic.net/~uckelman/tmp/vassal


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Well the roller would not realy improve th situation. I was thinking of a left/right click menu to change the button icon, like you suggested. But im currently staggering to get the trunk running on my fresh netbeans install. Havent been into java for years… in fact i wanted to never touch java again ;) But thats the ways things go…

Glad i could help spot a bug.

SVG is a cool concept, especially for print or desktop publishing and the like. But when it comes to rastered optimization is largely underperformes…especially where you have a mass of pics in sizes smaller than 50 px. Although, i have a CD from ADG where the countersheets are in PDF. PDF is vector graphix as well. Tbh im glad i dont have to do the graphics on my own…thinking of 35 countersheet, 200counters each

Thus spake “Dab”:

Could you elaborate on that? I don’t follow. I find that SVG for counters
works quite well.

You could convert the PDFs to SVG, probably. Rasterizing them is going to
make them a lot less crisp when you zoom out (or in).


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Dab, here is my method - no extra windows, everything would be on main board and the logic is programmed. You dont need a custom class to build that table.
Ive programmed 3 areas and 2 turns in my demo, took about 15 mins to put together but it would be real easy to extend for entire table and also handle the variables

im quite busy atm, so i have not fond the time have a look at it yet. it apprechiated though! thanks a lot.

if this works out ill propably integrate it, since i switched my default design to detached windows. using a small map for admin stuff as the “main map” so the module doens’t break.