Each piece on a mapboard should have an identication code. There is a property that return this code?
Provided you don’t have duplicate pieces you can use the properties
BasicName or PieceName but if not you have to create it using a marker trait
for example and assign it yourself when building the module.
[mailto:email@example.com] On Behalf Of panther 2010
Sent: Thursday, August 04, 2011 1:18 AM
Subject: [messages] [Module Design] Single pieces identification
Each piece on a mapboard should have an identication code. There is a
property that return this code?
Read this topic online here:
Thank you again for your kind reply to my question.
Unfortunately, I can have duplicate pieces in a stack, that have the same Id in the module and I’m not able to distinguish the pieces of the same kind the one from the other.
I have other two questions :
Is it possible to set the value of a given property with the value of another property?
For istance, if the property prop1 has the value of 1, it is possible to set the value of the property prop2 with that value?
I tried both prop2 = prop1 and prop2 = $prop1$, but in both cases the returned value is “prop1”.
There is a way to select one or more units in a stack using keyboard command instead of mouse clicks?
If not, which property is returned when a unit has been selected with a mouse click?
Ok, I’m going to regret explaining this…
There is a way to give pieces a unique ID even if they are duplicates. The trick is assigning the ID. Here’s how (btw wherever I assign key commands you may change them to what you find suitable - just keep everything linked).
First, all your pieces must start off in the piece palette
Add a Module level Global Property, call it “UniqueCount” make it numeric with initial value of 0, min value = 0 max value = 9999 (I doubt you’ll need more than 10,000 numbers!)
In the (your) main map properties, last field “key command to apply…” add CTRL ALT SHIFT X
Create a new prototype “UniqueRoutine” which you must add to all your pieces. We are going to add the following traits to it(order listed bottom to top, all fields should be empty except what I put below and of course remove “” and case sensitive)
Trigger Action: Description “Begin Unique Routine”, Watch for CTRL ALT SHIFT X, Perform CTRL X
Dynamic Property: Name “UniqueAssigned”, Value “false”, Key Command CTRL T, Type: Set value Directly, New Value: “true”
Trigger Action: Description “Check if assigned”, Trigger property match: “UniqueAssigned = false”, KeyStroke: CTRL X, Perform (in order) CTRL T, SHIFT X, ALT X
Set Global Property: Description “Increase Unique Count”, Global Property Name “UniqueCount”, is numeric checked on, min val = 0, max val = 9999, Key Command SHIFT X, Type: Increment numeric value, New Value: “1”
Dynamic Property: Name “UniqueID”, Value “0”, is numeric checked on, min val = 0, max val = 9999, Key Command ALT X, Type: Set Value Directly, New Value: “$UniqueCount$”
Thats it, now everytime you drag a piece out of the palette onto the map it will get a unique id - how it works should be fairly self explanatory through the name/description fields. If you need further explanation as to what it is doing let me know