Complex Trigger Expressions

Hi all,

I would like to have not only boolean expressions available to trigger actions with.

Actually I can only use something like this to trigger an action:
GamePiece_Active = true && PropertyXYZ = 6

I can’t trigger on something like this:
GamePiece_Active = true && (PropertyXYZ * 3 + PropertyABC + 20) = 112

Maybe its not too complicated a task to extend the actual expression handler to cope with such expressions as well.

brgds
Stephan

Stephen,

Version 3.2 of Vassal will include a general purpose expression language called BeanShell that allows you use arbitrarily complex Java expressions. You will be able to use a BeanShell expression for any Property Match Expression and anywhere you can currently use $xxxx$ variables.

The exact expression you will use would be:

GamePiece_Active == true && (PropertyXYZ * 3 + PropertyABC + 20) == 112

Regards,
Brent.

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

On 11/02/2010 at 1:17 AM Harlekin wrote:


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

Post generated using Mail2Forum (mail2forum.com)

Hi Brent,

thank you very much for your quit response!
Yesterday I downloaded the whole code to find out how I could implement such complex expressions.

I saw that the bsh engine is already in there and therefore I hoped that implementing this would be no big deal at all… :slight_smile:

But I missed the point that my feature request is already covered as well.
Sorry for that.

Any Idea when 3.2 will be released?
Actually I have to decide which way to go.
Schould I wait for 3.2 or should I procceed with ‘the old way’ to implement my module?

What about the old expression using the ‘=’ instead of ‘==’?
Must we overhaul all those expressions with 3.2?

I actually have some major problems to get eclipse to work (Im no JAVA programmer at all but quite fluently with several others).
Is there a alpha or beta 3.2 WIN32 binary available already to play with?

Thx,
Stephan

Hi Stephen,

Probably 90% of the base coding is done, but it needs lots of testing, review and fine tuning. I would be surprised if it was officially released within 3 months, though a beta will be released as soon as we get the basics nailed.

Good question. Depends on how soon you want to get your moduel out. There will be no going back, once a module has been edited and saved with 3.2 Vassal, it will not be editable by 3.1 Vassal.

There are also other differences that need to be handled. BeanShell is strict Java syntax requiring quotes for strings, whereas in Property Match Expressions the quotes are implied.

I can automatically generate a valid BeanShell statement from a given old-style statement. One of the Fine Tuning exercises I need to do is decide on exactly how and when to do this. I am currently thinking that I will not convert the old-style PME’s at all, but will leave them unchanged and run them through the current PME code. However, you will not be able to modify them using the 3.2 editor. If you edit one of these expressions, it will automatically be converted to the corresponding BeanShell expression.

I have also mostly finished an ‘expression builder’ attempts to help you build Java expressions by selecting options from drop-down menus. Again, more fine tuning required, (and an area where an experience non-Java programmer could probably pick up very quickly).

What’s the problem? Most problems are caused by missing/incorrect libraries in the build path. We should be able to get you going.

Not yet, but possibly within a few weeks once Joel and I get the core trunk bedded down.

Rgds,
Brent.


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

Post generated using Mail2Forum (mail2forum.com)

Hi Brent,

nice to be part of a community where major leading members care about noobs like me… :slight_smile:

My VBFG 2.0 Projekt is actually far behind schedule.
At the beginning, I thought the job would be done within 2-3 Weeks.
Now I’m nearly 8 weeks into it and this was approx. only half the way to go.

Actually I can spend some work time als well as my free time into the Modul, 'cause I’m just between two major project assignments. But soon I’ll surely will have to invest all my free time to bear the upcomming projekt start of my next major projekt at work.

Guess I’ll have two or at max three more weeks to finish VBFG 2.0.
That leaves me no slot for digging into the inner workings of VASSAL.

Regarding my Plant Rings issue, I’ll do it the ‘hard’ way now.
Drawing ~300 simple svg images is a pain in the a… but could be done in just one day of focused work. Its not elegant at all, but a valid workaround regularily using 3.1 onboard tools.
Yesterday I did a POC with just one of those planets (only 36 SVGs each) and it worked out quite nicely. I expect no more critical issues this way now except the required workload.

Don’t know whats wrong with my Java Installation.
I checked out the actual VASSAL-src trunk and configured the build path as described in the developers corner.
Everything resolved nicely except a view symbols around file io at the zip file system section of the code.
An hour of research showed me that this section is probably beeing tested somehow and there is actually just a JAR missing in the lib or lib-dist folders. Maybe thats the reason why the trunc does not compile and run error free as expected.

After that I checked out swampwallebies branch called …32new.
This time the code was build error free but launching the ModulManager threw a windows socket error. At this point I gave up to investigate the case further.

Maybe you can tell me what I have to do, to get the actual trunc to work or maybe which 32 dev branch I should use to have a look into some of the new features from a module designers perspective.

How ever, I fear the VASSAL development thing will not solve my actual modul design issues shortly with low effort and therefore has to be set aside by me for now anyway.

Best
Stephan

Thus spake “Harlekin”:

If there’s something regular about the way the images are constructed,
you could write a script to build them for you.

Getting the trunk to work right now will require some coding, some of
which I’m in the middle of, and will possibly finish, by Monday.


J.


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

Post generated using Mail2Forum (mail2forum.com)

Hi uckelman,

another ‘famous’ member lured in here by me … ;-)
Thx for your answer.

Guess an experianced Incscape user migth do the trick within a couple of minutes.
I draw my first PNG Image with Gimp 6 weeks and my first SVG image with Inkscape 3 weeks ago. Lerning VASSAL, Gimp and Inkscape simultaneously was quite a task I can tell.
OK as former PhotoShop user Gimp was not to hard to learn…

Actually I have no Idea how to build scripts with inkscape at all.
If you can link me to a tutorial or HowTo, that would be quite teasing of course…
After all it should not take me more than 1 day to learn Inkscape scripting up to the level where I can build a script to render my images.

Just to give you an idea what must be achived:
Planet Rings (max 3 per planet) may be placed around Planets with a diameter from 26…50 cm.
A Ring is D6cm wide and starts D6*5cm above the surface.

Actually I have a .xls already with all required dx,dy and widths (in px) calculated by the above mentioned formulars.
Given this it’s easy but boring and time consuming to create all those images manually.

Thx
Stepahn

Thus spake “Harlekin”:

I don’t mean writing a script for use inside Inkscape (though I guess
that’s also possible, I think, if you write in Python). SVG is just
a dialect of XML. If you take a look at your SVG files in a text editor,
you’ll see that. I mean writing a script (in, say Perl or maybe Python)
which will produce the XML directly and write it to file, based on a
set of parameters you give as input.

If the difference between one ring and other is just the inner and outer
diameters, then you could do what you’re doing a lot faster just with
a text editor, rather than using Inkscape. (This is an alternative to
scripting.) Open up two rings of different diameters in a text editor and
compare the SVG. What’s different about them?


J.


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

Post generated using Mail2Forum (mail2forum.com)

ähmmm yes.

It’s always rewarding to talk to someone else about an issue when you are stuck somewhere…

I once took a look inside the SVG to just go the way you mentioned.
But gave up because of the way the svg was constructed.
Using a diff tool to compare two of them evaded me completely till now … oops.

Damn, I’ll give it a try immediately.

Thx
Stephan

On Feb 12, 2010, at 4:26 AM, Joel Uckelman wrote:

Or another alternative might be to write a script that uses
ImageMagick, which is a command-line tool.


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

Post generated using Mail2Forum (mail2forum.com)

Job done.

Inkscape has a fairly complicated way to construct a ring from SVG primitives. So an easy diff with some numerical replacements would have been much more work, than just performing those edits with Inkscape itself.

With roughly 15 Key Strokes and 10 Mouse Clicks per image (including entering some numbers and saving the outcome) I decided not to dive into sripting at all.

After some movement (hand mouse and such) optimization during the task I ended up at approx. 30sec per image. That was approx. 20 min per Planet (36 images) and about 3 hours for all 10 of them.

Well, I did spilt it up into 3 chunks of 1 hour focused work with some other things in between (coffee, wathching TV ans such… :slight_smile: to relax my aching hand and worn brain…

The biggest issues at the end were not the rings itself but to define the NonRectangular Image to get a nice handle on the planets wether their rings are active or not.

To select a NonRectangular SVG Image for a planet with a diameter of 50cm (1400px) took 45 minutes to load. First I though it crashed, but it didn’t. I just had to wait untill it finished loading.
Even a 26cm Planet took roughly 5 minutes to load its NonRectangular image.

Maybe that’s another area where improvements are possible.

Again, The Job is done. And it took me just one Saturday Afternoon from Coffee to TV Prime Time…

Lesson learned:
Sometimes just DOING something the hard way may be more effective and efficient than to break new grounds, just because we like to break new grounds insetad performing some boring and repeating tasks…

Cheers
Stephan

Since it’s now been 6 months since anyone has asked, when will 3.2 be out?

(Whine! Whine!, Complain, Complain - why don’t those people stop whining and get off their ***** and give us a hand :laughing: )

Thus spake dcholtx:

Since it’s now been 6 months since anyone has asked, when will 3.2 be
out?

(Whine! Whine!, Complain, Complain - why don’t those people stop whining
and get off their ***** and give us a hand :lol: )

Presently, we’re trying to get 3.1.15 out the door. Once that happens, my
plan is to finish the tiling work for 3.2.0 and see where things are at
that point. It might make sense to release 3.2.0 as it is then, rather than
wait further for other features to be completed.


J.