How do I get something like this:
$game_variables[409] =
(($game_variables[408] * 11) /
$game_variables[410]) * 100
to work without the program totally screwing up the decimals?
for example, if var[408] is 10,
and var[410] is 120, I should get something that looks like 110/120 = 0.916...
that then gets converted into a percentage like 91.6%
obviously that's not what XP is doing, since it likes whole numbers.
Multiply it by 100 first then. You can also use floats.
$game_variables[408]*1100 / $game_variables[410]
Quote from: modern algebra on June 07, 2010, 11:49:59 AM
Multiply it by 100 first then. You can also use floats.
$game_variables[408]*1100 / $game_variables[410]
I realized something like this about 5 am this morning but was too delirious to do anything about it (finals week). I was going to multiply everything by 10,000 first.
What's a floater?
I've heard of setting up variables A,B,C,D...for place holders.
If you enter in:
$game_variables[xxxx] += 100, RPG Maker will automatically round to the nearest whole number. However, if you enter in $game_variables[xxxx] += 100.00, RPG Maker will automatically round to the nearest hundredth.
Basically, anything with a decimal point is a floating point number.
Quote from: cozziekuns on June 07, 2010, 03:41:28 PM
If you enter in:
$game_variables[xxxx] += 100, RPG Maker will automatically round to the nearest whole number. However, if you enter in $game_variables[xxxx] += 100.00, RPG Maker will automatically round to the nearest hundredth.
Basically, anything with a decimal point is a floating point number.
do you think there's a way to set up Input number to have the option of decimals?
Well, you could always just divide the variable by 100.00 (Zero's depend on how many places your willing to round of by) later.
what do you need exact decimals for, btw?