Problem accesing Deck_numPieces

Hi,

As you’ll discover in no time, I am quite new to vassal more “advanced” features. I have no java skills.

I have built a module I am trying to improve by automating its card play mechanics. Of course, I am finding all kinds of problems I am enjoying dealing with, but there is something that is really bugging me big time:

Is <Deckname_numPieces> supposed to be accesible from everywhere in the module or just from the player hand where the deck lives?. From what I have read, it seems to me it should be, but need to be sure to keep going. I don’t know what relevant info you could need to answer my question, if any. Please let me know and I will post it as soon as I can.

In case the answer is no, I found a workaround that involves the use of a global variable whose value I can relate to Deckname_numPieces but it means a lot of work and seems to me unnecessarily convoluted.

Thanks for your help!

The answer is no, <Deckname_numPieces> is not a global property. It is a Map
level property. The workaround is as you have found - to use a global
variable and relay

-----Original Message-----
From: messages [mailto:messages-bounces@vassalengine.org] On Behalf Of TF
Sent: Friday, October 25, 2013 7:01 AM
To: messages@vassalengine.org
Subject: [messages] [Module Design] Problem accesing Deck_numPieces

Hi,

As you’ll discover in no time, I am quite new to vassal more “advanced”
features. I have no java skills.

I have built a module I am trying to improve by automating its card play
mechanics. Of course, I am finding all kinds of problems I am enjoying
dealing with, but there is something that is really bugging me big time:

Is <Deckname_numPieces> supposed to be accesible from everywhere in the
module or just from the player hand where the deck lives?. From what I have
read, it seems to me it should be, but need to be sure to keep going. I
don’t know what relevant info you could need to answer my question, if any.
Please let me know and I will post it as soon as I can.

In case the answer is no, I found a workaround that involves the use of a
global variable whose value I can relate to Deckname_numPieces but it means
a lot of work and seems to me unnecessarily convoluted.

Thanks for your help!


Read this topic online here:
https://forum.vassalengine.org/t/problem-accesing-deck-numpieces/6368/1

Thank you for your prompt and useful reply Tim. You guys do a terrific job!

May I ask for more details about the mentioned workaround? I’m trying to do the same thing but to no avail :frowning:

Thanks in advance!

A map level property, or anything below a module level property, can be sent to a Global Property which then can be referenced from anywhere in the module.

In the above case, somewhere in the player hand window you would have a Set Global Property trait on a piece, which told it to set the Global Property you’ve previously made (I.E. Player1DeckPieces or something) to the map level property you want, which would be “DeckNameHere_numPieces”, or which ever property you want to save.

Then you could reference the Global Property for the information of the map level property, hope that helps.

Thank you so much for the quick and well explained answer. Finally I understand the visibility of properties in Vassal!

I am attempting to do the same thing. Can you please link a module that employs this functionality so that I can reference it? I may be reading your explanation wrong because the way you explained it is how I think I’ve coded my module. It’s not working, so I must be doing something wrong.