Does not stack and Invisible traits

I would like to have pieces stacking normally but unmovable. Is that feasible in any way? The DOES NOT STACK trait is the only method I know to have unmovable pieces, but unfortunately they won’t stack. One has no visual hints that there is more than one piece in the stack and the only way to move through them is via the up and down keys.

On a separate topic, I am experimenting with the INVISIBLE trait, because in my module it’s handy to send over to a common “battleground” screen entire decks of resource cards for players to use/discard, but I would like the other players not to see them at all (so not to have a clue the other player are planning to use/discard them).

Invisible seems to work pretty nicely to do this. However, the invisibility to others also means high transparency to owner. Can one reduce/remove the transparency for the owner in any way? Maybe just changing a number in the corresponding Java class… if I could have any hint how to do it.

Barbanera,
As for the stacking, unmovable pieces - as far as I know Do Not Stack is the only way to get unmovable pieces. So I suppose the question would be, is it easier to write a stack manager piece (which fires off Send To Location global key commands to offset the ‘stacked’ pieces) or to write a custom trait? The latter is faster, and (I believe) would only involve changing a line in Immobilized.java from this:
if (Properties.NO_STACK.equals(key)) {
return Boolean.TRUE;
}
to this:
if (Properties.NO_STACK.equals(key)) {
return Boolean.FALSE;
}
Note that you would also need to create a custom Command Encoder to use any custom traits you build.
The transparency level is hard-coded as 30% in Hideable.java. Again, you /could/ copy it as a custom class and set your own transparency. Normally I would recommend using the Mask trait instead of Invisible, which, with cards, I imagine would still be tricky - but if you’d be making a custom Does Not Stack anyway, may as well make your own Invisibility trait too. Take a look at the programming tutorial, and see if you think it’s worth it. =)

Ok, I was being too optimistic, in that I can see where that line in Immobilized.java is but from there to actually change it, recompile and get a Windows build… Or should I just “import” the edited Immobilized.java, no compiling etc? Would other people still be able to use this module afterwards or would they need a custom version of Vassal? No clue… :open_mouth:

Anyway, I do have masked cards that I want to move, but masking is not good enough… I was hoping the other players could have no clues at all that those cards (masked or not) have been moved to the “battleground” map. With “invisible” it works, but it being so strong by default, they become hard to read for the owner.

But on the subject of the INVISIBLE trait please see the other message I am posting right now :slight_smile:

Ive already rewritten an alternate DNS to do this. It could be included in
3.2 as a new trait

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of irishwulf
Sent: Sunday, February 05, 2012 2:57 PM
To: messages@vassalengine.org
Subject: [messages] Edit: [Module Design] Re: Does not stack and Invisible
traits

[This message has been edited.]

Barbanera,
As for the stacking, unmovable pieces - as far as I know Do Not Stack is
the only way to get unmovable pieces. So I suppose the question would be,
is it easier to write a stack manager piece (which fires off Send To
Location global key commands to offset the ‘stacked’ pieces) or to write a
custom trait? The latter is faster, and (I believe) would only involve
changing a line in Immobilized.java from this:
if (Properties.NO_STACK.equals(key)) {
return Boolean.TRUE;
}
to this:
if (Properties.NO_STACK.equals(key)) {
return Boolean.FALSE;
}
Note that you would also need to create a custom Command Encoder to use
any custom traits you build.
The transparency level is hard-coded as 30% in Hideable.java. Again, you
/could/ copy it as a custom class and set your own transparency.
Normally I would recommend using the Mask trait instead of Invisible, which,
with cards, I imagine would still be tricky - but if you’d be making a
custom Does Not Stack anyway, may as well make your own Invisibility trait
too. Take a look at the programming tutorial, and see if you think it’s
worth it. =)


Read this topic online here:
https://forum.vassalengine.org/t/does-not-stack-and-invisible-traits/4660/2

Thank you Tim!!

Yes, thank you, great!

Barbanera,
What I meant is, you can use Mask to make a piece invisible - just don’t specify a mask image, or if that doesn’t work (I think it works), use a 1X1 transparent image (I know this works). To keep the original image for the masking player, use the ‘Use Image’ option for ‘View when masked’, and use the Basic Piece image again.
The tricky thing is, you probably already need a mask image for the backs of your cards (if they’re ever face-down). If the only time they’re face-down, they’re face-down for everyone, you can maybe use a layer instead, and manually switch the layer when sending the cards to/from decks. Or, if you still need a /real/ Mask trait, you might need to kludge something together with Place Marker or Replace With Other.

-Seth

J. Uckelman, thank you very much for upgrading the invisible trait (see build 8082)!

Tim, could you please make sure this is included in 3.2.0 when finally released? So far (just downloaded build 8096) it does not seem to be included.

I am really looking forward to this “does not move” (or whatever name you like) trait and dragging my feet releasing my module waiting for it. Thanks.

[attachment=0]DNSAlt.zip[/attachment]

I don’t know about 3.2 plans but I can give it to you as a custom class for now (attached).

Name of the trait is “Piece Control”

To install: grab the files out of the zip (keep the directory/folder structure) - you should have a folder called “DNSAlt” with a bunch of files in it. Add this folder in to your module (just rename vmod to zip and add)

Next you have to edit the buildfile of the module. Using wordpad/notepad or some such, at the very top there is a line that says…

<VASSAL.build.module.BasicCommandEncoder/>

Above this insert:

<DNSAlt.DNSAltCommandEncoder/>

save the file. Done

Now go into your module (edit mode) and edit a game piece - select import at the bottom and type (exactly U/L case):

DNSAlt.DNSAltControls

press enter

At the bottom of the trait list the new trait is now available - have fun.

If you need help installing, or want me to add it into your module for you let me know

Thank you!

I have downloaded it and will try to install it asap. Will let you know how it goes. Thanks again.

Updated to fix the problem you found. Had my inner and type backwards in the command encoder, for some reason Immobilized seems to be the only trait that is opposite order - go figure :slight_smile: Just replace the folder in your mod with this one.

[attachment=0]DNSAlt.zip[/attachment]

Whatever happened to Tim M?

Unfortunately, the DNSAlt custom class he wrote does not work as advertised. When movable is set to false:

  1. pieces will still be movable if all alone and therefore not stacking
  2. pieces will still be movable if stacking and selecting the whole stack at once
  3. sometimes when clicking on a stack of pieces (all selected) makes them jump somewhere else on the map
  4. move fixed distance trait seems buggy/broken for unmovable pieces

We exchanged msgs about it back in march but no signs of life from him since then.

Any news about Tim M? Or maybe some very kind developer willing to patch his DNSalt class?

Thus spake barbanera:

Whatever happened to Tim M?

Tim is around, but is a bit busy because he just bought a house.


J.