It seems to me that in VASSAL 3.4.12 the Set Global Property trait doesn’t interpret expressions as explained in the documentation. It could be that I am not properly understanding the documentation.
Every time I have tried using an expression for the Global Property Name rather than the exact name letter for letter, I get an error message that the Global Property was not found. Also, whenever I have tried to use an expression such as, {mapName}, {previousMap}, or $previousMap$ rather than either the actual typed out name of a valid map with the Global Property or the Current Zone/Current Map/Module preset choice for the place to Locate Property starting in the: field, I get the same error message that the Global Property was not found.
I’m working on a module for an economic game for up to 8 players and 20 companies, each with their own map to hold their assets. The players buy and sell stock in these companies as well as the player having the most shares in the company runs it. I’m trying to adapt the trick of keeping count of the sum of a value assigned to various pieces in a zone: http://www.vassalengine.org/wiki/How_to_calculate_total_of_numeric_Property_of_all_pieces_in_particular_location/state. (referred to later as “the trick”) to doing a similar kind of thing with the stock certificates. Since my module will have lots of maps, I am trying to use the $previousMap$ and $mapName$ properties rather than explicitly name the map in the Set Global Property trait. I am also using a map level Global Property like BSCShares for a company that might be named Big Shoe Company.
I set up a prototype for one of the companies (I would do the others after having success with one) with a Marker named Company for the company abbreviation used as the first few characters of the Global Property to keep track of how many shares of that company was on that map. I also set up a prototype for the stock certificates that had a Trigger Action trait similar to the trick and Set Global Property traits also similar to the trick, and a marker indicating how many shares were represented by the certificate. I then set up another prototype for a particular company’s stock certificates which had prototype traits of the previously mentioned two prototypes with the one having the Company marker last.
As stated above, when the Set Global Property had an expression, {Company}Shares, for the Global Property to set, it didn’t work. I don’t recall whether or not I got an error message. After changing the expression to the actual name of the Global Property and moving the Trigger Action and Set Global Property traits to the company prototype and switching the order of the prototypes in the company’s stock certificates prototype, I got partial success for incrementing the count of shares in the map to which I moved the certificate as I had used the Current Zone/Current Map/Module preset choice for the place to Locate Property starting in the: field rather than Named Map with the expression {mapName}, but I still got an error message that the Global Property for the share count was not found in the {previousMap} nor the $previousMap$ when I tried that. When I changed the expression for the previous map to the actual name of the map from which I was dragging the certificate, I didn’t get any error message. Unfortunately I had not set up a label text to report the remaining number of shares in that map.
Also, in the Trigger Action when I used either {previousMap!=mapName} or {previousMap}!={mapName} in the Trigger when properties match: field, the action wouldn’t trigger, or I got an error message, expression evaluation error, and the action didn’t trigger. However, when I used $previousMap$!=$mapName$ the action triggered.
I still got undesired results from moving a stock certificate from one place to another on the same map. Apparently, $previousMap$ isn’t changed until the piece ends its movement somewhere other than the map it was on before moving. I was going to use a Dynamic Property, I named formerMap, defined in the prototype with the Trigger Action and Set Global Property traits to act like the counted Dynamic Property described in the trick. The final action to be triggered in the Trigger Action trait was to set this formerMap to the current map so subsequent moves on the same map would not trigger an adjustment in share count. However, I reasoned that the errors I was getting with not finding the Global Properties that I was trying to set prevented the remaining actions from being triggered.