Greetings RPG Maker community, I apologies if I have missed something or put this in the wrong section. I've been a long time observer of these forums over the last few years and it has helped me to a great extent, But the time has come to come here myself and request your help personally. Thanks to Tsukihime for helping me over Facebook. Boring Intro Spoiler Anyway, I've been producing a Bitcoin inspired RPG game which is a hybrid Roleplaying-Simulation(Idle/Upgrade)-Strategy(Time managed), Production has been on-going for 7 months almost, Most of which has been fixing scripts to make them compatible with others and what-not. Usually every time I come to a halt due to bugs I can't comprehend myself, I find an answer pretty simply either on this forum or another. Anyway I've started dealing with mathematics in scripts within common events and I've came across an issue, I'm trying to make a variable hold a decimal value such as 0.0000001 by using: Spoiler $game_variables[1] = 10.0.to_f $game_variables[2] = $game_variables[1] * $game_variables[3] Control Variables: [0001AYOUT] /= 1000000 $game_variables[4] += $game_variables [1] Problem: When I do this the fourth variable ($game_variables[4]) holds the value of "1.0e-07", where it has moved only one decimal place, Then uses the number after: 'e-##' to display the number of decimals I'm supposed to have. It is really frustrating because I have had this working once before and when I tried to add one more decimal it's been errors in Game_Interpreter line 1411 (which I fixed) or other unprecedented bugs, like the one I'm experiencing. I'm sure I'm simply overlooking something and I would appreciate any person that can help me with forcing my fourth variable to have a value such as 0.00000001 > 100.99999999. Screenshots can be supplied if necessary. Thank you for taking the time to read this or reply. IBB

I'm gonna be honest here. I'm not 'entirely' sure what the problem is, so forgive me if my interpretation of this question is off the mark. It seems like you want to bypass scientific notation and just have Ruby print out the decimal places? If so, try: Code: $game_variables[1] = 10.00 $game_variables[2] = $game_variables[1] * $game_variables[3] $game_variables[1] /= 1000000.00 $game_variables[4] += $game_variables[1] $game_variables[4] = "%f" % $game_variables[4]

Thanks for taking the time to read my help request. The feature of my game utilizes these variables by displaying them on-screen in a custom HUD which is updated each in-game hour, upon setting the switches on as displayed in this gif. Spoiler To show amount of satoshi/bitcoin the player has earnt. My formula for displaying a variable seems to work up until a point, Then it throws out random fractions instead of what I want. I can display and store 0.00001 in a game_variable by floating one of the other variables, the smallest amount of Satoshi in real life situations is 0.00000001 so it would be ideal if I could use 8 decimal places after "0.", As I mentioned I'm having a bit of luck doing this with only 5 decimal points after "0." (for example 0.00034). But at 6am the value of that variables becomes a random fraction with many more decimals than I need. Spoiler I'm certain this is possible somehow, But I'm no proficient programmer. Hopefully this helps you understand my issue and what I want to achieve. Thanks IBB

Then it's as I thought. The solution I provided should override scientific notation. Look closely: Spoiler It's the same value, printed out as plain decimals in attempt two. I couldn't replicate your example exactly because I did not know the value of global variable #3, this should work regardless. Alternatively... Spoiler

Woah!! Thanks for the response, Taking the time to test out a solution and share it with me. Global Variable[3] is player controlled with value of 0(nothing invested) and up. That variable controls Hash/s printed out on-screen. So when the player buys a hash with "120/G" Hash/s increase by 1, The player can buy as many hashes as they want. Spoiler I pre-defined game_variable[1] separate to the rest of the 'multiplication script' which runs hourly in a common event. Spoiler $game_variable[1] refers in my game to [9]. I just decided to use 1-4 to simplify. No problem for me to change. Spoiler This is how the common event looks, with different [#numbers] albeit simple to copy and paste new code. I'm going to try your solution now. Once again, Thanks for the detailed answer. I'll let you know if it works on my end (Using the 8 decimal points (0.00000001 - 100.00000000)) IBB

Okay, upon extensive testing, I've concluded: Your solution to work well so far, except for one thing. It works perfectly for a division of 1000000.00, but not for a division only x100 more ($Var / 100000000.00). For example: Spoiler This provides this result, in-game: (also showing the control of a multiplication variable we've previously discussed control by the player on a PC, and now how and why I split the script we've been discussing into three parts. long events, looping long common events and an automatic event at the start of the game which pre-defines variables.) Spoiler It's worth noting once again, It works flawlessly with a lower division, hence not providing another long anomation. Thanks IBB

The bitcoin amount behaves pretty much like an integer that just happens to have the decimal point moved 8 positions. I recommend you have one variable containing the total amount of bitcoins counted in satoshi the player has. That is an integer value. Whenever you need to display it you can extract the two parts using the / and % operators. satoshi = amount % 10**8 bitcoins = amount / 10**8 *hugs* - Zeriab

Hi Zeraib, Thanks and hugs for dropping in, I currently have bitcoin and satoshi separated since the only way i could get it working at the start was by using whole numbers, Rinobi has given me the code change I needed to work within the limits VXa has, I guess anyway, So that way I can display Bitcoin as 1 variable in-game, anything higher than '0.99999999' could be called a full BTC, on the same line. Slightly confused with your code, mainly why use division and pct's. I've also never seen double '*' only double dots for arrays and using rand(#..#). I have to apologize for my lack of understanding It's weird how it doesn't work by adding an extra couple of 0's to the division scriptlet. Is there a way to show me how it works? i've got to duplicate the working code and adapt it over several events too :'( Thanks IBB

Alright. Ruby doesn't want to actually show us more than 6 decimals or so before switching to scientific notation. This is usually more convenient to read (assuming you know how), but under these circumstances, we actually want to print out 8 decimal places since the lowest possible value (satoshi?) for bitcoin is 0.00000001. That's my train of thought, here's my solution: Spoiler The page switches back and forth between adding 1 satoshi, and adding 1 bitcoin. With a value of 0, the display would read: 0.00000000 Adding 100 satoshis, the display would read: 0.00000100 Adding 250 bitcoin, the display would read: 250.00000100 I believe that accounts for the entire spectrum of possible bitcoin values. Basically... use "%0.08f" instead of "%f" to force the 8 decimal places. View attachment 43409