function iitems_stamina_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "iitems-use-item":
            if ($args['master']['stamina_add']) {
                require_once "modules/staminasystem/lib/lib.php";
                addstamina($args['master']['stamina_add']);
            } else {
                if ($args['master']['stamina_remove']) {
                    require_once "modules/staminasystem/lib/lib.php";
                    removestamina($args['master']['stamina_remove']);
                }
            }
            break;
        case "iitems-superuser":
            output("`bIItems: Stamina Support`b`n");
            output("`bstamina_add`b - add or remove Stamina points.`n`n");
            break;
    }
    return $args;
}
function staminafood_dohook($hookname, $args)
{
    global $session;
    switch ($hookname) {
        case "village":
            tlschema($args['schemas']['marketnav']);
            addnav($args['marketnav']);
            tlschema();
            switch ($session['user']['location']) {
                case "NewHome":
                    addnav("Joe's Diner", "runmodule.php?module=staminafood&op=start&location=nh");
                    break;
                case "Kittania":
                    addnav("Cool Springs Cafe", "runmodule.php?module=staminafood&op=start&location=ki");
                    break;
                case "New Pittsburgh":
                    addnav("BRAAAAAINS", "runmodule.php?module=staminafood&op=start&location=np");
                    break;
                case "Squat Hole":
                    addnav("Kebabs 'n' S***e", "runmodule.php?module=staminafood&op=start&location=sq");
                    break;
                case "Pleasantville":
                    addnav("Mutated Munchies", "runmodule.php?module=staminafood&op=start&location=pl");
                    break;
            }
            break;
        case "stamina-newday-intercept":
            if ($session['user']['age'] > 1) {
                //Remove the value of used Stamina from the player's Nutrition and Fat counters
                //Jokers do not have to eat, can do so if they want, but get no long-term benefit from doing so
                //Robots cannot eat, but don't suffer any effects from not doing so
                if ($session['user']['race'] != "Robot" && $session['user']['race'] != "Joker") {
                    debug("Nutrition:");
                    debug(get_module_pref("nutrition"));
                    debug("Fat:");
                    debug(get_module_pref("fat"));
                    debug("Fullness:");
                    debug(get_module_pref("fullness"));
                    require_once "modules/staminasystem/lib/lib.php";
                    $pctused = round(100 - get_stamina(3));
                    if ($pctused > 0) {
                        $newnu = get_module_pref("nutrition") - $pctused;
                        $newfa = get_module_pref("fat") - $pctused;
                        set_module_pref("nutrition", $newnu);
                        set_module_pref("fat", $newfa);
                    }
                    if (get_module_pref("fat") < -200) {
                        set_module_pref("fat", -200);
                    }
                    if (get_module_pref("nutrition") < -200) {
                        set_module_pref("nutrition", -200);
                    }
                    if (get_module_pref("fat") > 200) {
                        set_module_pref("fat", 200);
                    }
                    if (get_module_pref("nutrition") > 200) {
                        set_module_pref("nutrition", 200);
                    }
                }
                increment_module_pref("fullness", -100);
                if (get_module_pref("fullness") < -100) {
                    set_module_pref("fullness", -100);
                }
            }
            break;
        case "stamina-newday":
            if ($session['user']['race'] != "Robot" && $session['user']['race'] != "Gobot" && $session['user']['race'] != "Foebot" && $session['user']['race'] != "Joker" && $session['user']['race'] != "Stranger") {
                require_once "modules/staminasystem/lib/lib.php";
                //Output messages pertaining to the user's weight and fitness, apply buffs
                output("`nYou take a few moments to take stock of how you're looking and feeling.`n");
                $fat = get_module_pref("fat");
                $nut = get_module_pref("nutrition");
                debug($nut);
                debug($fat);
                if ($nut < 0 && $nut >= -20) {
                    output("`0You are feeling `4kinda weak and malnourished`0.  You lose some Stamina.`n");
                    removestamina(25000);
                }
                if ($nut < -20 && $nut >= -50) {
                    output("`0You are feeling `4more than a little weak and malnourished`0.  You lose some Stamina.`n");
                    removestamina(50000);
                }
                if ($nut < -50 && $nut >= -100) {
                    output("`0You are feeling `4very weak and ridiculously hungry`0.  You lose some Stamina.`n");
                    removestamina(100000);
                }
                if ($nut < -100) {
                    output("`0You are `4slowly dying of malnutrition`0.  You lose some Stamina.`n");
                    removestamina(200000);
                }
                if ($nut >= 0 && $nut < 50) {
                    output("`0You are feeling quite healthy!`n");
                }
                if ($nut >= 50 && $nut < 100) {
                    output("`0You are feeling `2well-nourished and content`0!  You gain some Stamina!`n");
                    addstamina(50000);
                }
                if ($nut >= 100) {
                    output("`0You are feeling `2strong and energetic`0!  You gain some Stamina!`n");
                    addstamina(100000);
                }
                if ($fat < 0) {
                    output("`0You are looking `2trim and slender`0!  You gain some Stamina!`n");
                    addstamina(50000);
                }
                if ($fat >= 0 && $fat < 20) {
                    output("`0You are looking pleasantly well-fed!`n");
                }
                if ($fat >= 20 && $fat < 50) {
                    output("`0You are looking `4a little bit round!`0  You lose a little Stamina.`n");
                    removestamina(25000);
                }
                if ($fat >= 50 && $fat < 100) {
                    output("`0You are looking `4pretty chunky!`0  You lose some Stamina.`n");
                    removestamina(50000);
                }
                if ($fat >= 100) {
                    output("`0You are looking... well, let's not mince words.  `4You're fat.  VERY fat.  You look like you just ate a schoolbus full of well-fed orphans`0.  You lose some Stamina.`n");
                    removestamina(100000);
                }
            }
            break;
        case "dragonkill":
            set_module_pref("nutrition", 0);
            set_module_pref("fat", 0);
            set_module_pref("fullness", 0);
            break;
    }
    return $args;
}
function example_run()
{
    //Yup, we're still gonna need that $session array!
    global $session;
    //If we don't declare a page header - IE a title for the page - then the page simply won't load.  At all.  The player will be left staring at a blank white screen and muttering "What muppet coded this?"  Never forget!
    page_header("Do the Three-Door Shuffle!");
    //We need to retrieve, from the database, the pref for whether or not the player's played today.  We'll need it soon.  Let's assign it to a variable - it'll save typing later on, and make the size of this file smaller.  While we're at it, let's get the other pref as well.
    $playedtoday = get_module_pref("playedtoday");
    $playedtotal = get_module_pref("playedtotal");
    //httpget lets us grab a part of the page's URL.  The first time the player encounters this module, they'll go to "improbableisland.com/runmodule.php?module=example[which is the filename of the module without the .php bit, remember]" - note the conspicuous absence of 'op' in there.  As they move through the pages, they'll go to "improbableisland.com/runmodule.php?module=example&op=[something]".  It's that [something] that we want to get!  We traditionally call the variable 'op' which is short for 'operation,' but you can call it whatever you like.  You can even get fancy and use multiple httpget requests for more complex modules with addresses like "improbableisland.com/runmodule.php?module=breaktheserver&action=breakitagain&weapon=axe&target=harddrive&force=allofitbabyyeah", but this module's just about the basics.
    //Oh, and you remember "switch", right?  You met earlier.
    switch (httpget('op')) {
        default:
            //We're talking now about an instance where there is no 'op' in the page's URL.  This must mean that the player's on the first page of the module.  let's set the scene!
            //Our first output statement!  This is like echo, but it's actually a special function built into Legend of the Green Dragon which will put in our colour codes and make sure we're not doing anything silly.
            output("`0Some old Joker geezer shows you three doors, and says that there's something nice or nasty behind each one.  Whatever, we'll put some proper flavour text in here later.  This module would `inever`i have gotten past CavemanJoe with flavour text this lame.  God, he's such an asshole.  Good thing he won't be reading this.`n`nAnyway, we're using tilde-n for new lines.  Just testin' that.  And when we want to output something in quotation marks, we have to escape it with a slash, like this:`n`n\"`3Come and look in my doors!`0\" shouts the old geezer.  Traditionally characters' colour codes will change only inside their quotation marks, descriptive text will usually be black, and the player's text will usually have colourcode #.  So, you've got three doors in front of you; now whatcha gonna do about it?  HUH?`n`n");
            //Now, let's see how to add in a variable in an output statement... Damn, I'm making this sound a lot more complicated than it actually is.  Just read it, it'll be quicker than me trying to explain it.  We use %s as placeholders for our variables.
            output("You've played a total of %s times.`n`n", $playedtotal);
            //If we want to do more than one variable in an output statement, we basically just use more %s's and more commas:
            output("I SAID, you've played a total of %s times.  That's %s times!`n`n", $playedtotal, $playedtotal);
            //You remember if statements, right?  Of course you do.
            if ($playedtoday == 0) {
                //They haven't played today, so let's give them some links to click.
                addnav("Open the first door!", "runmodule.php?module=example&op=door1");
                addnav("Open the second door!", "runmodule.php?module=example&op=door2");
                addnav("Open the third door!", "runmodule.php?module=example&op=door3");
            } else {
                //give them an unclickable link that goes nowhere!
                addnav("I'm not gonna do jack, pal.  I've already done this today.", "");
            }
            break;
        case "door1":
            //The player went for the first door.  Now, let's give the first door a fifty-fifty chance of something nice versus something nasty.
            //Gimme a random number between one and a hundred, and we'll call it $chance:
            $chance = e_rand(1, 100);
            //is the random number less than or equal to fifty?
            if ($chance <= 50) {
                //yes, the random number is less than or equal to fifty.  Output some flavour text!
                output("You've won some gold OH MY GOODNESS I MEAN REQUISITION.  Proper flavour text for that picky bastard Admin CavemanJoe.`n`n");
                //Give the player five gold pieces, because the game doesn't know that we call gold Requisition!  That'll help them in their quest to slay the dragon I MEAN THE IMPROBABILITY DRIVE
                $session['user']['gold'] += 5;
            } else {
                //$chance is NOT equal to or less than fifty.  In other words, it's 51 or more!
                output("A midget steals some Requisition or something.`n`n");
                //Oh dear - what happens if the player has LESS than 5 Requisition?  They'll get a negative number showing in their stats bar!  It'll get sorted out back to zero on their next page load, but in the meantime it just looks ugly!  So, we'll do another IF statement.  This one's fairly self-explanatory:
                if ($session['user']['gold'] >= 5) {
                    $session['user']['gold'] -= 5;
                } else {
                    $session['user']['gold'] = 0;
                }
            }
            //What are we forgetting?  The player has played today, so we must update their pref so they can't play again!
            set_module_pref("playedtoday", 1);
            //Now, we'll increase the number of times they've played by one.
            increment_module_pref("playedtotal", 1);
            //There isn't a decrement_module_pref function - if we wanted to take one away, we'd do the same as we've just done, but make the final argument -1 instead.
            //and that's the end of door number one!
            break;
        case "door2":
            //door one was a bit boring.  A bit low-stakes.  A bit dull.  Let's play with the numbers and liven things up a bit.
            $chance = e_rand(1, 100);
            if ($chance <= 10) {
                output("You open the door and a cigarette falls out, followed by two hundred and fifty Requisition tokens!  How very Improbable.`n`n");
                $session['user']['gems']++;
                $session['user']['gold'] += 250;
                //Yes, cigarettes were originally gems in Legend of the Green Dragon!
            } else {
                //Since getting a cigarette AND a couple of hundred Req is a pretty awesome prize, we're only giving it a ten per cent chance of appearing.  The other ninety times out of a hundred, the Cake or Death guy shows up and gives you some poisoned cake.  This code is lifted pretty well straight out of the code for Cake or Death.
                //The Cake or Death man doesn't exactly KO the player.  When you KO a player, you have to mess about with taking away all their navs and making sure they end up on the FailBoat's Daily News page, and it's a bit of a pain in the bum.  So I like to just poison the crap out of them instead! :D
                output("You open the door to find a green-eyed gentleman standing behind it.  He hands you a slice of cake, on a paper plate!  You thank him, and walk away merrily wolfing down your prize.`n`nYou feel `5Full Of Cake!`0`n`nMoments later, the slow-acting poison starts to take effect.  The world begins to melt in front of you.  Grey spots dance on the edges of your vision.  Behind you, a green-eyed monster offers you another slice of cake, laughing and pointing.`n`nYou curse your luck as the hallucinations begin to kick in.");
                //We're gonna do an example buff now.  I could type about this all night, but you can learn more about buffs at http://wiki.dragonprime.net/index.php?title=Buffs.
                apply_buff('failcake', array("name" => "`5Full Of FailCake`0", "rounds" => -1, "regen" => -10, "startmsg" => "`5You are walking on pink icing.  The sky is made of jam.  Your eyes are two cherries.  That cake was awesome.`0`n", "roundmsg" => "`5The poisoned cake saps your strength, and you lose ten hitpoints!`0`n", "schema" => "module-cakeordeath"));
            }
            //What are we forgetting?  The player has played today, so we must update their pref so they can't play again!
            set_module_pref("playedtoday", 1);
            //Now, we'll increase the number of times they've played by one.
            increment_module_pref("playedtotal", 1);
            //There isn't a decrement_module_pref function - if we wanted to take one away, we'd do the same as we've just done, but make the final argument -1 instead.
            //We're done with Door Two!
            break;
        case "door3":
            //in Door 3 we'll be interacting with my Stamina system.  The Stamina system isn't part of Legend of the Green Dragon - in LotGD, and in Improbable Island prior to Season Two, we used Turns instead.  I've designed the Stamina system to be very easy to use!  Adding and removing Stamina is a piece of cake - just use the functions addstamina(x); or removestamina(x);, where x is the number of Stamina points to add or remove.
            //since the Stamina system is in itself a (rather large) module and not part of the core, whenever we want to use it we've got to tell the game to find its lib file so it knows what we're talking about when we use its functions.  So, let's do that:
            require_once "modules/staminasystem/lib/lib.php";
            //Now we can get on with it, knowing that our functions for interacting with Stamina are already loaded.
            $chance = e_rand(1, 100);
            //We'll make this door rather a nice door.  Most of the time, anyway.
            if ($chance <= 90) {
                output("You open the door and a soft white light envelopes you.  You feel mildly energized.  You gain some Stamina!`n`n");
                addstamina(5000);
                //See how easy that was?
            } else {
                //But every now and then, this door will be an absolute bastard.
                output("You open the door and a huge round boulder comes rolling out!  You lose a whole load of Stamina running away from it, until you gain the common sense to just step out of its way!`n`n");
                removestamina(50000);
                //We don't even need to check if the player has 50,000 Stamina points to take away, because the Stamina system is clever and checks for us!
            }
            //What are we forgetting?  The player has played today, so we must update their pref so they can't play again!
            set_module_pref("playedtoday", 1);
            //Now, we'll increase the number of times they've played by one.
            increment_module_pref("playedtotal", 1);
            //There isn't a decrement_module_pref function - if we wanted to take one away, we'd do the same as we've just done, but make the final argument -1 instead.
            //And that's it for door number three!
            break;
    }
    //Now, we're at the end of our possible decisions and outcomes.  Because we're out of the switch, we can add in some things that we'll always need, in this module anyway.  We'll give the player a link to take them back to the player-created modules area, so that they can get out of this module, and we'll call page_footer so that all of this information is displayed to the player.
    addnav("Go back where you came from", "runmodule.php?module=labs");
    //If we don't call page_footer, none of what we've just coded up will be shown to the player!  This is just as important as page_header!
    page_footer();
    //...and we're done!  I hope you've enjoyed reading along in this module and learning about programming for Improbable Island and Legend of the Green Dragon!
    //So, what can you do with what you already know?  Well, how about modifying this very file?  Here are some things for you to try:
    //1.  (easy) Add a fourth door.  That should be pretty easy!  But what to put behind it?  Maybe it can give different sorts of buffs?  The Buffs page in the DragonPedia will help you.  Use your imagination!
    //2.  (easyish) Right now, that counter is just a counter, nothing more.  Surely we could do something interesting with that!  Maybe, after playing the game more than x number of times, a fifth or even sixth door will become available?
    //3.  (harder) Maybe the number of times the game has been played can affect the player's luck?  How would you do that?
    //4.  (harder) By adding another pref in the moduleinfo function, we can make this module more complex and exciting.  A simple boolean pref could, for example, determine whether a player has an item or not - a key to the seventh door, for example...
    //Have fun!
}
// unset($charstat_info['Vital Info']['Turns']);
// }
// if (isset($charstat_info['Vital Info']) && isset($charstat_info['Vital Info']['Spirits'])){
// unset($charstat_info['Vital Info']['Spirits']);
// }
// if (isset($charstat_info['Extra Info']) && isset($charstat_info['Extra Info']['Free Travel'])){
// unset($charstat_info['Extra Info']['Free Travel']);
// }
//Look at the number of Turns we're missing.  Default is ten, and we'll add or remove some Stamina depending, as long as we're not in a fight.
if (get_module_setting("turns_emulation_base") != 0) {
    if (!isset($badguy)) {
        $stamina = e_rand(get_module_setting("turns_emulation_base"), get_module_setting("turns_emulation_ceiling"));
        while ($session['user']['turns'] < 10) {
            $session['user']['turns']++;
            debug("Turns Removed");
            removestamina($stamina);
        }
        while ($session['user']['turns'] > 10) {
            $session['user']['turns']--;
            debug("Turns Added");
            addstamina($stamina);
        }
    }
}
if (!isset($charstat_info['Recent Actions'])) {
    //Put yer thing down, flip it an' reverse it
    $yarr = array_reverse($charstat_info);
    $yarr['Recent Actions'] = array();
    $charstat_info = array_reverse($yarr);
}
if (isset($actions_used)) {
function stamina_take_action_cost($action, $userid = false)
{
    global $session;
    if ($userid === false) {
        $userid = $session['user']['acctid'];
    }
    $totalcost = stamina_calculate_buffed_cost($action, $userid);
    removestamina($totalcost, $userid);
    return $totalcost;
}
function racerobot_run()
{
    global $session;
    page_header("Overclocking Configuration");
    $from = httpget('from');
    switch (httpget('op')) {
        case "config":
            output("You sit down and open up your chest panel.  Inside is a row of variable resistors which increase power to various subsystems.  You can adjust the resistors to enhance your performance in combat, albeit with some tradeoffs - applying too much voltage will result in catastrophic overheating.`n`nYou mull over your decisions carefully.`n`n");
            break;
        case "atkinc":
            output("You twist the Upper Torso Servo Voltage VR clockwise.  You feel a rush of extra burning energy in your arms.  This should help with your attack power.`n`n");
            increment_module_pref("atk");
            break;
        case "atkdec":
            output("You twist the Upper Torso Servo Voltage VR anti-clockwise.  You feel your attack power drain away a little.`n`n");
            increment_module_pref("atk", -1);
            break;
        case "definc":
            output("You twist the Lower Torso Servo Voltage VR clockwise.  You feel a rush of extra burning energy in your legs, making you lighter on your feet and better able to step out of the way of impending fists and claws.`n`n");
            increment_module_pref("def");
            break;
        case "defdec":
            output("You twist the Lower Torso Servo Voltage VR anti-clockwise.  Your legs feel more sluggish, and you have a feeling you won't be able to dodge blows from enemies as easily.`n`n");
            increment_module_pref("def", -1);
            break;
        case "healinc":
            output("You twist the Damage Repair Subsystem CPU Voltage VR clockwise.  You feel the extra threads rushing through you, ready to heal your glass skin during battle.`n`n");
            increment_module_pref("heal");
            break;
        case "healdec":
            output("You twist the Damage Repair Subsystem CPU Voltage VR anti-clockwise.  The CPU controlling your in-combat self-healing abilities lowers its speed by a few megahertz.  You feel slightly uneasy and vulnerable.`n`n");
            increment_module_pref("heal", -1);
            break;
        case "standby":
            $heat = get_module_pref("heat");
            require_once "modules/staminasystem/lib/lib.php";
            switch (httpget('til')) {
                case "repaired":
                    output("You go into Standby Mode, reducing every system process to the bare minimum required to stay alive, and activate your self-healing routine.  The cracks in your glass skin begin to shorten in jagged little hops.`n`nThe sound of glass mending itself is, oddly enough, rather similar to the sound of glass breaking.`n`nYour subsystems cool down too, with little plinks and pops.`n`n");
                    $hp = $session['user']['maxhitpoints'] - $session['user']['hitpoints'];
                    $s = 0;
                    for ($i = 0; $i < $hp; $i++) {
                        $session['user']['hitpoints']++;
                        $heat -= 10;
                        $s += 400;
                    }
                    removestamina($s);
                    output("When consciousness returns, your Hitpoints have been restored to full and your internal systems have cooled down a little.  You have used `Q%s`0 Stamina points (about `Q%s`0%% of total Stamina).`n`n", number_format($s), $s / 1000000 * 100);
                    break;
                case "cooled":
                    output("You go into Standby Mode, reducing every system process to the bare minimum required to stay alive, and activate your self-healing routine.  The cracks in your glass skin begin to shorten in jagged little hops.`n`nThe sound of glass mending itself is, oddly enough, rather similar to the sound of glass breaking.`n`nYour subsystems cool down too, with little plinks and pops.`n`n");
                    $j = $heat / 10;
                    $s = 0;
                    for ($i = 0; $i < $j; $i++) {
                        $session['user']['hitpoints']++;
                        $heat -= 10;
                        $s += 400;
                    }
                    removestamina($s);
                    output("When consciousness returns, your Hitpoints have increased and your internal systems have cooled down to normal operating temperatures.  You have used `Q%s`0 Stamina points (about `Q%s`0%% of total Stamina).`n`n", number_format($s), $s / 1000000 * 100);
                    break;
            }
            if ($session['user']['hitpoints'] > $session['user']['maxhitpoints']) {
                $session['user']['hitpoints'] = $session['user']['maxhitpoints'];
            }
            if ($heat < 0) {
                $heat = 0;
            }
            set_module_pref("heat", $heat);
            strip_buff('robotoverheat');
            break;
    }
    $atk = get_module_pref("atk");
    $def = get_module_pref("def");
    $heal = get_module_pref("heal");
    $buff = get_module_pref("buff");
    $heat = get_module_pref("heat");
    addnav("Upper Torso Servo Voltage");
    addnav("Increase", "runmodule.php?module=racerobot&op=atkinc&from=" . $from);
    if ($atk > 0) {
        addnav("Decrease", "runmodule.php?module=racerobot&op=atkdec&from=" . $from);
    }
    addnav("Lower Torso Servo Voltage");
    addnav("Increase", "runmodule.php?module=racerobot&op=definc&from=" . $from);
    if ($def > 0) {
        addnav("Decrease", "runmodule.php?module=racerobot&op=defdec&from=" . $from);
    }
    addnav("Damage Repair Subsystem CPU Voltage");
    addnav("Increase", "runmodule.php?module=racerobot&op=healinc&from=" . $from);
    if ($heal > 0) {
        addnav("Decrease", "runmodule.php?module=racerobot&op=healdec&from=" . $from);
    }
    // addnav("Combat Analysis Module RAM Voltage");
    // addnav("Increase","runmodule.php?module=racerobot&op=buffinc&from=".$from);
    // if ($buff>0) addnav("Decrease","runmodule.php?module=racerobot&op=buffdec&from=".$from);
    addnav("Standby Mode");
    if ($session['user']['hitpoints'] < $session['user']['maxhitpoints']) {
        $scost = 400 * ($session['user']['maxhitpoints'] - $session['user']['hitpoints']);
        $spct = $scost * 100 / 1000000;
        addnav(array("Standby until Repaired (`Q%s%%`0)", $spct), "runmodule.php?module=racerobot&op=standby&til=repaired&from=" . $from . "", true);
    }
    if ($heat > 0) {
        $scost = 40 * $heat;
        $spct = $scost * 100 / 1000000;
        addnav(array("Standby until Cooled (`Q%s%%`0)", $spct), "runmodule.php?module=racerobot&op=standby&til=cooled&from=" . $from . "", true);
    }
    addnav("Close chest panel");
    switch ($from) {
        case "village":
            addnav("Return to the Outpost", "village.php");
            break;
        case "forest":
            addnav("Return to the Jungle", "forest.php");
            break;
        case "worldnav":
            addnav("Return to the Wilderness", "runmodule.php?module=worldmapen&op=continue");
            break;
    }
    $atk = get_module_pref("atk");
    $def = get_module_pref("def");
    $heal = get_module_pref("heal");
    $buff = get_module_pref("buff");
    $heat = get_module_pref("heat");
    output("`bCurrent settings:`b`n");
    output("Upper Torso Servo Voltage: +%sv`n", $atk * 10);
    output("Lower Torso Servo Voltage: +%sv`n", $def * 10);
    output("Damage Repair Subsystem CPU Voltage: +%sv`n", $heal * 10);
    // output("Combat Analysis Module RAM Voltage: +%sv`n",$buff*10);
    if (get_module_pref("atk") > 0) {
        $batk = get_module_pref("atk") / 10 + 1;
        apply_buff("robotatkoc", array("name" => "`7Overclock: Increased Upper Body Servo Power`0", "atkmod" => $batk, "allowinpvp" => 1, "allowintrain" => 1, "rounds" => -1, "schema" => "module-racerobot"));
    } else {
        strip_buff("robotatkoc");
    }
    if (get_module_pref("def") > 0) {
        $bdef = get_module_pref("def") / 10 + 1;
        apply_buff("robotdefoc", array("name" => "`7Overclock: Increased Lower Body Servo Power`0", "defmod" => $bdef, "allowinpvp" => 1, "allowintrain" => 1, "rounds" => -1, "schema" => "module-racerobot"));
    } else {
        strip_buff("robotdefoc");
    }
    if (get_module_pref("heal") > 0) {
        $bheal = get_module_pref("heal");
        apply_buff("robothealoc", array("name" => "`7Overclock: In-Combat Self-Repair Subsystem`0", "regen" => $bheal, "effectmsg" => "`#SYSTEM MESSAGE: {damage} POINTS OF DAMAGE AUTO-REPAIRED`0", "allowinpvp" => 1, "allowintrain" => 1, "rounds" => -1, "schema" => "module-racerobot"));
    } else {
        strip_buff("robothealoc");
    }
    page_footer();
}