Programming advise?


Here is the formula for the calc. Defence + 2 + highest level out of Attack, Strength, Ranged, Magic or Summoning.

[php]function combatLevel($attack, $defence, $strength, $hp, $ranged, $magic, $summoning) {$base = ($defence + 2);
return intval($base + max($attack, $strength, $ranged, $magic, $summoning));[/php]

Then to display the level… ?

Not sure of your question? Are you asking how to display the results of your function?

If so, you call the function something like this:
$combat_results = combatLevel($attack, $defence, $strength, $hp, $ranged, $magic, $summoning);
(Where all of the variables are already set…

Then, the results is computated and placed into the “$combat_results” variable.
Therefore, you would just display that variable with an echo or print command.
echo $combat_results;

Not sure of your question, but, hope this helps…

Sponsor our Newsletter | Privacy Policy | Terms of Service