need help with my bank system

I'm using RPG Maker VX Ace

I'm trying to make a bank system where when you deposit say 100 gold, then it will subtract 10% and thus deposit a total

of 90 gold.  My problem is when it comes to calculations, I can't use decimals such as .9 (im using script calls to do these

calculations)

I've tried using this

$game_variables[003] *= .9

it works, but the problem is it returns as a decimal, so if variable 3 = 100, then it would become 90.0

ive tried using round and to_i but those have no affect

I then tried making a new variable like this

$game_variables[006] = $game_variables[003]

$game_variables[003] *= .1

$game_variables[006] -= ($game_variables[003].round)

but this then makes the variable show up as 0 in dialogue.

If someone could help me with doing this I'd be much appreciative, and I apologize if this is the wrong forumn
In Ruby, a few methods are considered destructive. Because of this, they're a little bit more obscure. to_i is an example of one of these. Instead of making the value directly into an integer, it returns a copy of it s an integer. In order to have it change the actual value, you need to use truncate!, as there is no to_i!. The '!' marks it as destructive, meaning it will change the value held in the variable, not return a different copy.
@Zalerinian

ok so I tried using

$game_variables[003] *= .9

$game_variables[006] = $game_variables[003].truncate!

it returns with an error
it returns with

undefined method for "truncate!" for 90.0:float
Heck Yea so I found out what I was doing wrong, I just deleted the "!" on truncate and it all works so far.

I'll report back if I get the system entirely running right, thanks Zalerinian you just solved my

three hour problem and I'm that much better with scripting lol
I know you have 'solved' your issue; however, if you wanted a scripted bank you can use THIS... 

Also, if you change line number '685' to

    $game_storage.gain_cash( (amount * 0.9).to_i )That would make each cash deposit reduce by 10%, as you require.
@Dekita

I really like your script, my only concern is I may possibly be trying to make this a commercial game and idk your license terms. it is a nice script though so if you wouldnt mind id most def put it in my game. im toying around with scripting while making this game and i learned quite a bit just from that event. like i said though i dont want to put it in ny game without your permission since i might make it for commercial use
Use $game_variables[3], not $game_variables[003]


I saw your other post - is this sorted now, or not?
You can use the bank script in a commercial game, thats fine; however, I request you give me credit for the script 🙂
@Dekita

thank you very much i appreciate, and ill def give you credit. im also using some of yanflys scripts, im hoping i can learn the language well enough to create my own journal menu. ive found some online but they either cost money or cant be used, either way i want to make some of my own scripts 😀 thanks again
@Shaz

this is very much sorted out

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-my-bank-system.22724/