Create account / Log in

Problems with complex conditions

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Problems with complex conditions

Postby panther 2010 » September 23rd, 2020, 10:14 am

HI to all,

It often happens that different conditions such as: RANGE = ~ 1 | 2 && ASP = ~ 6 | 7 | 8 && CH = ~ 1 | 2 | 3 | 4 | 5 | 6 have to be analyzed . Unfortunately, the evaluation of all conditions requires a large number of trigger actions, one for each condition.
In the past I have tried several workarounds in order to try to reduce the large number of trigger actions, but none have worked, most likely because I don't know the correct syntax to do this.
I have tried to define a marker for each condition, e.g. Cond1 = RANGE = ~ 1 | 2 && ASP = ~ 6 | 7 | 8 && CH = ~ 1 | 2 | 3 | 4 | 5 | 6, and so on, but I cannot in any way evaluate if the condition is true or false, in how much, in all the different attempts at syntactic forms, I always get a syntax error.

Thanks in advance to anyone who has an idea on how to solve this problem, otherwise I'll have to resign myself to having dozens of trigger actions to evaluate.

Cheers. :?:
panther 2010
 
Posts: 119
Joined: July 18th, 2010, 3:04 pm

Re: Problems with complex conditions

Postby jrwatts » September 23rd, 2020, 11:04 am

I'm not entirely sure what you're trying to do there, but assuming you're trying to check that RANGE is 1 or 2, ASP is in the range 6 to 8, and CH is in the range 1 to 6, this expression should check all of that:
Code: Select all
{(RANGE == 1 || RANGE == 2) && (ASP >= 6 && ASP <= 8) && (CH >= 1 && CH <= 6)}
jrwatts
 
Posts: 128
Joined: April 29th, 2020, 10:30 pm

Re: Problems with complex conditions

Postby panther 2010 » September 24th, 2020, 8:27 am

Hello Jrwatts, thank you for your reply.

What I want do to is to try to use a more simple condition in a trigger action using markers like Cond1 = xxx, Cond2 = yyy, and so on.
I tried to put in the trigger action the following syntax : $Cond1$ || $Cond2$ || ... || $Condn$ that is a simpler form instead of using long string of conditions like RANGE = ~ 1 | 2 && ASP = ~ 6 | 7 | 8 && CH = ~ 1 | 2 | 3 | 4 | 5 | 6 and so on.

Unfortunately it doesn't work properly.

I'm asking what I'm doing wrong.

Cheers. :(

Panter 2010
panther 2010
 
Posts: 119
Joined: July 18th, 2010, 3:04 pm

Re: Problems with complex conditions

Postby jrwatts » September 24th, 2020, 9:06 am

Hmm, I'm not sure why that isn't working, then. The only thing I'm wondering about is if you are allowed to have a space between "=" and "~"; have you tried without the space (=~), instead?

Can you share an example module showing what you're trying to do?
jrwatts
 
Posts: 128
Joined: April 29th, 2020, 10:30 pm

Re: Problems with complex conditions

Postby Brent Easton » September 24th, 2020, 11:51 am

'= ~' will definitely not work.
User avatar
Brent Easton
 
Posts: 3229
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Problems with complex conditions

Postby panther 2010 » September 24th, 2020, 6:14 pm

HI Brent.

Very strange. I'm still using version 3.2.17 of Vassal and "=~" (without the blank within the two symbols) is working well.

My problem is another.

Be well.

Panther 2010.
panther 2010
 
Posts: 119
Joined: July 18th, 2010, 3:04 pm

Re: Problems with complex conditions

Postby Brent Easton » September 24th, 2020, 9:03 pm

Yes indeed. Could you just confirm whether in your module with the problem, you are using =~ (no blank) or = ~ (with blank)?

Are the examples you showed earlier that we have been using to investigate the problem the actual text cut and pasted from your module, or examples mis-typed from memory?

Thanks.
User avatar
Brent Easton
 
Posts: 3229
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Problems with complex conditions

Postby panther 2010 » September 25th, 2020, 4:50 pm

Hello Brent and Jrwatts,

first of all, thank you for your kind response to my question.
Well, it is worth trying to clarify what I am doing.
Be patient: English is not my mother tongue and I find it difficult to express myself clearly in that language, especially in matters of a technical nature.

I simulated tables (like a CRT, for instance) in order to automate as much as possible the modules I'm working on. Everything works perfectly. The problem lies in the large number of trigger actions needed for the simulation.
In the present case, I have defined three variables: RANGE (the distance between two hexagons on the map), ASP (a differential between the forces of the units involved) and CH (the value of a random chit that varies between 0 and 9).

For example, the condition: RANGE =~1|2 && ASP =~3|4|5 && CH =~1|2|3 (I just removed the blanks introduced by copy & paste) represents the case where RANGE is between 1 and 2, ASP between 3 and 5 and CH between 1 and 3.

Unfortunately, 28 trigger actions are needed to simulate the entire table.
The problem I was working on is trying to drastically reduce the number of trigger actions needed.

To this end, I defined 28 markers, one for each condition to be evaluated in a trigger action, such as:
ASTA2 = "= ~1|2 && ASP =~ 3|4|5 && CH =~ 1|2|3" (without the ").

After numerous unsuccessful attempts, I inserted a single condition in the trigger action with the following syntax:
$ASTA1$ || $ASTA2$ || ... || $ASTA28$.

This kind of syntax didn't work initially, so I asked about the Vassal forum.

A strange thing happened yesterday: I just rewrote the trigger action from scratch, without making any changes and now it works!

Things like this have already happened in the past: it was enough to rewrite the condition and things began to work properly. Perhaps while typing I pressed some key which, although not clearly visible, still modified the condition string and Vassal interpreted it in a different way. I do not know.

In any case, even this problem has finally been solved!

Before I forget, I have another question to ask: I am currently still using Vassal version 3.2.17, but yesterday I downloaded the latest version released, 3.4.3.

In order to learn how to use it better, I would like to know if there is a documentation that describes in detail the changes made and gives some examples on how to use the new features that have been introduced after the version I currently use.

I thank in advance anyone who wants to give me explanations on the matter.

Panther 2010. :D
panther 2010
 
Posts: 119
Joined: July 18th, 2010, 3:04 pm

Re: Problems with complex conditions

Postby marktb1961 » September 25th, 2020, 7:25 pm

Release notes outlines the new features..... http://www.vassalengine.org/wiki/VASSAL ... ease_Notes (thank Brian / Cattlesquat, I think).

Also, from the expression builder (available from global, dynamic and calculated property traits), you will find new some new functions available.
Platform: Vassal 3.4.11, MacOS Big Sur on iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 345
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Problems with complex conditions

Postby panther 2010 » September 26th, 2020, 6:25 am

Hello marktb1961,

many thanks for the link.

I will try the new Vassal version soon.

Be well.

Panther 2010 :)
panther 2010
 
Posts: 119
Joined: July 18th, 2010, 3:04 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 4 guests