Loading ...
Sorry, an error occurred while loading the content.

Re: [pcgen] [DOCS] JEP update

Expand Messages
  • Eric Beaudoin
    ... Eddy, can you verify this. Normally with Booleans, 0 is false and anything else is true. So -1, which is lower then 1 is true. Unless your example was
    Message 1 of 22 , Aug 3, 2004
    • 0 Attachment
      At 15:02 2004.08.03, Eddy Anthony wrote:
      >This is an update to the JEP math operators on the DEFINE page
      >
      >-----------------------------------------------------
      >The Min & Max functions have been updated to accept mutiple arguments
      >
      >Updated 5.7.3
      >Minimums and maximums
      >
      >min(a,b,c)
      >
      >Returns the lowest of 'a', 'b' or 'c'.
      >
      >max(a,b,c)
      >
      >Returns the highest of 'a', 'b' or 'c'.
      >
      >-----------------------------------------------------
      >There is now a Boolean IF function
      >
      >if(CL,4,0)
      >
      >Boolean If [if(x,y,z)]. Asks if x is less than 1 then returns y, else
      >returns z. In this example the operator asks if Class Level is less than 1
      >then returns 4 or else returns 0.

      Eddy, can you verify this. Normally with Booleans, 0 is false and anything else is true. So -1, which is lower then 1 is true.

      Unless your example was supposed to be if(x<1,y,z).

      >-----------------------------------------------------
      >
      >My compliments to Eric on the new format of the release notes. They were
      >very helpful in spotting these changes, I love the links.

      Thanks.


      -----------------------------------------------------------
      Éric "Space Monkey" Beaudoin
      Founding Member of the Hidden-in-the-Trench Club
      Release Monkey in training
      >> In space, no one can hear you sleep.
      >> Camels to can climb trees (and sometime eat them).
      <mailto:beaudoer@...>
    • Eddy Anthony
      ... At this point I was translating what I found on the tracker, I ll put it to the test in some LST this evening. The tracker says anything greater than 0 is
      Message 2 of 22 , Aug 3, 2004
      • 0 Attachment
        On 8/3/04 3:17 PM, "Eric Beaudoin" <beaudoer@...> wrote:

        >> There is now a Boolean IF function
        >>
        >> if(CL,4,0)
        >>
        >> Boolean If [if(x,y,z)]. Asks if x is less than 1 then returns y, else
        >> returns z. In this example the operator asks if Class Level is less than 1
        >> then returns 4 or else returns 0.
        >
        > Eddy, can you verify this. Normally with Booleans, 0 is false and anything
        > else is true. So -1, which is lower then 1 is true.
        >
        > Unless your example was supposed to be if(x<1,y,z).

        At this point I was translating what I found on the tracker, I'll put it to
        the test in some LST this evening.

        The tracker says anything greater than 0 is interpreted as true so that
        would lead me to believe that -1 would return false, we'll see what my
        testing says.
        --
        ~ Eddy
        ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
      • blithwyn
        ... less than 1 ... anything ... put it to ... From what I can read from the code it works like this: x is either a boolean expression or a number. Boolean =
        Message 3 of 22 , Aug 3, 2004
        • 0 Attachment
          --- In pcgen@yahoogroups.com, Eddy Anthony <eddyba@m...> wrote:
          > On 8/3/04 3:17 PM, "Eric Beaudoin" <beaudoer@v...> wrote:
          >
          > >> There is now a Boolean IF function
          > >>
          > >> if(CL,4,0)
          > >>
          > >> Boolean If [if(x,y,z)]. Asks if x is less than 1 then returns y, else
          > >> returns z. In this example the operator asks if Class Level is
          less than 1
          > >> then returns 4 or else returns 0.
          > >
          > > Eddy, can you verify this. Normally with Booleans, 0 is false and
          anything
          > > else is true. So -1, which is lower then 1 is true.
          > >
          > > Unless your example was supposed to be if(x<1,y,z).
          >
          > At this point I was translating what I found on the tracker, I'll
          put it to
          > the test in some LST this evening.
          >
          > The tracker says anything greater than 0 is interpreted as true so that
          > would lead me to believe that -1 would return false, we'll see what my
          > testing says.
          > --
          > ~ Eddy
          > ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur

          From what I can read from the code it works like this:
          x is either a boolean expression or a number.
          Boolean => if x then y else z
          Number => if (x > 0) then y else z

          Ratheof Blithwyn
          Data Lemur
        • Eddy Anthony
          You were right Eric, I got it backwards yesterday if(CL,4,0) Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns y, else returns z. In this
          Message 4 of 22 , Aug 4, 2004
          • 0 Attachment
            You were right Eric, I got it backwards yesterday

            if(CL,4,0)

            Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns y, else
            returns z.
            In this example the operator asks if Class Level is greater than 0 then
            returns 4 or else returns 0.


            --
            ~ Eddy
            ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
          • Eric Beaudoin
            ... Heu... this is what I thought was in error to begin with. Let me be clearer: if(-1,true_value,false_value). In this case, the if function should return
            Message 5 of 22 , Aug 4, 2004
            • 0 Attachment
              At 13:15 2004.08.04, Eddy Anthony wrote:
              >You were right Eric, I got it backwards yesterday
              >
              >if(CL,4,0)
              >
              >Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns y, else
              >returns z.
              > In this example the operator asks if Class Level is greater than 0 then
              >returns 4 or else returns 0.

              Heu... this is what I thought was in error to begin with.

              Let me be clearer: if(-1,true_value,false_value). In this case, the if function should return true_value. If it returns false_value, it is a bug.

              The main thing is to define TRUE properly (the Truth is out there but it's hard to define :-). The most common definition of TRUE is "everything that is not FALSE".

              I know, this sounds like a smart ass answer but it isn't. FALSE is way easier to define than TRUE.

              FALSE = 0, 0.0, the empty string ("") or undefined variables.

              I think you tested the if() function. If it does not behave properly, could you please put in a tracker to have it fixed. Let's not create our own personal definition of TRUE and FALSE (it goes against the Principle of Least Surprise).

              Best

              -----------------------------------------------------------
              Éric "Space Monkey" Beaudoin
              Founding Member of the Hidden-in-the-Trench Club
              Release Monkey in training
              >> In space, no one can hear you sleep.
              >> Camels to can climb trees (and sometime eat them).
              <mailto:beaudoer@...>
            • Eddy Anthony
              Ah, I follow you, though I can see uses for both functionalities I can also see how to work around it if it were fixed to how you state it should work. I tend
              Message 6 of 22 , Aug 4, 2004
              • 0 Attachment
                Ah, I follow you, though I can see uses for both functionalities I can also
                see how to work around it if it were fixed to how you state it should work.
                I tend to agree with your point of view about it though. I've opened a bug
                tracker for this:

                [ 1003437 ] if(x,y,z) should return false only on 0

                On 8/4/04 1:48 PM, "Eric Beaudoin" <beaudoer@...> wrote:

                > At 13:15 2004.08.04, Eddy Anthony wrote:
                >> You were right Eric, I got it backwards yesterday
                >>
                >> if(CL,4,0)
                >>
                >> Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns y, else
                >> returns z.
                >> In this example the operator asks if Class Level is greater than 0 then
                >> returns 4 or else returns 0.
                >
                > Heu... this is what I thought was in error to begin with.
                >
                > Let me be clearer: if(-1,true_value,false_value). In this case, the if
                > function should return true_value. If it returns false_value, it is a bug.
                >
                > The main thing is to define TRUE properly (the Truth is out there but it's
                > hard to define :-). The most common definition of TRUE is "everything that is
                > not FALSE".
                >
                > I know, this sounds like a smart ass answer but it isn't. FALSE is way easier
                > to define than TRUE.
                >
                > FALSE = 0, 0.0, the empty string ("") or undefined variables.
                >
                > I think you tested the if() function. If it does not behave properly, could
                > you please put in a tracker to have it fixed. Let's not create our own
                > personal definition of TRUE and FALSE (it goes against the Principle of Least
                > Surprise).
                >
                > Best

                --
                ~ Eddy
                ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
              • blithwyn
                In the docs, be sure to include an example like if((CL
                Message 7 of 22 , Aug 4, 2004
                • 0 Attachment
                  In the docs, be sure to include an example like
                  if((CL<4),1,2)
                  i.e. with an actual boolean expression which IMO would be more natural
                  since it is what one is after here. We are talking about an if
                  statement after all. For the sake of readability avoid assumptions of
                  underlying representation please.

                  Ratheof Blithwyn
                  Data Lemur


                  --- In pcgen@yahoogroups.com, Eddy Anthony <eddyba@m...> wrote:
                  > Ah, I follow you, though I can see uses for both functionalities I
                  can also
                  > see how to work around it if it were fixed to how you state it
                  should work.
                  > I tend to agree with your point of view about it though. I've opened
                  a bug
                  > tracker for this:
                  >
                  > [ 1003437 ] if(x,y,z) should return false only on 0
                  >
                  > On 8/4/04 1:48 PM, "Eric Beaudoin" <beaudoer@v...> wrote:
                  >
                  > > At 13:15 2004.08.04, Eddy Anthony wrote:
                  > >> You were right Eric, I got it backwards yesterday
                  > >>
                  > >> if(CL,4,0)
                  > >>
                  > >> Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns
                  y, else
                  > >> returns z.
                  > >> In this example the operator asks if Class Level is greater than
                  0 then
                  > >> returns 4 or else returns 0.
                  > >
                  > > Heu... this is what I thought was in error to begin with.
                  > >
                  > > Let me be clearer: if(-1,true_value,false_value). In this case, the if
                  > > function should return true_value. If it returns false_value, it
                  is a bug.
                  > >
                  > > The main thing is to define TRUE properly (the Truth is out there
                  but it's
                  > > hard to define :-). The most common definition of TRUE is
                  "everything that is
                  > > not FALSE".
                  > >
                  > > I know, this sounds like a smart ass answer but it isn't. FALSE is
                  way easier
                  > > to define than TRUE.
                  > >
                  > > FALSE = 0, 0.0, the empty string ("") or undefined variables.
                  > >
                  > > I think you tested the if() function. If it does not behave
                  properly, could
                  > > you please put in a tracker to have it fixed. Let's not create our own
                  > > personal definition of TRUE and FALSE (it goes against the
                  Principle of Least
                  > > Surprise).
                  > >
                  > > Best
                  >
                  > --
                  > ~ Eddy
                  > ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
                • Eric Beaudoin
                  ... I agree with you. I would remove the extra parentasis though since that don t really improve readability: if(CL 0,x,y) would be similar to the example Eddy
                  Message 8 of 22 , Aug 4, 2004
                  • 0 Attachment
                    At 14:10 2004.08.04, blithwyn wrote:
                    >In the docs, be sure to include an example like
                    >if((CL<4),1,2)
                    >i.e. with an actual boolean expression which IMO would be more natural
                    >since it is what one is after here. We are talking about an if
                    >statement after all. For the sake of readability avoid assumptions of
                    >underlying representation please.
                    >
                    >Ratheof Blithwyn
                    >Data Lemur

                    I agree with you. I would remove the extra parentasis though since that don't really improve readability: if(CL>0,x,y) would be similar to the example Eddy was giving.


                    -----------------------------------------------------------
                    Éric "Space Monkey" Beaudoin
                    Founding Member of the Hidden-in-the-Trench Club
                    Release Monkey in training
                    >> In space, no one can hear you sleep.
                    >> Camels to can climb trees (and sometime eat them).
                    <mailto:beaudoer@...>
                  • Brass Tilde
                    ... Please include examples that exemplify *all* of the functionality. if(CL,1,2) is a valid example, and should be included with a full explanation of the
                    Message 9 of 22 , Aug 4, 2004
                    • 0 Attachment
                      > In the docs, be sure to include an example like
                      > if((CL<4),1,2)
                      > i.e. with an actual boolean expression which IMO would be more natural
                      > since it is what one is after here.

                      Please include examples that exemplify *all* of the functionality.
                      "if(CL,1,2)" is a valid example, and should be included with a full
                      explanation of the results for zero and non-zero values of CL.

                      "if(CL=0,2,1)" is also valid, even though functionaly identical to the
                      first, and should also be explained.


                      > We are talking about an if statement after all. For the sake of
                      > readability avoid assumptions of underlying representation please.

                      But don't leave them out, as an understanding of them can lead to
                      simplifications in expressions, which *may* lead to increases in the
                      efficiency of the evaluation.

                      >
                      > Ratheof Blithwyn
                      > Data Lemur
                      >
                      >
                      > --- In pcgen@yahoogroups.com, Eddy Anthony <eddyba@m...> wrote:
                      > > Ah, I follow you, though I can see uses for both functionalities I
                      > can also
                      > > see how to work around it if it were fixed to how you state it
                      > should work.
                      > > I tend to agree with your point of view about it though. I've opened
                      > a bug
                      > > tracker for this:
                      > >
                      > > [ 1003437 ] if(x,y,z) should return false only on 0
                      > >
                      > > On 8/4/04 1:48 PM, "Eric Beaudoin" <beaudoer@v...> wrote:
                      > >
                      > > > At 13:15 2004.08.04, Eddy Anthony wrote:
                      > > >> You were right Eric, I got it backwards yesterday
                      > > >>
                      > > >> if(CL,4,0)
                      > > >>
                      > > >> Boolean If [if(x,y,z)]. Asks if x is greater than 0 then returns
                      > y, else
                      > > >> returns z.
                      > > >> In this example the operator asks if Class Level is greater than
                      > 0 then
                      > > >> returns 4 or else returns 0.
                      > > >
                      > > > Heu... this is what I thought was in error to begin with.
                      > > >
                      > > > Let me be clearer: if(-1,true_value,false_value). In this case, the if
                      > > > function should return true_value. If it returns false_value, it
                      > is a bug.
                      > > >
                      > > > The main thing is to define TRUE properly (the Truth is out there
                      > but it's
                      > > > hard to define :-). The most common definition of TRUE is
                      > "everything that is
                      > > > not FALSE".
                      > > >
                      > > > I know, this sounds like a smart ass answer but it isn't. FALSE is
                      > way easier
                      > > > to define than TRUE.
                      > > >
                      > > > FALSE = 0, 0.0, the empty string ("") or undefined variables.
                      > > >
                      > > > I think you tested the if() function. If it does not behave
                      > properly, could
                      > > > you please put in a tracker to have it fixed. Let's not create our own
                      > > > personal definition of TRUE and FALSE (it goes against the
                      > Principle of Least
                      > > > Surprise).
                      > > >
                      > > > Best
                      > >
                      > > --
                      > > ~ Eddy
                      > > ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
                      >
                      >
                      >
                      >
                      > PCGen's release site: http://pcgen.sourceforge.net
                      > PCGen's alpha build: http://rpg.plambert.net/pcgen
                      > PCGen's FAQ:
                      > http://rpg.plambert.net/pcgen/current/_docs/
                      > Yahoo! Groups Links
                      >
                      >
                      >
                      >
                      >
                    • Eddy Anthony
                      Thanks for the feed back everybody, very helpful stuff. I ve expanded the entry to try and be more clear. What do you think? -- ~ Eddy ~ PCGen BoD, Docs SB,
                      Message 10 of 22 , Aug 4, 2004
                      • 0 Attachment
                        Thanks for the feed back everybody, very helpful stuff. I've expanded the
                        entry to try and be more clear. What do you think?
                        --
                        ~ Eddy
                        ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur

                        -----------------------------------------
                        Boolean If operator

                        if(x,y,z)

                        The boolean if operator will return one of two results after evaluating a
                        boolean. The variable x is a boolean result, 0 is false and 1 is true. The
                        variable y is the result returned if x is true, z is the result returned if
                        x is false. Put another way, if x is true (1) then the result is y, is not
                        then the result is z. Because x should either be 0 or 1 it makes the sense
                        to use a boolean expression, though this is not required.

                        At this time 0 or less is evaluated as false and 1 or greater is evaluated
                        as true, this may be changed in the future so that only 0 will return as
                        false and all other numbers return as true.

                        Examples:

                        if(CL<4,10,0)

                        Asks if Class Level is less than 4 then returns 10 or else returns 0.

                        if(CL>=4,10,0)

                        Asks if Class Level is greater than or equal to 4 then returns 10 or else
                        returns 0.

                        if((CL>5)||(TL>5),2,-4)

                        Asks if Class Level or Total Level is greater than 5 then returns 2 or else
                        returns -4.

                        if(STR,5,0)

                        Asks if Strength modifier is greater than 0 then returns 5 or else returns
                        0. Note that while this is valid it makes more sense to express it like
                        this: if(STR>0,5,0)
                      • Brass Tilde
                        ... One minor nit, if I ve understood the previous discussion properly, what this example actually does is check if STR mod is non-zero. The main eaxample and
                        Message 11 of 22 , Aug 4, 2004
                        • 0 Attachment
                          > if(STR,5,0)
                          >
                          > Asks if Strength modifier is greater than 0 then returns 5 or
                          > else returns
                          > 0.

                          One minor nit, if I've understood the previous discussion properly, what
                          this example actually does is check if STR mod is non-zero. The main
                          eaxample and the alternate will *not* yield the same results if the STR mod
                          is less than zero.

                          > Note that while this is valid it makes more sense to
                          > express it like this:
                          > if(STR>0,5,0)

                          IOW, with a strength score of 8, and a modifier of -1, "if(STR,5,0)" will
                          return 5, whereas "if(STR>0,5,0)" will return 0.

                          Brass
                        • Ross M. Lodge
                          ... The code was originally written so that if arg1 0, arg2 was returned, else arg3 was returned. I ve just committed a change to bring the code up to speed
                          Message 12 of 22 , Aug 4, 2004
                          • 0 Attachment
                            Quoting Brass Tilde <brasstilde@...>:

                            > One minor nit, if I've understood the previous discussion properly, what
                            > this example actually does is check if STR mod is non-zero. The main
                            > eaxample and the alternate will *not* yield the same results if the STR mod
                            > is less than zero.


                            The code was originally written so that if arg1 > 0, arg2 was returned,
                            else arg3 was returned. I've just committed a change to bring the code up to
                            speed with this discussion: e.g., if arg1 != 0, arg2 is returned, else arg3 is
                            returned. So if(STR,5,0) returns 5 unless STR==0. I can easily back this out
                            if people disagree.

                            Ross
                          • Keith Davies
                            ... I don t recall ever seeing 0 or less evaluated false except here. I ve only seen a few languages that do boolean math on numerics (C/C++, Perl, and
                            Message 13 of 22 , Aug 4, 2004
                            • 0 Attachment
                              On Wed, Aug 04, 2004 at 06:02:35PM -0400, Eddy Anthony wrote:
                              > -----------------------------------------
                              > Boolean If operator
                              >
                              > if(x,y,z)
                              >
                              > The boolean if operator will return one of two results after
                              > evaluating a boolean. The variable x is a boolean result, 0 is false
                              > and 1 is true. The variable y is the result returned if x is true, z
                              > is the result returned if x is false. Put another way, if x is true
                              > (1) then the result is y, is not then the result is z. Because x
                              > should either be 0 or 1 it makes the sense to use a boolean
                              > expression, though this is not required.
                              >
                              > At this time 0 or less is evaluated as false and 1 or greater is
                              > evaluated as true, this may be changed in the future so that only 0
                              > will return as false and all other numbers return as true.

                              I don't recall ever seeing '0 or less' evaluated false except here.
                              I've only seen a few languages that do boolean math on numerics (C/C++,
                              Perl, and Visual Basic); in all cases 0 is interpreted as false and
                              non-0 is interpreted as true (TRUE is defined as -1 in VB, FWIW).

                              Treating '0 or less' as false runs against the common behavior in common
                              programming languages. While I like boolean evaluation of numerics, I
                              would either support it in the common form, or drop it altogether and
                              require explicit boolean evaluation (as Java does).

                              As Brad says, princple of least surprise. The example you give below
                              "if(STR,5,0)" reads to me like 'if STR is non-zero', not 'if STR > 0'.

                              > Examples:
                              >
                              > if(CL<4,10,0)
                              >
                              > Asks if Class Level is less than 4 then returns 10 or else returns 0.
                              >
                              > if(CL>=4,10,0)
                              >
                              > Asks if Class Level is greater than or equal to 4 then returns 10 or else
                              > returns 0.
                              >
                              > if((CL>5)||(TL>5),2,-4)
                              >
                              > Asks if Class Level or Total Level is greater than 5 then returns 2 or else
                              > returns -4.

                              Contrived example, I know, but CL>5 cannot be true unless TL>5 is true;
                              TL.5 is a sufficient test here.

                              > if(STR,5,0)
                              >
                              > Asks if Strength modifier is greater than 0 then returns 5 or else
                              > returns 0. Note that while this is valid it makes more sense to
                              > express it like this: if(STR>0,5,0)

                              Quite. Especially given how many people would interpret that as looking
                              for STR to be 0 or non-0, rather that >0 or <= 0.


                              Keith
                              --
                              Keith Davies I gave my 2yo daughter a strawberry
                              keith.davies@... Naomi: "Strawberry!"
                              me: "What do you say?"
                              Naomi: "*MY* strawberry!"
                            • Keith Davies
                              ... No, don t. This makes sense now. It looks like your examples got slightly out of sync with the code, is all. Keith -- Keith Davies I gave
                              Message 14 of 22 , Aug 4, 2004
                              • 0 Attachment
                                On Wed, Aug 04, 2004 at 03:24:17PM -0700, Ross M. Lodge wrote:
                                > Quoting Brass Tilde <brasstilde@...>:
                                >
                                > > One minor nit, if I've understood the previous discussion properly, what
                                > > this example actually does is check if STR mod is non-zero. The main
                                > > eaxample and the alternate will *not* yield the same results if the STR mod
                                > > is less than zero.
                                >
                                >
                                > The code was originally written so that if arg1 > 0, arg2 was
                                > returned, else arg3 was returned. I've just committed a change to
                                > bring the code up to speed with this discussion: e.g., if arg1 != 0,
                                > arg2 is returned, else arg3 is returned. So if(STR,5,0) returns 5
                                > unless STR==0. I can easily back this out if people disagree.

                                No, don't. This makes sense now.

                                It looks like your examples got slightly out of sync with the code, is
                                all.


                                Keith
                                --
                                Keith Davies I gave my 2yo daughter a strawberry
                                keith.davies@... Naomi: "Strawberry!"
                                me: "What do you say?"
                                Naomi: "*MY* strawberry!"
                              • Brass Tilde
                                ... That makes sense to me, as long as actual comparative expressions, such as a ... Brad
                                Message 15 of 22 , Aug 4, 2004
                                • 0 Attachment
                                  > The code was originally written so that if arg1 > 0,
                                  > arg2 was returned,
                                  > else arg3 was returned. I've just committed a change to
                                  > bring the code up to
                                  > speed with this discussion: e.g., if arg1 != 0, arg2 is
                                  > returned, else arg3 is
                                  > returned. So if(STR,5,0) returns 5 unless STR==0. I can
                                  > easily back this out
                                  > if people disagree.

                                  That makes sense to me, as long as actual comparative expressions, such as a
                                  > b, evaluate to zero if false, and non-zero if true.

                                  Brad
                                • Andrew Wilson
                                  ... I think it could be clearer in places, you seem to be confused about exactly what represents true and what represents false. First you say only 0 and 1
                                  Message 16 of 22 , Aug 4, 2004
                                  • 0 Attachment
                                    On Wed, Aug 04, 2004 at 06:02:35PM -0400, Eddy Anthony wrote:
                                    > Thanks for the feed back everybody, very helpful stuff. I've expanded the
                                    > entry to try and be more clear. What do you think?
                                    > --
                                    > ~ Eddy
                                    > ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur
                                    >
                                    > -----------------------------------------

                                    > Boolean If operator
                                    >
                                    > if(x,y,z)
                                    >
                                    > The boolean if operator will return one of two results after evaluating a
                                    > boolean. The variable x is a boolean result, 0 is false and 1 is true. The
                                    > variable y is the result returned if x is true, z is the result returned if
                                    > x is false. Put another way, if x is true (1) then the result is y, is not
                                    > then the result is z. Because x should either be 0 or 1 it makes the sense
                                    > to use a boolean expression, though this is not required.
                                    >
                                    > At this time 0 or less is evaluated as false and 1 or greater is evaluated
                                    > as true, this may be changed in the future so that only 0 will return as
                                    > false and all other numbers return as true.
                                    >
                                    > Examples:
                                    >
                                    > if(CL<4,10,0)
                                    >
                                    > Asks if Class Level is less than 4 then returns 10 or else returns 0.
                                    >
                                    > if(CL>=4,10,0)
                                    >
                                    > Asks if Class Level is greater than or equal to 4 then returns 10 or else
                                    > returns 0.
                                    >
                                    > if((CL>5)||(TL>5),2,-4)
                                    >
                                    > Asks if Class Level or Total Level is greater than 5 then returns 2 or else
                                    > returns -4.
                                    >
                                    > if(STR,5,0)
                                    >
                                    > Asks if Strength modifier is greater than 0 then returns 5 or else returns
                                    > 0. Note that while this is valid it makes more sense to express it like
                                    > this: if(STR>0,5,0)

                                    I think it could be clearer in places, you seem to be confused about
                                    exactly what represents true and what represents false. First you say
                                    only 0 and 1 are valid, then you tell us that any number less than
                                    1 is false, number greater than or equal to 1 are true. how about.

                                    ---------------------
                                    Boolean If operator

                                    if(x,y,z)

                                    The boolean if operator will return one of two results after evaluating a
                                    boolean expression. x represents a boolean expression, if x evaluates to
                                    true then y is returned, otherwise, z is returned.

                                    At this time numbers less than or equal to 0 are evaluated as false.
                                    Numbers greater than or equal to 1 are evaluated as true, this may be
                                    changed in the future so that only 0 will be false - all other numbers
                                    will be true.


                                    I have no idea why you included this next bit, it makes no sense to
                                    me. Every expression (even a single variable) may be evaluated in a
                                    boolean context. In a boolean context, it will either be true or
                                    false (for some definition of true and false - see above).

                                    > Because x should either be 0 or 1 it makes the sense
                                    > to use a boolean expression, though this is not required.

                                    Examples:

                                    if(CL<4,10,0)

                                    Returns 10 if Class Level is less than 4 otherwise it returns 0.

                                    if(CL>=4,10,0)

                                    Returns 10 if Class Level is greater than or equal to 4 otherwise it
                                    returns 0.

                                    if((CL>5)||(TL>5),2,-4)

                                    Returns 2 if either Class Level is greater than 5 or Total Level is
                                    greater than 5 otherwise it returns -4.

                                    if(STR,5,0)

                                    Returns 5 if Strength modifier is greater than 0 otherwise it returns 0.
                                    Note that while this is valid it makes more sense to express it like
                                    this:

                                    if(STR>0,5,0)

                                    this will continue to work if the definitions of true and false are
                                    changed to become more standard.



                                    &ru
                                    --
                                    Aries: (March 21 - April 19)
                                    You know that one day you'll have to tell your family you're not
                                    really a chicken, but for now they really need the eggs.
                                  • Ross M. Lodge
                                    ... This _has_ been changed...in the current CVS tree. Ross
                                    Message 17 of 22 , Aug 4, 2004
                                    • 0 Attachment
                                      Quoting Andrew Wilson <pcgen@...>:

                                      > > At this time 0 or less is evaluated as false and 1 or greater is evaluated
                                      > > as true, this may be changed in the future so that only 0 will return as
                                      > > false and all other numbers return as true.


                                      This _has_ been changed...in the current CVS tree.

                                      Ross
                                    • Eddy Anthony
                                      I think we have consensus! Thanks Ross, I think that change makes sense. -- ~ Eddy ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur ... Boolean If operator
                                      Message 18 of 22 , Aug 4, 2004
                                      • 0 Attachment
                                        I think we have consensus!
                                        Thanks Ross, I think that change makes sense.
                                        --
                                        ~ Eddy
                                        ~ PCGen BoD, Docs SB, LST Chimp, TM Lemur

                                        ------------------------------------------
                                        Boolean If operator (revisited)

                                        if(x,y,z)

                                        The boolean if operator will return one of two results after evaluating a
                                        boolean. The variable x is a boolean result, 0 is false and anything not 0
                                        is true. The variable y is the result returned if x is true, z is the result
                                        returned if x is false. Put another way, if x is true (not 0) then the
                                        result is y, is x is false (0) then the result is z.

                                        Examples:

                                        if(CL<10,1,2)
                                        Asks if Class Level is less than 10 then returns 1 or else returns 2.

                                        if(CL>=4,10,0)
                                        Asks if Class Level is greater than or equal to 4 then returns 10 or else
                                        returns 0.

                                        if((CL>5)||(TL>5),2,-4)
                                        Asks if Class Level or Total Level is greater than 5 then returns 2 or else
                                        returns -4.

                                        if(STR,5,0)
                                        Asks if Strength modifier is greater than or less than 0 then returns 5 or
                                        else returns 0.
                                      • Frugal
                                        ... The functionaity is not the same ;O) The first example will evaluate the value of CL So it will return a true (non zero value)
                                        Message 19 of 22 , Aug 5, 2004
                                        • 0 Attachment
                                          <quote who="Brass Tilde">
                                          > Please include examples that exemplify *all* of the functionality.
                                          > "if(CL,1,2)" is a valid example, and should be included with a full
                                          > explanation of the results for zero and non-zero values of CL.
                                          >
                                          > "if(CL=0,2,1)" is also valid, even though functionaly identical to the
                                          > first, and should also be explained.

                                          The functionaity is not the same ;O)

                                          The first example will evaluate the value of "CL" So it will return a true
                                          (non zero value) when CL is non zero.

                                          the second example will evaluate the value of "CL=0" So it will return '1'
                                          when CL equals 0 and 0 all other times.

                                          The 2 examples are actualy inverses of each other.

                                          --
                                          regards,
                                          Frugal
                                          -OS Chimp
                                        • Brass Tilde
                                          ... Yes it is. Note the change in position of the true-part and false-part parameters between the first and second example. ... if(CL,1,2) will return 1 if
                                          Message 20 of 22 , Aug 5, 2004
                                          • 0 Attachment
                                            > <quote who="Brass Tilde">

                                            > > Please include examples that exemplify *all* of the functionality.
                                            > > "if(CL,1,2)" is a valid example, and should be included with a full
                                            > > explanation of the results for zero and non-zero values of CL.
                                            > >
                                            > > "if(CL=0,2,1)" is also valid, even though functionaly identical to the
                                            > > first, and should also be explained.
                                            >

                                            > From: "Frugal"
                                            > The functionaity is not the same ;O)

                                            Yes it is. Note the change in position of the true-part and false-part
                                            parameters between the first and second example.

                                            > The first example will evaluate the value of "CL" So it will return a true
                                            > (non zero value) when CL is non zero.

                                            "if(CL,1,2)" will return 1 if CL is non-zero, and 2 if CL is zero.

                                            > the second example will evaluate the value of "CL=0" So it will return '1'
                                            > when CL equals 0 and 0 all other times.

                                            "if(CL=0,2,1)" will also return 1 if CL is non-zero, and 2 if CL is zero.

                                            > The 2 examples are actualy inverses of each other.

                                            The expressions being evaluated are inverse, however, the way they are used
                                            causes each example to return the same value, thus they are functionaly
                                            identical.
                                          • Frugal
                                            ... Doh!!! -- regards, Frugal -OS Chimp
                                            Message 21 of 22 , Aug 6, 2004
                                            • 0 Attachment
                                              On Thursday 05 August 2004 12:30, Brass Tilde wrote:
                                              > > <quote who="Brass Tilde">
                                              > >
                                              > > > Please include examples that exemplify *all* of the functionality.
                                              > > > "if(CL,1,2)" is a valid example, and should be included with a full
                                              > > > explanation of the results for zero and non-zero values of CL.
                                              > > >
                                              > > > "if(CL=0,2,1)" is also valid, even though functionaly identical to the
                                              > > > first, and should also be explained.
                                              > >
                                              > > From: "Frugal"
                                              > > The functionaity is not the same ;O)
                                              >
                                              > Yes it is. Note the change in position of the true-part and false-part
                                              > parameters between the first and second example.

                                              Doh!!!

                                              --
                                              regards,
                                              Frugal
                                              -OS Chimp
                                            Your message has been successfully submitted and would be delivered to recipients shortly.