Jump to content
MakeWebGames

Ok so this has been posted before, but I CANT FIND IT


Recommended Posts

Posted

Well, to be honest, I've never seen/worked/coded the McCode stuff.....

So my "advice" is not exactly useful :P

But, if you have a percent, you can easily convert it into a fraction out of 100(lets say).(percent already gives you a fraction out of 100)

Ex: you have 9.65%; it is equal to 9.65 out of 100 (9.65/100)

If you have the numbers, you can easily convert it into percents.(numerator divided by denominator = percent)

Ex: now you have 25 whatever, your maximum is 100; 25 / 100 = 25%

Don't get mad if it's not what you asked for :)

And then, you can simply echo off both of them wherever you want.

echo $stat[percent]."% || ".$stat[now]." / ".$stat[maximum];

where $stat is your variable with the energy/brave/etc; percent = %, now is what you have now, maximum is the maximum amount.

Yeahhh....

~Ultima

P.S.

I'm bored, so don't mind my childish explanation, don't have anything better to do.

Posted

header.php

You'll see something like:

$enperc=(int) ($ir['energy']/$ir['maxenergy']*100); 
$wiperc=(int) ($ir['will']/$ir['maxwill']*100); 
$experc=(int) ( $ir['exp']/$ir['exp_needed']*100); 
$brperc=(int) ($ir['brave']/$ir['maxbrave']*100); 
$hpperc=(int) ($ir['hp']/$ir['maxhp']*100); 
$enopp=100-$enperc; 
$wiopp=100-$wiperc; 
$exopp=100-$experc; 
$bropp=100-$brperc; 
$hpopp=100-$hpperc;

 

Then further down:

<LI>[b]Energy:[/b] {$enperc}% <a href=crystaltemple.php?spend=refill>[R]</a>

[img=/images/endleft.gif][img=/images/barsilver.gif][img=/images/redbar.png][img=/images/endright.gif]

<LI>[b]Will:[/b] {$wiperc}%

[img=/images/endleft.gif][img=/images/barsilver.gif][img=/images/redbar.png][img=/images/endright.gif]

<LI>[b]Brave:[/b] {$ir['brave']}/{$ir['maxbrave']}

[img=/images/endleft.gif][img=/images/barsilver.gif][img=/images/redbar.png][img=/images/endright.gif]

<LI>[b]EXP:[/b] {$experc}%

[img=/images/endleft.gif][img=/images/barsilver.gif][img=/images/redbar.png][img=/images/endright.gif]

<LI>[b]Health:[/b] {$hpperc}%

[img=/images/endleft.gif][img=/images/barsilver.gif][img=/images/redbar.png][img=/images/endright.gif]
<hr /> 

 

EXP prints {$experc}%.

Brave prints {$ir['brave']}/{$ir['maxbrave']}.

The second is what you want. Use the variable in the first box to print. Example:

EXP should print {$ir['exp']]/{$ir['exp_needed']}, not {$experc}%

etc

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...