Code: Select all
If CurrencyLost = "xrp" Then DebugPrint("XRP Balance: "..CoinHoldingPlaces[Place][CurrencyLost].." Lost amount: "..LostAmount)
CoinHoldingPlaces[Place][CurrencyLost] = CoinHoldingPlaces[Place][CurrencyLost] - LostAmount
If CurrencyLost = "xrp" Then DebugPrint("New Balance: "..CoinHoldingPlaces[Place][CurrencyLost])
Code: Select all
XRP Balance: 145 Lost amount: 145
New Balance: -2.7284841053188e-012
As far as I know, everything is Numbers, I have even used ReplaceStr() to remove unnecessary characters and then used ToNumber() to make them into numbers. And in Addition I even used GetType() to see that they are numbers.
Also, It seems there is no problem when I am using "+"-operator, problem is only when I use "-" operator.
In Addition, to take out the possibility of having misspelled something, i also did following:
Code: Select all
Local num1 = CoinHoldingPlaces[Place][CurrencyLost]
DebugPrint("number: "..#NUMBER)
DebugPrint("num1: "..GetType(num1).." LostAmount: "..GetType(LostAmount))
DebugPrint("num1: "..num1.." LostAmount:"..LostAmount)
Local num2 = num1 - LostAmount
DebugPrint("num1 - LostAmount: "..num2)
Code: Select all
number: 2
num1: 2 LostAmount: 2
num1: 145 LostAmount:145
num1 - LostAmount: -2.7284841053188e-012
edit: Took a try to change instead of using "-" using "Sub()", but that didnt work either, but result was still the same.
edit2: Tried to trick it with following idea:
Code: Select all
LostAmount2 = 0 - LostAmount
Add(num1, LostAmount2)
Code: Select all
If CurrencyGained <> ""
If HaveItem(CoinHoldingPlaces[Place], CurrencyGained) = False Then CoinHoldingPlaces[Place][CurrencyGained] = 0
CoinHoldingPlaces[Place][CurrencyGained] = CoinHoldingPlaces[Place][CurrencyGained] + GainedAmount
EndIf
If CurrencyLost <> ""
CoinHoldingPlaces[Place][CurrencyLost] = CoinHoldingPlaces[Place][CurrencyLost] - LostAmount
EndIf
Edit3:
I changed
Code: Select all
Local num2 = num1 - LostAmount
Code: Select all
Local num2 = num1 + LostAmount