Yep, all you had to do was fix the typo.
In included the more readable randomizer with it.
Tested on RW.
In included the more readable randomizer with it.
Code:
<HTML>
<HEAD>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>Crown of the World Caravan Encounters</TITLE>
</HEAD>
<BODY>
<script language="JavaScript">
// Some Arrays
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
}
function rand(number) {
return Math.floor(Math.random() * number) + 1;
}
function tableResults(argument, rollModifier) {
var varisiaArray = [];
varisiaArray.push({"max": 5, "name": "Rough Terrain", "content": "a" });
varisiaArray.push({"max": 10, "name": "Cabin", "content": "b" });
varisiaArray.push({"max": 15, "name": "Erutaki Encampment", "content": "c" });
varisiaArray.push({"max": 20, "name": "Hungry Predators", "content": "d" });
varisiaArray.push({"max": 25, "name": "Horned Herd", "content": "e" });
varisiaArray.push({"max": 30, "name": "Wanderers", "content": "f" });
varisiaArray.push({"max": 35, "name": "Wrecked Caravan", "content": "g" });
varisiaArray.push({"max": 40, "name": "Dragon Sighting", "content": "h" });
varisiaArray.push({"max": 50, "name": "Blizzard", "content": "A bitter storm of driving wind and snow engulfs the caravan for 1d4 days. During this time, the caravan takes a –2 penalty to AC and on Attack and Security checks because of poor visibility and hostile weather. The caravan can make a DC 22 Security check each day to move at half speed during the blizzard. If the caravan fails the check by 4 or less, the caravan moves at one-quarter speed. If the caravan fails the check by 5 or more, it makes no progress. Casting control winds grants a +2 bonus on this check, while control weather grants a +4 bonus. When the blizzard ends, the deep drifts of snow it leaves behind are considered a Rough Terrain encounter (see page 17) for 1d4 days. XP Award: Award the PCs 3,200 XP for a blizzard encounter." });
varisiaArray.push({"max": 55, "name": "Aurora", "content": "The wondrous polar aurora ripples overhead at night for 1 week. This good omen grants the caravan a +2 bonus on Resolve checks for the duration of the aurora, and the caravan’s fortune-teller can use her reroll ability one additional time that week." });
varisiaArray.push({"max": 60, "name": "Wings of Hope", "content": "k" });
varisiaArray.push({"max": 65, "name": "Death from Below", "content": "l" });
varisiaArray.push({"max": 70, "name": "Creeping Rot", "content": "m" });
varisiaArray.push({"max": 76, "name": "Wagon Damage", "content": "n" });
varisiaArray.push({"max": 80, "name": "Ice Hunters", "content": "o" });
varisiaArray.push({"max": 85, "name": "Pleasant Weather", "content": "p" });
varisiaArray.push({"max": 90, "name": "Polar Pudding", "content": "q" });
varisiaArray.push({"max": 100, "name": "Frozen Dead", "content": "r" });
varisiaArray.push({"max": 105, "name": "Black Monolith", "content": "The caravan approaches a monolith of black stone that rises out of the ice to a height of 20 feet. This is one of the monoliths Katiyana has been placing across the Crown of the World to cement her control over the morozkos. Creatures: A Frozen Dead encounter always accompanies the discovery of a black monolith. In addition, there is a 50% chance that it is accompanied by a Blizzard encounter (see the next column)." });
varisiaArray.push({"max": 110, "name": "The Lonely Maiden", "content": "t" });
varisiaArray.push({"max": 115, "name": "Northern Lights", "content": "u" });
varisiaArray.push({"max": 120, "name": "Rough Terrain", "content": "v" });
varisiaArray.push({"max": 125, "name": "Crevasse", "content": "w" });
varisiaArray.push({"max": 130, "name": "Polar Mirage", "content": "x" });
varisiaArray.push({"max": 135, "name": "Black Slush", "content": "The caravan encounters a wide area of tainted snow and polluted eff luent. This acts as an open Crevasse encounter (see page 12), though casting water walk grants a +2 bonus on Security checks to cross the area. In addition, the caravan must make a DC 23 Security check once per hour while crossing or become poisoned by the toxic slurry, taking a cumulative –1 penalty to AC and on Attack checks for each failed check. These penalties can be removed with a successful DC 23 Security check when the caravan rests. Each healer in the caravan grants a cumulative +1 bonus on this check, and each casting of neutralize poison grants a +2 bonus on the check. Creatures: In addition, there is a 50% chance that an area of black slush is the hunting ground of a mated pair of chardas, xenophobic monstrous humanoids from the depths of the earth, who attack the caravan (AC 23; hp 115; Attack +18; Damage 8d8+4). The chardas can be avoided with two successful DC 19 Security checks. The chardas fight to the death. Treasure: The chardas maintain a lair in an ice cave below the black slush, which can be found with a DC 25 Survival check. Inside the lair are 34 uncut diamonds (worth 100 gp each), one of which is actually an air elemental gem. XP Award: Award the PCs 3,200 XP for a black slush encounter, and an additional 6,400 XP if they defeat the mated pair of chardas." });
varisiaArray.push({"max": 140, "name": "Auroral Flight", "content": "Creature: The caravan sees a strange, blue-green light on the northern horizon, sometimes streaking at high speed in straight lines, and at other times soaring in broad circles. This is a boreal yrthak, a f lying reptile that has adapted to life in the cold skies above the frozen wastes of the Crown of the World. The caravan can make a DC 24 Security check to avoid the boreal yrthak; otherwise, the creature notices the caravan and swoops in to attack, targeting individual creatures rather than the caravan itself." });
varisiaArray.push({"max": 145, "name": "Cold Gate", "content": "aa" });
varisiaArray.push({"max": 150, "name": "Hunting Party", "content": "ab" });
var allArrays = {
"varisia": varisiaArray,
};
if (!rollModifier) {
rollModifier = 0;
}
var randomNum = rand(100) + rollModifier;
var arrayOfChoices = allArrays[argument];
var error = "";
if (!arrayOfChoices) {
error = "no such set: " + argument;
}
var content = "";
var name = "";
for (var itemIndex in arrayOfChoices) {
var item = arrayOfChoices[itemIndex];
if (randomNum <= item.max) {
content = item.content;
name = item.name
break;
}
}
var results = [];
if (error) {
results.name = "";
results.content = error;
} else {
results.name = name;
results.content = content;
}
return results;
}
</script>
<div id="error"></div>
<form>
<input type="button" name="Button1" value="Outer Rim" onClick="var x = tableResults('varisia', 0);this.form.name.value=x.name;this.form.content.value = x.content;" size="" />
<input name="name" style="font-weight:bold;"></input>
<textarea name="content" cols="50" rows="11" wrap="soft"></textarea>
</form>
<form>
<input type="button" name="Button2" value="High Ice" onClick="var x = tableResults('varisia', 25);this.form.name.value=x.name;this.form.content.value = x.content;" size="" />
<input name="name" style="font-weight:bold;"></input>
<textarea name="content" cols="50" rows="11" wrap="soft"></textarea>
</form>
<form>
<input type="button" name="Button3" value="Boreal Expanse" onClick="var x = tableResults('varisia', 50);this.form.name.value=x.name;this.form.content.value = x.content;" size="" />
<input name="name" style="font-weight:bold;"></input>
<textarea name="content" cols="50" rows="11" wrap="soft"></textarea>
</form>
Tested on RW.