Answered. Show score integer below whole number 1 question
Thunder_Child
Member Posts: 2,343
Im trytin to have a score show an integer less than one. Even just trying to make my score start less than one by changing the value under game attributes does not work.
When I try to change the vaule less than one and press enter on keyboard it does not allow it.
Is this a no worky in GS?
Comments
What type of variable are you using? Index attributed won't got below 0. Use a real attribute.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
When you say less than 1 do you mean a decimal? If so since it's an integer attribute it will never display a decimal... since integers are only whole numbers.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Do you mean a negative number ?
@Socks Yes. Like .00245 minumum.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Hmmm. I had a score once that would show whole numbers and decimal places after it. It was an integer.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
I made an integer. Wanted game to show score of .00245 after a timed event then add that per timed event. Increasing score per timed event.
I thought of real atteibute but I guess you dont just add to it like an integer because it no worky.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
Something must have been wonky for sure, Integers won't show/use decimals. If you want a decimal you should use Real.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
So many contradictions here. The number 0.00245 is positive. And saying that that's the minimum means that you only want positive numbers.
And I have no idea what that means. As was mentioned, you need to use real attributes if you are displaying or doing math expressions with non-whole numbers (aka decimals).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Lol, same here, my brain just shook for a couple of seconds and then exploded : )
So this negative integer is a positive non-integer, lol.
Ok. I have shown to be a total dumbcluck with math. First I used the term less than one...that was confusing you all said...so I used negative...which I do understand was the wrong phrasing. -.00245 woukd have been negative.
Sorry.
So I now get I cant make an integer show a value except as a whole number. And must be a real number.
Tonight when at my Mac I will show an example of when I used an integer and it gave me decimal places...like 250.5 or 100.75
I was assuming GS would do this the opposite if I asked it to using an integer. Why it woukdnt is beyond me. Probably the same reason in the Game attribute I create (score)...when I put the value of 1,000 it shows a comma but when I ask it to shiw attribute score as a text display it wont show a comma. Its so hard to see it do one thing and not the same as "I" would expect.
In a timer...if I ask it to "every .1/sec" do something....is that not an integer?
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
A complete guess here . . . but it might have been an integer attribute that was being displayed with additional calculations thrown in ?
For example, displaying an integer attribute ('Score') with a value of 11 like this:
Display Text: Score/2
Will display 5.5
??
Integers are whole numbers. They can be positive or negative. -150 and 45 and 542,654,554 are integers.
Reals are any numbers. They can be whole numbers or fractions, and can be positive or negative. -5.765 and 63.23413512 and 542,5426,252 are real numbers.
Indexes are whole numbers, but they can only be positive. 434 and 1 and 10,000 are indexes.
Booleans can be one of two states - true or false (essentially 1 or 0 - something or nothing).
All of the above are attributes. So your original question should be:
"Im trytin to have a score show an attribute less than one."
The answer, as has been pointed out, is to use an attribute type that is able to handle numbers less than 1 (be it 0.4 or -100). In other words, use a real attribute, and not an integer.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Ok thanks @Armelline for the clarification on index, real and integers.
@Socks Now I also understand why I was abke to have an integer of "5.5". Yes I was using a division symbol in the math.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
No. An integer is a whole number.
Just call me the maths detective
What IS .1 in a timer?
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
An 'expert' replies:
I'm not telling you as you are "not allowed to EVER be as good as [me]", lol
So game attribute called "score", "real attribute"
So I woukd code it...every 3 seconds..."change attribute real.score to real.score+.00245" ? I placed that is a display text.
thats what I tried when I made a real attribute called score. As I said...it no worky. I frowned. I scowelled.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
The variable used in a timer is a little more complicated. Well, it's actually simpler, but more difficult to understand if you don't have programming knowledge outside of GameSalad.
All the attribute types I outlined above are actually pretending to be those things. I may be mistaken, but since GameSalad is build on top of a programming language called Lua, all those attributes (well, the number ones at least) are actually real attributes (or in programming speak, variables).
The limitations each one applies are, presumably, put in place by GameSalad itself, as in Lua there are no integers and indexes, only real numbers. You can "fake" an integer in GameSalad by using the floor(x) function - this shows the number without any decimals. In other words, an integer. Indexes are similarly faked if needed, but I won't bore you with details of that too.
Since when you put a number in a timer you aren't referencing any attribute, but that number has to be stored somewhere, GameSalad is presumably putting it in a variable hidden beneath the user interface, down at it's Lua roots. Since Lua only uses real variables, that's what it must be. Some kind of validation must be done to it, though, to stop you entering negative numbers.
That's why you can use decimals in a timer, because it's a real attribute.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@Armelline
@Socks
@tatiang
@The_Gamesalad_Guru
@jamie_c
Thank you for the answers. All you guys have been helpful.
Complete Guide to iOS Publishing {} Complete Guide to Mac Publishing
You're welcome.
And I can't take the pressure of the title 'expert'!!!!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
I'm livin' it, just ordered a cape off ebay.
@Socks, I hope its custom made with a big green 3D cube on it!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Don't be silly. It's shaped like a green pipe and has a fat bird emblazoned on it.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I make a great sidekick if any of you super hero experts need one.
Fortuna Infortuna Forti Una
No Capes
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS