Custom Score Font + Shortened Score
Earlier this week I posted a questions asking how to display a shortened number, meaning once the player hits 1 thousand, instead of displaying "1000" to display "1.00 Thousand" This would be helpful so that when the player has a score of 100Million, they dont see "100000000" but instead they see a simple "100.00 Million". The answer that solved my problem was from User: Lovejoy who said:
"These are the 3 rules i used to display the score.
First rule
if attibute game.score < or = to 999
Display text game.score
Second rule
If all apply
if attribute game.score > or = to 1000
If attribute game.score < or = to 999999
Display text (game.score/1000).." thousand"
Third Rule
If attribute game.score > or = to 1000000
Display text (game.score/1000000).. " million" "
~~~~~~~~
Now, that has worked perfectly, until I was disappointed with the fonts gamesalad gives you. So now I am here to ask if anyone knows how to apply the above answer before (Which did exactly what I needed it to do) with custom fonts? ive looked on youtube and they just show you how to do this with a long number score, no altering of the math or anything, if anyone can help out Id greatly appreciate it!
Comments
Bump (?) Any ideas?
If you're displaying a number such as 28,000 as 28 Thousand, then you already have the number 28 stored in an attribute or expression and can use that for displaying a custom font, can't you? That idea is based on the answer I gave you here.
If you were using 28, you would use floor(28/10) to display the ten's digit and mod(28,10) to display the one's digit.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@SikkJewFro Its unfortunate about the lack of custom fonts, we all feel your pain.
If you want to add a custom font and have it display like my previous suggestion you posted above then it would have to be done a completely separate way i think. Not too sure about this one. Hopefully someone else can jump in on this to offer some input.
Edit: @tatiang I was just about to tag you.
Fortuna Infortuna Forti Una
@tatiang ok, so testing this out, if I do;
Display Text
(game.score/1000) it does what I want by showing a whole number and the decimal points
using "floor" before this equation only allows the whole number. The answer you gave me before of course showed you how to display the whole numbr, then the remaining beside it, however Id much prefer having the "x.xxx" display, im still a little fuzzy on how Id set it up to get it to work properly
Can you give me an exact example of what you want?
Are you saying you want 23,456 to be displayed as 23.456 Thousands?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Exactly correct, the answer you previously gave, being "x thousand & xx" seemed longer than the version I was wanting, that being if the players full score is lets say as you said 23,456, then Id like the displayed score to show "23.456 Thousand"
then, as they reach 1,234,567 it would display "1.234 million" with the leaving off of anything past the 3rd decimal point making it easier for players to read their score.
For starters, I think you can achieve the decimal point location by using this expression:
game.score/pow(10,floor(log10(game.score)))
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Score is now displaying NaN, not entirely sure
@tatiang What @SikkJewFro wants is for it to display that way while using a custom font. I think the expression you provided would yield the same result as stated above.
Fortuna Infortuna Forti Una
@Lovejoy I understand and I'm providing a way to store the full decimal value in an attribute rather than having a bunch of rules to display certain values. The idea would be, for example, that if game.score/pow(10,floor(log10(game.score)))=2.3456, then floor() of that expression would return the first digit (2) which could be used with a custom font, etc.
But I just discovered a problem with my expression... it always returns a number in the format x.xxxxx so 23456 won't return 23.456 but rather 2.3456. Hmm.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ah gotcha, im sick as a dog right now and my brain isn't functioning 100% but ill mess with it a bit a see what i can come up with to help out.
Fortuna Infortuna Forti Una
No worries. I think I came up with a much simpler way to display a large number as a custom font. Stay tuned...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@Tatiang, @lovejoy Will do, thanks for the help guys
Well, after working on this for quite a while, I came up with a brand new way of displaying custom font numbers:
http://forums.gamesalad.com/discussion/comment/514367/#Comment_514367
It doesn't really address your issue of wanting decimals representations but it does provide a way to parse out each digit and you could do anything you want once you have that data. Originally, I stored each digit in a separate table row but it was going to be difficult to constrain the values that way so I opted not to use a table... which is actually much simpler.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
EDIT: What I posted here didn't work and I am reworking it and will post it again when it is done.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@tatiang Looking at the template, maybe im completely derping out, but is it supposed to display the digits here? Mines just showing a blank black screen, nothing happening, I even moved the actors on screen to assure it wasnt just a lag problem. Am I derping out here or is this something you didnt actually intend? O.o
Edit: Tried to even place the digits manually and they just set themselves to "3". no matter how many I add.
I can't tell you if you're derping but it might be because I built it in Mac Creator and I see that you're using a PC. The setup is really simple, though:
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Sounds simple enough, Ill hop in and see if I can get it working properly
@tatiang Well, copying exactly watchya said made the digit show "0" at first, but the second anything gets added to my score, it shows a white box. Argg
Is this the kind of thing you are after? The decimal point is a comma because it is what I had. The "Thousand", "Million", etc are text you can change that to an image. At this point it is not dynamic and won't hide the leading zeros but you can implement that feature if you want it.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander that appears to be indeed what Im looking for, all that'd be left would be infact hiding the leading zeroes, other than that, it looks to be just what I need