Hi All,
I would like to have a piece define specific values in the property sheet it is using from a prototype, without the user having to do it. It’s like a “default value” specified in a sheet coming from a prototype. Is this possible?
For example, let’s say I have defined a prototype “Car” that has an MPG rating defined in its Property Sheet. The value isn’t initialized. Then when I take a “Honda Accord” into the game, I’d like the “default” value for the MPG in the property sheet to be fixed inside the Honda Accord piece.
If this is not possible, what mechanism exists where I can define a set of general attributes in a prototype, but provide specific values for them in a piece that is based on it?
I found a partial answer, which seems to imply it’s not possible: vassalengine.org/forums/view … 0652136871
Actually, that topic is indicating that it is possible to do what you want. When you are editing your Prototype that contains the Property Sheet, there is a place at the top of the dialog box where the counter image is displayed. If you right-click there, een if your prototype does not include an image, then the popup menu will appear and you can select to edit the property sheet and enter your default values. These values will be the defaults for any piece that uses this prototype.
B.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com)
Hi Brent - thanks for the feedback.
In my Car/HondaAccord example, that’s not what I was trying to express. All cars have MPG ratings (general layout of the sheet for MPG, etc., goes in a prototype), but specific models have specific values (that info should go in the Piece using prototype).
It’s not an advantage to define starting values in a prototype, which is why I said the posting above seemed to imply I can’t do what I want.
How about multiple prototypes? One general prototype for car and a second prototype for each make of car containing just the property sheet with the default values set. Each piece then gets two prototype values assigned to it; car and the specific model.
Creating other prototypes just pushes the problem down a level. It makes sense to have the MPG rating defined in the top-level (car) prototype, since all cars have an MPG. But I appreciate the suggestion
Vassal modules would be more intuitive and flexible if there were a way to initialize prototype values in the pieces that use the prototype.
In OO (Java) terms, it’s like saying a class’ constructor can initialize the data members defined by its super-class(es). As I understand it, only the class (prototype) that defines the members can initialize them.
I think I follow what you are trying to accomplish but each property sheet
is a separate item with no constructors for the sheet itself. It’s just a
collection of values that can be set at run time. I don’t think the values
have any relation to anything other than the collection. I guess if they
could take their initial values from static or other dynamic/global
properties, then they might be more useful for what you are describing.
As it stands now, you would have to have a property sheet for every single
game piece type that you need different default values for.
Post generated using Mail2Forum (mail2forum.com)