:: StoryTitle Space Exploration in Snowman :: UserScript[script] // Create a global setup object window.setup = window.setup || {}; // Add 'variables' object to setup window.setup.variables = {}; var _vars = window.setup.variables; _vars.health = 20; _vars.fuel = 4; _vars.system = []; _vars.numberOfJumpsLeft = 10; // Create global functions window.setup.functions = {}; var _functions = window.setup.functions; _functions.redOutcome = function() { var _vars = window.setup.variables; var _percentage = _.random(1, 10); var response = ""; if( _percentage >= 6) { var _foundHealth = _.random( 1, 5); var _foundFuel = _.random( 1, 3); response = "The hostile environment damaged the ship, but extra fuel was found. -" + _foundHealth + " to health and +" + _foundFuel + " to fuel."; _vars.health -= _foundHealth; _vars.fuel += _foundFuel; } else { if( _percentage <= 3) { var _foundHealth = _.random(2, 7); response = "A hostile ship attacked. -" + _foundHealth + " to health"; _vars.health -= _foundHealth; } else { response = "Nothing happened." } } return response; }; _functions.greenOutcome = function() { var _vars = window.setup.variables; var _percentage = _.random(1, 10); var response = ""; if( _percentage == 1) { var _foundFuel = _.random( 1, 2); response = "Fuel was found in some wreckage. + " + _foundFuel + "to fuel"; _vars.fuel += _foundFuel; } else { if( _percentage >= 6) { var _foundHealth = _.random(1, 3); response = "During a brief pause, the ship was able to be repaired. +" + _foundHealth + " to health"; _vars.health += _foundHealth; } else { response = "Nothing happened." } } return response; }; :: UserStylesheet[stylesheet] :: Start [[Explore Space|Explore Space 1]] :: Explore Space 1