Site Tools
User Tools

Programming Tutorial VI - Raindrops Keep Falling On My Bonce - Weather, Part 1

You've got an outside area, be it sylvan woodland, grotty industrial estate, medieval courtyard, or something else. You've been into the master settings and set things up so that you get those nice background effects depending on the weather. Very nice. But you want something more. You want to have extra descriptions depending on the weather. Descriptions that you've written yourself. Here we will describe how to do that. We will start with a fairly crude example and then at the end talk briefly about how to make it more sophisticated.

First we'll have a little look at how the weather works. Hidden in the background of the Island is what's called a Weather Status Number. This is a number between one and seven. This number interacts with the game time clock to give forty nine different situations, as summarized with the following handy table that comes with the Weather Contrivance.

 Weather status numbers and what they mean.

How when and why the weather changes from one status number to another doesn't concern us here. All that matters is that the Weather Contraption is used to ask what value the Weather Status Number currently holds.

If we look at the weather table above, we notice that rain occurs when the Weather Status Number is five, six or seven. So what we want to set up is a program which asks: “Is the Weather Status 5,6 or 7?” and if the answer is “Yes” then show an extra page that you've decorated with your extra “It's raining!” description.

Well we can't quite use a Weather Contrivance like that. The way that the Contrivance works is that it has a parameter which you set to a single number from one to seven, say five, and then you have a Contrivance which asks “Is the Weather Status Number currently equal to five?” Since we are looking for three different numbers (five, six and seven) we need three Weather Contraptions, one for each number we want to check. We take these, and setting the parameters on these to five, six or seven, we place them in the programming grid, together with a Show Page Contraption (with parameter set to show the page with our new “It's raining!” description) as follows.

Note: As we said in an earlier tutorial, which order you put the weather contrivances in is unimportant, the program works identically whichever way round they go.

 It's raining!

C'est Voila! We have built our weather description program.

Suppose that you want to differentiate a little more. Two, three or even more extra page descriptions depending on the weather. Currently you can do this by having two, three or even more programs running in the room, one for each different page that might be displayed. There are ways round this, but they use tricks that have not yet been covered in the tutorials. See Tutorial IX for ideas about how to split the weather into two different groupings, each with their own page. See Advanced Tutorial I and its following tutorial for tips as to how to split the weather into three or more different groupings.

Note for budding programmers

Here we have used multiple conditions. There are three Weather Contrivances in the first row, all asking questions about the weather. If ANY one of these Contrivances answer 'Yes' then the row passes, the program goes onto the next row, and raindrop graphics are produced.

Your program is run one line at a time. If any Contraptions are found, then their instructions are carried out, any Contrivances found, and the relevant question is asked. If there are any Yes answers, or if there is a Contraption, then the next line of the program is run, otherwise the program is terminated. The best way of thinking about Contraptions is to think of them as always giving an automatic Yes answer.


The program logic can be summed up in the following diagram.

 Go with the flow!

Hang about a bit, what are those extra arrows going off to the right? And just what is that extra square there on the right hand side? That hasn't been covered in the tutorials yet! Well that's the Escape Hatch, and we'll deal with that in the next tutorial.


Go to next tutorial.
Return to previous tutorial.
Tutorial Contents Page
Return to Introduction to Programming.
Return to Places Overview

gameplay/guides/places/progtutvi.txt · Last modified: 2023/11/21 23:20 by kuhsodas