Can a Marker name be a Basic Name?

For a module I am working on, I have a card that has a corresponding location on the map.

I created a piece to sit on the location and it has this property:

Marker:
Property name: LocationName
Property value: Agrigentum

A few steps higher, I created a Global Key Command and on the Matching Properties Line, I wrote:
((BasicName==$LocationName$)&&(side==“Rome”))

Nothing happens.

But if I change it to:
((BasicName==“Agrigentum”)&&(side==“Rome”))

It works just fine.

Do I have a syntax error or am I asking it to something that it cannot do? I would think you can, because I created another Marker with a numerical value (victory points for that location) and I was able to pass it on to global variables.

Thanks.

I’m not following what you’re attempting to do. Is the GKC trait on the same piece as the Marker trait? Are you intending for something to occur at the Agrigentum location when this card is played? Is something being sent there?

If you’re already using Zones, make sure the Location Format in the Zone’s properties is set to return $gridLocation$ rather than $name$ (which I believe is the default). What I usually do is draw my Zones to correspond to regions or countries, then create an Irregular Grid within each Zone and assign named Regions (with snapping turned off). That way when my Zone returns $gridLocation$, it uses the nearest named region whenever I want to report something–movement, elimination, capture, step loss, etc.

BasicName will always return or match against the name you enter for the Basic Piece trait (the very top one that can’t be deleted).

I put an invisible piece on the space (in this case, Agrigentum). That piece has a marker with LocationName = Agrigentum

When you settle that area, you right-click to settle it. It uses a combination of Dynamic Property and the Layer command to place a house on top of the invisible piece to show that you control it.

At the same time, I want it to locate the corresponding Agrigentum card and put it in your discard pile. I tried to use a Global Key command that said when you see the key command that places your house, then go locate the card and perform the discard key command on it.

To settle, I had CTRL-1
The command to discard is CTRL-D

My Global Key command looked like this:

Keyboard Command: CTRL-1
Global Key Command: CTRL-D
Matching Properties: BasicName==$LocationName$

That would allow me to copy the invisible marker to numerous locations and then change the Marker (LocationName) for each one, and I could set them up for Agrigentum, Syracuse, Rome, etc.

But it doesn’t work.

If I go into each location’s invisible marker and change the GKC Matching Property to read:
BasicName==“Rome”
BasicName==“Agrigentum”
BasicName==“Syracuse”

ect, etc – in other words the name of that location, then it works, and the Marker Property can be deleted.

That’s why I was wondering if I had a syntax error in my Matching Properties field or if Marker Properties can’t be used in that field.

Thanks.

LocationName is probably not a good property name to use in your Marker trait, since it’s a universal property of all pieces: vassalengine.org/wiki/Faq_mo … ounters.3F

Maybe that’s why your property match is not returning the expected value?

Marker properties can be used. The problem her is a special case you made of syntax with your marker.

You gave your marker trait a property name of “LocationName”. LocationName however is a specifically reserved property already built into vassal and makes your marker trait useless here as a result.

If you change your marker property name to something like “NameOfLocation” it will work just fine.

Note Joel beat me to it :slight_smile:

I changed it to “NameOfLocation1” it still did not work.

I went to the BasicName of the card (Agrigentum) and copied and pasted it back to the invisisble piece’s marker trait (NameOfLocation1), just to make sure there were no typos.

I add a text trait to the card to print $BasicName$ and to the invisible piece (print $NameOfLocation1$). I wanted to make sure that these names were indeed what I thought they should be and they are.

I then went into the Global Key Command and changed the Matching Properties to: BasicName==$NameOfLocation1$

Still doesn’t work.

Then I tried to do the similar idea on another card. I gave it the Marker property: NumberOfSwords = 2

I gave a Prototype a Global Key Command and in the Matching Properties, I wrote: $NumberOfSwords$==2

Nothing happens.

If I change the value to 0, it works.

BUT, I went to card, gave it a text property and told it to print NumberOfSwords on the card it self, and it shows up as 2.

Are you SURE you can use Marker properties in the “Matching Properties” of a GKC?

And the plot thickens…

I decided to create a Dynamic property that would set the value “Swords” equal to the number of the Marker Trait NumberOfSwords.

I attached a text property to make sure that the value of “Swords” was correct and it worked.

But when I then changed “Matching Properties” to: $Swords$ == 2, it didn’t work.
I removed the $, thinking that might be the problem. Nothing.

It amounts to this: I can’t get the Matching Properties of the GKC to understand ANY non-global variable. Is this a 3.2.11 bug?

While I can’t fully explain everything that isn’t working for you, this much I can say with 100% certainty is a yes, because I reference Marker trait values in property match expressions in at least 4 of my modules, off the top of my head. Possibly all of them!

One idea is to use the Expression Builder to check the syntax of your expressions (it’s the little button at the far right of where you enter your PME, looks like a little calculator).

If you are using the double equal sign (==), I don’t think you can simultaneously use the dollar signs around property names to get them to evaluate. When I plug in BasicName==$NameOfLocation1$ and check it in the builder, it gives a red X indicating that the syntax is not correct. If you are writing your expressions in BeanShell, this would need to be revised to: BasicName==NameOfLocation1. If doing expressions the old way, the equivalent is BasicName = $NameOfLocation1$

I always use the expression builder because I get burned when I do not :slight_smile:

I created a small module to demonstrate what is happening.

There is a brown marker and 2 cards. When you play the card, they should move the marker (one moves it twice as far as the other).

Both cards use the same “card” Prototype.

Each card has a marker property “swords”: one has a value and 1 has a value of 2.

In the prototype is a command to “play the card” (send to location)
followed up by a GKC linked to the same key command. The “Matching Property” says:
(BasicName==“brown marker”)&&($swords$==1)

It won’t move the brown marker. But if you change it to: (BasicName==“brown marker”)

It will work. It just won’t accept the marker variable.

OK, here’s your problem: you’re attempting to apply the GKC to the brown marker piece. BasicName==“brown marker” is fine…but swords==1 (you’d need to drop the $ signs) is not. The brown marker has no property called swords–the cards do. There is no single piece that can match both of these expressions, that’s why it fails.

You need some Triggers in your Card prototype that will check the swords value of the card and send the correct GKC to the brown marker accordingly. I’ll upload a demonstration later, gotta run right now.

I got it.

I set up a global variable called “TempSword”
When I played the card, I used “Set Global Property” for TempSwords and gave it the same value of the Marker Value “swords” (the marker property on the card)
Then in the GKC for that corresponds to the 2-sword card, I gave it the command BasicName==“brown marker” && TempSwords==2, and it worked.

Thanks so much. I thought on GKC, all of the criteria was based on the current item and the BasicName command allowed you to something external.

Question: what is the rules on using the $ with variables? Do you use them when your variable is a number or never use them in anything (Restricted Commands, Triggers, GKCs, and the “New Value” field for Set Global Property and Dynamic Property, for instance)?

Here you go. Two Triggers added to your Card prototype–each one has a property match to ensure the proper GKC is sent to the brown marker.

Thanks! I see how the Trigger Promp/Properties field works. I haven’t been able to ever get it to work because I was looking at it backwards.