RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
How to do Percents with decimals?

0 Members and 2 Guests are viewing this topic.

***
Rep:
Level 82
We learn by living...
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.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Multiply it by 100 first then. You can also use floats.

$game_variables[408]*1100 / $game_variables[410]

***
Rep:
Level 82
We learn by living...
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.

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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.

***
Rep:
Level 82
We learn by living...
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?

*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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.


********
Hungry
Rep:
Level 96
Mawbeast
2013 Best ArtistParticipant - GIAW 11Secret Santa 2013 ParticipantFor the great victory in the Breakfast War.2012 Best Game Creator (Non-RM Programs)~Bronze - GIAW 9Project of the Month winner for December 2009Project of the Month winner for August 20082011 Best Game Creator (Non RM)Gold - GIAW Halloween
what do you need exact decimals for, btw?

FCF3a A+ C- D H- M P+ R T W- Z- Sf RLCT a cmn+++ d++ e++ f h+++ iw+++ j+ p sf+
Follow my project: MBlok | Find me on: Bandcamp | Twitter | Patreon