[messages] [Module Design] Variables / Property Names in place of Actual Values

Rommel14 pfell.688 at gmail.com
Sun Jul 3 22:00:35 MST 2011


Greetings once again!

After receiving some very helpful posts in the last few days, I need to
ask a general question for which I have not found an answer anywhere
yet.

In several examples provided to me recently, people have been using
variable names in place of actual values when setting up Dynamic
Properties or Global Properties.  This allows the code to plug in a
value that may be changed by another piece / marker / etc.

For example:

* The Global Property $TerrainValue$ is an integer (let's say "6", so
TerrainValue=6).
* Piece A has a Dynamic Property, $DefenseFactor$, which is dependent
upon the map terrain.
* This Dynamic Property is numeric and watches for a CTRL-T command, at
which point it sets $DefenseFactor$ to a specific value.
* However, the specific value provided to the Dynamic Property is not an
integer but rather a variable, $TerrainValue$. 
* Therefore, when CTRL-T is received, the defense factor of Piece A
would be set to 6, the terrain value of the map.

Question:

Are there any cases or situations where a $variable$ cannot be
substituted for a constant value?  I have tried to use a $variable$ in a
few traits and it worked OK, but I wasn't sure if there were any
established exceptions.  Can a $variable$ be used for any constant?

Thanks yet again for any help!
Rommel14

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=23638#p23638


More information about the messages mailing list