Create account / Log in

Calculated Property as Layer (for Game Piece Layers)

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Calculated Property as Layer (for Game Piece Layers)

Postby dsdhornet » April 26th, 2014, 6:34 am

I am attempting to create a module in which pieces have variable layer settings.

In one case, airships have different elevations which can change during play (elevation can be 1 through 3). I would like the uppermost airships to be drawn on top of the lower ships.

In another case, I am wanting to use calculated properties to determine if a piece (airship component) belongs to the selected (active) ship. I already have the selection buttons working. If the piece belongs, the property is "Active", otherwise it is "None". I would then use this property (along with a Game Piece Layer Control) to hide from view any pieces that were "None". This is basically used so that I can have a single Map window that shows details for the currently selected ship. Since the number (and name, type, make-up, etc) of ships are not already known, I can't just predetermine all the Layers.

However, in practice, I find that changing the Calculated Property does not change the apparent Game Piece Layer of the piece. I.e. All pieces are added to the component screen while no ship is selected (all have cActive="None"). After selecting a ship (and having the Calculated Property 'cActive' change value to "Active", as verified using a visible label), hiding "None" pieces hides everything.

Interestingly, I find that if I change some other property in the piece, any status changes will actually carry over to Game Piece Layers, and the piece may be hidden properly. However, if the piece is later revealed and deleted, it will leave behind an undeletable shadow (that seems to always be "None"). I can also not get the changed piece back behave as if it's "None" (the change is one-way).

Anyone have any idea what's going on? Or how to get variable Game Piece Level assignments to work? I have not tested elevation stuff out yet, but expect the outcome would be the same.


Steps to repeat issue with attached file:

1. Start new game.
2. Show 'Pieces' and 'Ship Selection' windows.
3. Copy 'Stat-Title' piece from Pieces->Other to somewhere on HML Raven (in Ship Selection window). Copy any other pieces you want from Pieces->Slots or Pieces->Other to HML Raven.
4. On HML Raven, right-click 'Load Ship' button and select 'Load Ship'. Ship will appear on map, and all components will be copied to 'Active Ship' window (assigned to HML Raven).
5. Add or delete components from HML Raven window as desired, but leave the 'Stat-Title' piece.
6. Right-click 'Stat-Title' piece and select 'Change Ship Name'. Rename ship whatever you want.
7. Repeat step 4. New ship will be placed on map (probably over HMLRaven...but just drag is elsewhere).
8. Note that all components have "None" shown in green.
9. Click on center of either ship. Log should show that ship was selected, and green label on all associated equipment should change to say "Active".
10. Click 'Hide Inactive' button on 'ActiveShip' map a few times. Notice how both "Active" and "None" pieces disappear together.
11. When one ship is selected, choose an "Active" component, and change something..."Class" on Stat-Title, 'Destroy' (not delete) a component, etc.
12. Click 'Hide Inactive' and notice that some "Active" pieces now remain instead of disappearing.
13. Try deleting an "Active" component. Notice that a shadow appears (always acting as if "None", even if the label says "Active"). Notice that this shadow piece cannot be deleted, and acts like it is on the Pieces area.
Attachments
Leviathan (2).vmod
(216.91 KiB) Downloaded 112 times
dsdhornet
 
Posts: 12
Joined: April 26th, 2014, 5:52 am

Re: Calculated Property as Layer (for Game Piece Layers)

Postby Cattlesquat » March 9th, 2020, 3:06 am

I can confirm that although the documentation implies that e.g. a Calculated Property would work to control a layer, in practice it is janky the way you describe -- will change only "sometimes" and will not want to change back.

I tried a Calculated Property for this purpose and had a similar experience to the above. Verified with a Text Label that my Layer trait was producing the correct calculated results matching my layer names, but whatever internal Vassal routines are checking the trait aren't getting the updates.
User avatar
Cattlesquat
 
Posts: 327
Joined: December 2nd, 2019, 4:57 pm
Location: Baltimore, Maryland, USA


Return to Module Design

Who is online

Users browsing this forum: No registered users and 2 guests