Set dynamic $variable$ value to a Global Property

Well,

I have a numeric Global Property : G_Cost initial 0

Then a piece with :

Marker Cost = 5 (value of Cost = 5)
and Set Global Property : increment numeric value | increment by $Cost$

Problem because the variable $Cost$ is unknown …

All is working if i replace $Cost$ by a fixed numeric value 5,4,3 … in the Set Global property trait …

But i want to add the Cost of all pieces in a specific Zone … and each piece has a specific Cost Marker value !!!

All is working expect that !!!
How to get a Gobel Property updated by a dynamic $variable$ increment using a Set global Property ??? :cry:

Thank you for your help !!!

Hi,

If you have defined the marker trait Cost below the Set Global Property trait in the list of traits, then the Set Global Property trait will not see it. The general rule in Vassal counters is that a trait can only affect/see otehr traits that are defined above it. So try just moving your Marker Cost further up the list.

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Sorry … in such case i will have G_Cost instead of 0 … it’s not a so simple problem :wink:
And i know this logical way to manage trait on a piece !!

I think that set global property can’t exploit a dynamic variable increment !!! :cry:

Hi Grégory,

Ahhh, gotcha, what you are probably seeing is the bug I fixed in the 3.1.0 beta last week. If you have a ‘Set Global Property’ trait in a counter, then you cannot display the value of the Global Property in a text label in the same counter. This is a bug that is fixed in the soon to be release 3.1.0 beta. In the meantime, try displaying the current value of G_Cost using a different counter to the one you are trying to update it with.

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Sorry Gotcha for me :laughing:

The Global property is only incremented if the Set global property define a fixed value

If increment by 100 G_Cost is increased by 100

If increment by $Cost$ G_Cost is not increased …

Even if you do it with separate counters … :bulb:

Global property does increment by $DP variable$. It does not have to be a
fixed value
Works for me - you must have something set up wrong

Post generated using Mail2Forum (mail2forum.com)

Strange ???

It is possible to send you by MP the module link and to explain you what i’ve done and where for your help ???

Sure,

If you want to explain it in French so it is clearer that is fine also. My
wife is French and can translate for me

Post generated using Mail2Forum (mail2forum.com)

Not a problem to write in english … PM sent with all details …

Regards,

Grégory

Here i put the solution :

It works using a dynamic property marker with a numeric value.

Using a simple Marker trait is considered as a text value and then can’t be added …

Thank you again Tim :wink:

Hi Grégory,

No, that is not right. You are making a mistake in the way you are setting up your counter.

As I said in an earlier post, If you use a ‘Set Global Property’ trait, then the ‘Marker’ it is referencing MUST be defined above it in the trait list, not after it. If you do this, you will find that a simple Marker trait works exactly the same as a dynamic property. I have just tried this in a small module under Vassal 3.0.17.

If you are using prototypes, then you must make sure that the property traits are in the correct order after all of the prototypes have been expanded.

In your property list you must have this:

Basic Piece
Marker
Set Global property

Not this:

Basic Piece
Set Global Property
Marker

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

I already fixed this for Grigory.

The problem was not the order, but the use of marker trait. Because he was
performing basic math addition, a marker trait will not work. He needed to
use a numeric DP.

A marker trait with the value 100 on one counter and a marker trait with the
value of 50 on another will not set the GP to 150 when the variables are
passed

Post generated using Mail2Forum (mail2forum.com)

Hi Tim,

This is news to me, considering I just created a module that adds a fixed marker trait = 4 to a Global Variable = 6 and came up with a result of 10.

Sorry, not sure what you mean by ‘when the variables are passed’. Can you create me a noddy module that shows that behavior? I must be misunderstanding what you are doing. It sounds like a bug to me.

Regards,
Brent.


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Well I’ll be darned :slight_smile:

My little test mod shows using marker trait does also work in this capacity.
Not sure why it wasn’t working in Grigory’s module then except possible misnamed $property$ or buildfile corruption on save.

I dont remember the labeling (capitalization,spelling) being wrong though, maybe it was the trait order but I dont remember moving DP / Marker about - just swapping them out. Possible though :slight_smile:

Since Marker also can work this way, I might suggest for editor consistency it also have a simple checkbox for ‘numeric’ like DP and GP except without the min/max values part.

What would clicking on the checkbox do?

Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Nothing really - just for consistency was my thought so it is understood.

Only other reason I could think of is if when doing so on a DP or GP the
value is recognized/stored in the game code as an int as opposed to a
string, then in which case require likewise with marker

Post generated using Mail2Forum (mail2forum.com)

Perhaps it could enforce a numeric validation on the value entered?

All properties are typeless. They are stored as strings. If you try and add them, they are converted to integers, added, then the result stored as a string again.

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)