Combining Expressions and a Mask Problem - 3.2 build

I’ll start with the Mask problem.

I posted this on the 3.2 Build - Other Bugs Found thread but it apparently got missed so I’m re-posting it here.

Attached is a sample mod (just change .zip to .vmod). This mod was created in svn7908 although I still have this problem in svn7932.

The button will retrieve a Lock from a Deck. When the Lock hits the map, a map trigger sets a dynamic property called LockCode that will generate a number from 1 to 6 and there’s a layer trait that displays this code. A player attempting to open a lock would need a key with the same code.

Players are not supposed to know what the code is until they attempt to open it. But, regardless of where I place the Mask trait in the trait order, it still displays the LockCode. I don’t want it displayed until the player attempts to open the lock.

Is this a bug or am I doing something wrong?

The second issue involves combining variables. With the new math engine built into the 3.2 engine, I’m assuming this is possible.

A player belongs to a specific clan and they select a race for their character. I want to set a DP on that race called RaceClan to establish that Race as being a member of the player’s clan. I’m trying to set the value directly to:

$$PlayerSide$Clan$

If the Player Side is the Sun clan, this should equate to $SunClan$

I’ve tried various syntax forms to make this work but so far it hasn’t. If I type it in directly and click the expression builder button, it changes this to:

{“ActivePlayerSide”+ClanID}

…which doesn’t do a thing.

Does someone know the proper syntax to make this work or is this still a feature that is not available.

Quick follow up.

I’ve been trying to figure out how to “Set a value directly” in a SGP with the value

$PowerTemp$ * 5

I’ve tried various forms of syntax but I can’t get it to work.

I ended up just looping “Increment Value by” $PowerTemp$ 5 times via a Trigger Action which works ok. But I sure would like to know how to get some mathematical expressions to work.

The correct expression inside the Expression editor should look like

PowerTemp * 5

The correct expresson outside the Expression editor (i.e. sitting in the ‘set value’ box before you hit the little calculator icon) should look like

{ PowerTemp * 5 }

The {} indicate that this is a Java (Beanshell) expression to be evaluated by the Expression evaluator. You will notice that the Expression Builder automatically adds the {} for you, and also automatically converts an existing non-Java expression to a Java version.

Without the {}, it is passed to whatever code evaluated it before, which knows what to do with the $PowerTemp$, but has no idea what to with the * 5.

The reason for this is to guarantee backward compatibility. Expressions not enclosed in {} are just passed to the original pre 3.2 evaluation code, they are not automatically converted to Java expressions. This only happens by the express action of the module designer.

B.

*********** REPLY SEPARATOR ***********

On 30/10/2011 at 9:13 PM DrNostromo wrote:

Quick follow up.

I’ve been trying to figure out how to “Set a value directly” in a SGP
with the value

$PowerTemp$ * 5

I’ve tried various forms of syntax but I can’t get it to work.

I ended up just looping “Increment Value by” $PowerTemp$ 5 times via a
Trigger Action which works ok. But I sure would like to know how to get
some mathematical expressions to work.


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

That worked, by golly. I thought I’d tried that but I must have made a typo or something.

Knowing the {} is needed for a BeanShell expression is what I really needed to know. Thanx.

There is an enhancement that’s needed in the expression builder. The selection list of Global Properties (and perhaps others) needs a scroll bar. I have a lot of Global Properties and only the top of the list will display in the expression builder with no way to scroll down.

Thanks for that one. Sadly, Java popup menus don’t support scrolling. Will have to have a think about that. Open to suggestions.

Either write a custom scrolling component, or automatically break the number of entries into smaller sub-menus.