I've run into these same problems and gotten around them by assigning
variables before the if-then test. Try this below:
var numprKnEx as number
var numprWarC as number
var prKESen as number
if (numprKnEx <= (numprWarC + numprKESen)) then
@valid=1
endif
If that doesn't work, do your addition before the test:
var numprKnEx as number
var numprWarC as number
var numprKESen as number
var numTotal as number
numTotal = numprWarC + numprKESen
if (numprKnEx <= numTotal) then
@valid=1
endif
A bit klunky, but that seems to work most of the time. I don't know
why the other doesn't work (mostly I thought it was me getting the
syntax wrong) but this is how I've gotten around it in my FOW-rgmt
files I'm working on.
Ted
--- In
armybuilder@yahoogroups.com, "thesoi" <esoiset@s...> wrote:
>
> I have tried those. As soon as the open parentheses after the <= go
> in, I get the "Error Parsing Left Side expression in relational
> comparison." error.
> In your first example, I think I need the pr in front of KnEx, WarC
> and KESen, as that is the name of the tag variable.
>
> Thanks for the reply,
> Eric
>
> --- In
armybuilder@yahoogroups.com, "Thomas J. Willard" <tomw@i...>
wrote:
> > Ok, have you tried
> >
> > if (tagcount[prStuff.KnEx] <= (tagcount[prStuff.WarC] +
> > tagcount[prStuff.KESen])) then
> > @valid=1
> > endif
> >
> > or
> >
> > if (tagcount[prStuff.prKnEx] <= (tagcount[prStuff.prWarC] +
> > tagcount[prStuff.prKESen])) then
> > @valid=1
> > endif
> >
> > Tom
> >
> >
> >
> > thesoi wrote:
> >
> > >I tried that, now the message I get is:
> > >"Syntax error in validation script on line 1.
> > >Error Parsing Left Side expression in relational comparison."
> > >
> > >This is what I have in the rule:
> > >if (tagcount[prStuff.prKnEx] <= (tagcount[prStuff.WarC] +
> > >tagcount[prStuff.KESen])) then
> > >@valid=1
> > >endif
> > >
> > >If I remove the middle set of parentheses:
> > >
> > >This is what I have in the rule:
> > >if (tagcount[prStuff.prKnEx] <= tagcount[prStuff.WarC] +
> > >tagcount[prStuff.KESen]) then
> > >@valid=1
> > >endif
> > >I get no error message, but the prStuff.WarC doesn't seem to be
> > >counted. By that, I mean I can take a general and I get a validation
> > >error if I take a unit of knigts. The validation error goes away if I
> > >then choose a knight hero. This rule only seems to count the last
> > >tagcount expression and ignores the first tagcount after the <=.
> > >
> > >Any ideas?
> > >Thanks for the input you have given so far.
> > >Eric
> > >
> > >--- In
armybuilder@yahoogroups.com, Mark Handford <mach_5@r...>
wrote:
> > >
> > >
> > >>Try this instead:
> > >>
> > >>if (tagcount[prStuff.prKnEx] <= (tagcount[prStuff.WarC] +
> > >>tagcount[prStuff.KESen])) then valid=1
> > >>endif
> > >>
> > >>
> > >>--- thesoi <esoiset@s...> wrote:
> > >>
> > >>
> > >>>I am having problems with a validation rule script.
> > >>>
> > >>>The tags I am using:
> > >>>prStuff.prWarC (General)
> > >>>prStuff.prKnEx (Unit of knights)
> > >>>prStuff.prKESen (Knights Hero)
> > >>>
> > >>>These are defined in the groups tab of an aug file.
> > >>>
> > >>>The rule I am trying to create is: One unit of knights allowed per
> > >>>general plus one per knight hero in the army.
> > >>>
> > >>>What I have done is:
> > >>>
> > >>>if (tagcount[prStuff.prKnEx] <= [prStuffWarC]) then @valid=1
> > >>>endif
> > >>>
> > >>>This works to limit the units of knights to one per general. I can
> > >>>substitute the her for the general in the above equation and it
> > >>>works too. Where I get confused is when I try to add the hero and
> > >>>the general together.
> > >>>
> > >>>I tried:
> > >>>
> > >>>if (tagcount[prStuff.prKnEx] <= tagcount([prStuff.WarC]+
> > >>>[prStuff.KESen])) then valid=1
> > >>>endif
> > >>>
> > >>>But I got an error message saying: "Syntax error in validation
> > >>>script for rule on line 1 ->Invalid use of a reserved word in
> > >>>script."
> > >>>
> > >>>I also tried:
> > >>>
> > >>>if (tagcount[prStuff.prKnEx]) <= (tagcount([prStuff.WarC]+
> > >>>[prStuff.KESen])) then valid=1
> > >>>endif
> > >>>
> > >>>Then the message is: ""Syntax error in validation script for
rule on
> > >>>line 1 -> Reference to undeclared variable."
> > >>>
> > >>>Any idea what I am doing wrong?
> > >>>
> > >>>Thanks for your time,
> > >>>
> > >>>Eric
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>To unsubscribe from this group, email
> > >>>
> > >>>armybuilder-unsubscribe@yahoogroups.com
> > >>>Yahoo! Groups Links
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>=====
> > >>WF6 Army Builder File Manager
> > >>Direwolf FAQ Council - Army Builder Liaison
> > >>-
> > >>Warhammer Club - Vancouver, BC
> > >>
http://www.WCP-Vancouver.com
> > >>
> > >>
> > >>
> > >>
> > >>__________________________________
> > >>Celebrate Yahoo!'s 10th Birthday!
> > >>Yahoo! Netrospective: 100 Moments of the Web
> > >>
http://birthday.yahoo.com/netrospective/
> > >>
> > >>
> > >
> > >
> > >
> > >
> > >
> > >To unsubscribe from this group, email
> > >
> > >armybuilder-unsubscribe@yahoogroups.com
> > >Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > NOTICE: This electronic message (including attachments) is covered
> by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521. It
> is confidential and may be legally privileged. If you are not the
> intended recipient, you are hereby notified that any retention,
> dissemination, distribution, or copying of this communication is
> strictly prohibited. Please reply to the sender that you have
> received the message in error and then destroy the communication.
> Thank You.
> >
> >
> >
> > [Non-text portions of this message have been removed]