$total = $_POST['total'];
$skill = array( //This is the base level for the skill
"attack" => $_POST['attack'], //0
"strength" => $_POST['strength'], //1
"defence" => $_POST['defence'], //2
"range" => $_POST['range'], //3
"prayer" => $_POST['prayer'], //4
"magic" => $_POST['magic'], //5
"runecrafting" => $_POST['runecrafting'], //6
"construction" => $_POST['construction'], //7
"hitpoints" => $_POST['hitpoints'], //8
"agility" => $_POST['agility'], //9
"herblore" => $_POST['herblore'], //10
"thieving" => $_POST['thieving'], //11
"crafting" => $_POST['crafting'], //12
"fletching" => $_POST['fletching'], //13
"slayer" => $_POST['slayer'], //14
"hunter" => $_POST['hunter'], //15
"mining" => $_POST['mining'], //16
"smithing" => $_POST['smithing'], //17
"fishing" => $_POST['fishing'], //18
"cooking" => $_POST['cooking'], //19
"firemaking" => $_POST['firemaking'], //20
"woodcutting" => $_POST['woodcutting'], //21
"farming" => $_POST['farming'], //22
);
foreach($skill as $x => $x_value) {
if(!is_numeric($x_value)) {
die($skill , 'did not have a numeric value!');
}
else {
echo "Skill=" , $x , "Value=" , $x_value;
echo "<br>";
}
}
if(!isset($_GET['method')) { //if the method is not set,
$method = 'level'; //default it to level
}
elseif($_GET['method'] == 'experience') { //method is set to experience
$method = 'experience'; //set method to experience in the code
}
else { //nothing interesting happens
$method = 'level'; //set method to level anyway
}
function get_percentage($total, $number)
{
if ( $total > 0 ) { //total should be greater than 0
return round($number / ($total / 100),2); //formula to find percentage
} else {
return 0; //$total is less than 0
}
}
echo get_percentage($goal[0],$skill[0]).'%<br>';
echo get_percentage($total,$strength).'%<br>';
echo get_percentage($total,$defence).'%';
partial script for finding percentage to goal for runescape (oldschool)
yes i know it's a mess; im still working on it :)
yes i know it's a mess; im still working on it :)
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.