Weather

version 3/080914 by Ish McGravin

  • Home page
  • Beginning
  • Previous



  • Example: ** The Weather Observation Station - A fairly simple implementation of several of the weather simulation utilities. The example has only two rooms, but room descriptions change depending on time of day and weather conditions. A "wait [number] minutes" command is included to facilitate date testing.

        "Weather Station Zero"

        Include Weather by Ish McGravin.

        When play begins: change the command prompt to "[time of day] ([if it is night]nighttime[otherwise]daytime[end if] and [WDesc]) - [Name in row Month of Table of Months] [day], [year] - [if it is night][NTemp][otherwise][DTemp][end if]F > ".

        When play begins:
            now the year is 2007;
            now the day is 7;
            now the month is 4;
            now the time of day is 6:00 PM.

        Waiting for is an action applying to one number. Understand "wait [number] minutes" as waiting for. Carry out waiting for: repeat with X running from 1 to the number understood begin; follow the turn sequence rules; end repeat.

        Outdoors, indoors are regions.

        The sun is a backdrop in the outdoors. The description is "[if it is night]The sun is down, silly. It is night time![otherwise if weather is greater than 5]The sun is hidden behind a solid wall of clouds.[otherwise if weather is greater than 3]The sun occasionally peeks out from behind one of the many scattered clouds.[otherwise if DTemp is less than 61]The sun shines brightly down, warming your face.[otherwise]The sun shines brightly down, making you sweat a little.[end if]".

        Observation Point is a room. It is in the outdoors. The description is "The sky is [if weather is greater than 3]filled with clouds [otherwise]clear [end if]and [if it is night]dark[otherwise]light[end if]. [if it is night][otherwise]The sun is out. [end if][if snow is on the ground]A blanket of snow covers the ground. [end if]It takes about an hour to walk back to the weather observation station to the [bold type]west[roman type].".

        Before going west from Observation Point: repeat with X running from 1 to 59 begin; follow the turn sequence rules; end repeat; continue the action. Before going east to Observation Point: repeat with X running from 1 to 59 begin; follow the turn sequence rules; end repeat; continue the action.

        Weather Station is west of Observation Point. It is a room in the indoors. It has printed name "Inside the Weather Station". The description is "A readout shows the outside temperature as [if it is night][NTemp][otherwise][DTemp][end if]F. One of the meteorologists has noted that the weather conditions and temperature change once an hour. You can [quotation mark]wait X minutes[quotation mark] until the weather shifts. We encourage you to go outside and [quotation mark]examine the sun[quotation mark]. It takes about an hour to walk to the observation point to the [bold type]east[roman type].".