Corona SDK - iOS Game center score error, decimal comma - ios

I'm using https://github.com/GlitchGames/GGGameCentre library to publish score and to show leaderboard window.
The problem i have is that i'm pushing a score type "4.234" and at leaderboard window, my score changes to "0.042", i don't know why.
At itunes i have a configuration type "Score Format Type=Fixed Point - To 3 Decimals" and:
For english:
Fixed Point (10,000,012.218)
And for spanish:
Fixed Point (10,000,012.218)
Please, any help?

The score must be an integer even if you set up a Fixed Point - To 3 Decimals.
If you submit 1234 you would get 1.234
To fix you problem, just multiply your score with 1000 and then submit.

Related

iMA not displaying correctly in backtesting

I developed and started testing an EA in MQL4 that uses iMA function. Basically the program compares the iMA value of the current candle with the iMA value of the previous candle. When I test the EA using the Strategy Tester (Every Tick) my EA is not opening and closing trades correctly. What I mean is the trade does not open on the correct candle. Upon further investigating I noticed, on the current candle the value for iMA in the data window and chart are the same, but they difer from the 'Print' value. The value for the previous candle is correct. When I did a Google search I found that someone in 2008 reported this exact same issue. In 2008 there didn't appear to be a solution.
Now that we are in a new decade, I'm wondering if there is a solution?
Does anyone know if iMA works in MQL5 Strategy Tester?
double MAEMACurrent = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,0);
double MAEMAPrevious = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,1);
double MASlowEMACurrent = iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,0);
double MASlowEMAPrevious = iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,1);
Print("MAEMACurrent " + MAEMACurrent + " MAEMAPrevious " + MAEMAPrevious + " MASlowEMACurrent " + MASlowEMACurrent + " MASlowEMAPrevious " + MASlowEMAPrevious);
Chart & Data Window:
MAEMACurrent: 1.95552
MAEMAPrevious: 1.95572
MASlowEMACurrent: 1.95201
MASlowEMAPrevious: 1.95097
Print Value:
MAEMACurrent: 1.95538
MAEMAPrevious: 1.95572
MASlowEMACurrent: 1.951086
MASlowEMAPrevious: 1.950972
As you can see from the above example the 'Chart & Data Window' values for MAEMACurrent and the MASlowEMACurrent do not match 'Print Value'.
This is the first time that I'm asking a question, so if I've missed something or I am not following the correct protocol for asking a question please let me know.
First, always use the "NormalizeDouble" function to round the values to a proper number of fractions. In your case, if there are just 5 digits after fraction, use the following code to round the values of "MASlowEMACurrent" and "MASlowEMAPrevious" to 5 digits:
double dNormalizedValue = NormalizeDouble(MASlowEMACurrent, 5);
In addition, never compare the value of the in-progress candle on the chart with the values which are returned by the indicator or price functions like (iMA, iClose, etc). Please note that even a very slight time difference could cause differences in the two values. For other candles (in your case the previous candle), since they all have been closed and there are no changes in progress so you can compare the values on the chart with the values returned by the functions. So, iMA is working as expected.

Separate decimals from main number and multiply

I have this number 69,64 (in my country decimals are marked using commas), so I need to have 0,64. I made it using =MOD(D1;1).
But when I multiply 0,64 x 71.800,00 I get 45.800,00 instead of 45.952,00.
Can you tell me why, please?
=MOD(69,64; 1)*71800
make sure 71800,00 is number:
______________________________________________________________

How do I tell my app to read exactly what the string contains?

Stumbled on an issue I can't seem to figure out. I have an app that spits out a certain amount of points depending what the string is so if someone says "not 1" then my app will show -4 points for number 1. If someone says "its 2" then the app will award 12 points for 2.
So now my issue is, If someone says "its 2" and awards 12 points which is great, exactly what I want. But when someone says "its not 2" it still awards 12 points to 2 because it contains the word "its", when I want it to show -4 points.
|| vote.lowercased().contains("its")
|| vote.lowercased().contains("its not")
I want it to be able to see if it contains exactly "its not" then it will know to -4 points.
If you want to distinguish its and its not you have to check for the longer string first
if vote.lowercased().contains("its not") {
// -4 points
} else if vote.lowercased().contains("its") {
// 12 points
}

Roblox Studio - Each block doesn't have the same value

As you can see on this photo: https://gyazo.com/9ca355a460c5602ec073bcbae701dede i clicked on every block. My problem is that every block doens't have the same Value. I want every block when i click at it to go down 1/10 everytime i click and still give me 1 in my backpack pr. click. Right now i can see that the value of the blocks if not the same.
Here is the script for the blocks: https://gyazo.com/b627ae8559b9035f0fdfe88297b13364 (Think the problem is here)
As you can see on this photo the value is 0,8. And the other one downstairs is 0,1 and so on https://gyazo.com/ac5359b7f6a7e123ad31507f4384323d
The damage value is 0.2 as u see here: https://gyazo.com/b9de1795c27eb151caf8db2d79e9f58a
Here is the script for the shovel:
https://gyazo.com/14b5e675be5644056bda8b24f828ec6a
I would appreciate if u could help me to fix this problem. Tell me if u need more information about this to fix this problem. Hope u understand my problem.
In this line (26) u r generating a random damage value
dmg.value = math.random(1, 10)/10
Did u try to set it on
dmg.value = 1/10
?

Lua random number to the 8th decimal place

How do I get a random number in Lua to the eighth decimal?
Example : 0.00000001
I have tried the following and several variations of this but can not get the format i need.
math.randomseed( os.time() )
x = math.random(10000000,20000000) * 0.00000001
print(x)
i would like to put in say 200 and get this 0.00000200
Just grab a random number from 0-9, and slide it down 6 places. You can use format specifiers to create the string representation of the number that you desire. For floats we use %f, and indicate how many decimal places we want to have with an intermediate .n, where n is a number.
math.randomseed(os.time())
-- random(9) to exclude 0
print(('%.8f'):format(math.random(0, 9) * 1e-6))
--> '0.00000400'
string.format("%.8f",math.random())
to help anyone else. my question should have been worded a bit better. i wanted to be able to get random numbers and get it to the 8th decimal place.
but i wanted to be able to have those numbers from 1-10,000 so he is updated how i wanted it and the help of Oka got me to this
math.randomseed(os.time())
lowest = 1
highest = 7000
rand=('%.8f'):format(math.random(lowest, highest) / 100000000)
print(rand)
Hope this helps someone else or if it can be cleaned up please let me know

Resources