#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Is this possible

edited November 2012
First of all this has to be one of the best tools that a Game Master can have in his tool kit. I have used it to create tools for generating 'town gazette' of events, merchandise a merchant has in stock & pricing, treasure, and I am working on an outdoor encounter tool. I will probably post them but people need to realize they are extremely specific for my campaign world.

Now to my question. I would like to implement a random weather tool. In the game world Harn (http://columbiagames.com/harn/) there is a weather chart which is based on fractal generation. Basically the likelihood of today's weather being dramatically different than yesterday's weather is pretty low. The algorithm is
Initial setup is roll a d20 to pick the first weather event
Roll d6
1=subtract 1 from the previous roll, if the result is 0 then set the number to 20
2-3 = no change
4-5 = add 1 to previous roll, if the result is 21 then set the number to 1
6 = add 2 to previous roll, if result is > 20 then set the number to 1

Use the result to select the next weather event.

Repeat the process for each day in a month.

The dice rolling, variables, selecting from a table I can handle that pretty easily. The question is how to get it to 'loop' through a month (30 or 31 days) and remember the previous day's results. Now if I run this on a second month, then I start the process over again, I don't need to remember the result from the previous month.

## Comments

• This shouldnt be too difficult.

Set a variable at the top of the table, ie,

set:currentweather={1d20}

and then for each subsequent day, modify that value and then do a lookup for the weather conditions.

The key is to do all the days in one 'rep'. That is, actually do all the days you want to track in the table itself, rather than having each rep of the table be a separate date. So set MaxReps to 1.
• Thank you.

How do I do a 'loop' for all the days I want to do... In pseudo code it would be something like (I am deliberately NOT using valid syntax):

"set currentweather = random number between 1 and 20"

for days=1 to number of days in month loop
"Retrieve weather event based on currentweather"
"calculate fractal change"
"currentweather = currentweather + fractal change"
end loop

I know how to do all the stuff in ""s but I have no idea how to do a loop using the syntax available for Inspiration Pad Pro 3.0.

Thank you
David
• There's no actual 'loop' syntax. What you'd do is run a table X times.

So to run a table 365 times,
```Set: CurrentWeather={1d20}

Table: top
&#91;@365 GetWeather&#93;

Table: GetWeather
set: CurrentWeather==&#91;do whatever changes&#93;
&#91;#{CurrentWeather} GetConditions&#93;

Table: GetConditions
1:Rain
2:Snow
3:Partly Cloudy....
```

(that isnt tested for correctness)
• AH! Perfect...

Drop image/file