Dynamic Descriptions - Syntax

       Continents Main page        Table of Contents        Previous Topic        Next Topic


  o Strings (text / things to be displyed) are identified by braces {curly
    brackets}.  So, if you wanted a description with the time of day
    in it, you might have:

    "It is {time.hour} o'clock."

  o Numbers (calculations) are identified by square brackets.  Using gold,
    you could have:

    " [{gold}/1000]{result}Kgp "

    for how many thousand gp you have (You being whoever is looking at the
    description).  Mathematical expressions do NOT print their result, so
    the {result} identifier MUST be used to see the answer.

  o Conditionals occur automatically when a comparison is made.  That is,
    using the && (and), || (or), == (equality), < (less than),
    > (greater than), <= (less than or equal to), or >= (greater than
    or equal to) operators.  Conditionals are terminated with a single
    pipe (|).

    For example, you might check the time of day (although daylight hours
    are already a variable) to have moonlight or sunlight coming in through
    a skylight:

    [(({time.hour}>5)&&({time.hour}<20))]sunlight|
    [{time.hour}<6]moonlight|
    [{time.hour}>19]moonlight|
    streams through a skylight.

    Text in Dynamic Descriptions is justified automatically, so the extra
    carriage returns are discarded.  If you wish to add a carriage return,
    use #N.

    Let us analyze this.

    Daytime occurs after 5 o'clock and before 20 o'clock.
          {time.hour} > 5   &&   {time.hour} < 20

    If this is true, the value of {true} is returned, so we could test for
    equality:
          {time.hour} > 5   &&   {time.hour} < 20 == {true}

    but we don't need to add that since what we want to output (sunlight) is
    already a part of the conditional and will be displayed if the calculation
    is true or not displayed if it is false.

    Parens must be added to ensure that calculations take place in the correct
    order (and they wouldn't otherwise).

      ( ( {time.hour} > 5 ) && ( {time.hour} < 20 ) )

    And, of course, it's a calculation, so we also need square brackets.

    [ ( ( {time.hour} > 5 ) && ( {time.hour} < 20 ) ) ]

    So, if this is true, we want "sunlight" to come in through the skylight.
    Therefore "sunlight" is added, and the conditional is terminated.

    [ ( ( {time.hour} > 5 ) && ( {time.hour} < 20 ) ) ] sunlight |

    The lines after that should be pretty straightforward.

    One last thing is that characters can be "escaped" from by prefixing it
    with the "\" character.  This way, [], {}, and () can be displayed too.

    To see the results of using this take a look at the Example.

       Continents Main page        Table of Contents        Previous Topic        Next Topic