ID:273240
Dec 25 2009, 6:34 pm
|
|
How do you portray the percentage of a var, such as [health]/[max_health].
|
In response to Hi1
|
|
This just displays the [health] var.
|
In response to Dark Prince X
|
|
max_health is always 100%...right...?
|
In response to Dark Prince X
|
|
In response to Hi1
|
|
No.
|
In response to Dark Prince X
|
|
In response to Dark Prince X
|
|
ok this is how you calculate a percentage.
if your character has 100 Health points when they have full HP. then that means their Max Health is 100. divide current health by max health and multiply that by 100. it will give you the current percentage of your characters health. this is what it looks like in code var/currentHpPerc=(Hp/MaxHp)*100 |
If your problem still isn't solved, here's a basic code =P
mob |
In response to Dariuc
|
|
No, the "key" is not the parentheses. The result is the same regardless of those parentheses. Perhaps you need to read up on your order of operations.
|
In response to Hi1
|
|
Please take note that the compiler cannot calculate expressions in a variable definition like that. To do so would need to be placed inside a New() override.
mob/var |
In response to Spunky_Girl
|
|
yep your right perhaps i do.
just wondering why everyone on this board is so... rude. is that a habit of people who code or program? to just assume someone is a newb because they don't know as much as you or forget little things here and there? and it would be a key point if he didn't have a multiplier and divider on the same line. the parentheses force which one you want done first. its kind of like insurance :P |
In response to Dariuc
|
|
Coders assume everybody is stupid.
Just like pixel artists assume everything they do is worth $1mil Its kind of because they are god-likes when coding, do w/e they please and make things happens the way they want And spunky girls, you don't need to make it a var just to display it mob/Login() //Can be used anywhere tho, but since this is an example.. Talk to me over msn if you need further help (you already have it ;o) |
In response to Abrax
|
|
He never said how he planned to use it. I'm not psychic. I provided the most universal method I could think of. Which in this case, is a variable.
<sarcasm> We just love to make lesser beings feel like idiots when we show them up with our obvious superior intellect. Your less-than-obvious prejudice against programmers and pixel artists couldn't be more correct. </sarcasm> |
Hope that helped!
P.S.
This is the guy that just IMed you asking if you needed coding help. xD