Answered. Show score integer below whole number 1 question

Thunder_ChildThunder_Child Member Posts: 2,343
edited December 2014 in Miscellaneous

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

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    What type of variable are you using? Index attributed won't got below 0. Use a real attribute.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    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.

  • SocksSocks London, UK.Member Posts: 12,822

    @Thunder_Child said:
    . . . an integer less than one . . .

    Do you mean a negative number ?

  • Thunder_ChildThunder_Child Member Posts: 2,343

    @Socks‌ Yes. Like .00245 minumum.

  • Thunder_ChildThunder_Child Member Posts: 2,343

    @jamie_c said:
    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.

    Hmmm. I had a score once that would show whole numbers and decimal places after it. It was an integer.

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited December 2014

    @The_Gamesalad_Guru said:
    What type of variable are you using? Index attributed won't got below 0. Use a real attribute.

    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.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    Hmmm. I had a score once that would show whole numbers and decimal places after it. It was an integer.

    Something must have been wonky for sure, Integers won't show/use decimals. If you want a decimal you should use Real.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2014

    @Socks said:
    Do you mean a negative number ?

    @Thunder_Child said:
    Socks‌ Yes. Like .00245 minumum.

    So many contradictions here. The number 0.00245 is positive. And saying that that's the minimum means that you only want positive numbers.

    @Thunder_Child said:
    I thought of real atteibute but I guess you dont just add to it like an integer because it no worky.

    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).

  • SocksSocks London, UK.Member Posts: 12,822

    @tatiang said:
    So many contradictions here. The number 0.00245 is positive. And saying that that's the minimum means that you only want positive numbers.

    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.

  • Thunder_ChildThunder_Child Member Posts: 2,343

    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?

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2014

    @jamie_c said:
    Something must have been wonky for sure, Integers won't show/use decimals. If you want a decimal you should use Real.

    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

    ??

  • ArmellineArmelline Member, PRO Posts: 5,397

    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.

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited December 2014

    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.

  • SocksSocks London, UK.Member Posts: 12,822

    @Thunder_Child said:
    In a timer...if I ask it to "every .1/sec" do something....is that not an integer?

    No. An integer is a whole number.

  • SocksSocks London, UK.Member Posts: 12,822

    @Thunder_Child said:
    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.

    Just call me the maths detective B)

  • Thunder_ChildThunder_Child Member Posts: 2,343

    What IS .1 in a timer?

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2014

    @Thunder_Child said:
    What IS .1 in a timer?

    An 'expert' replies:

    I'm not telling you as you are "not allowed to EVER be as good as [me]", lol :)

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited December 2014

    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.

  • ArmellineArmelline Member, PRO Posts: 5,397

    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.

  • Thunder_ChildThunder_Child Member Posts: 2,343
    edited December 2014

    @Armelline‌
    @Socks‌
    @tatiang‌
    @The_Gamesalad_Guru‌
    @jamie_c‌

    Thank you for the answers. All you guys have been helpful.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    You're welcome.

    And I can't take the pressure of the title 'expert'!!!! :)

  • SocksSocks London, UK.Member Posts: 12,822

    @jamie_c said:
    You're welcome.

    And I can't take the pressure of the title 'expert'!!!! :)

    I'm livin' it, just ordered a cape off ebay.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @Socks, I hope its custom made with a big green 3D cube on it!

  • ArmellineArmelline Member, PRO Posts: 5,397

    @jamie_c said:
    Socks, I hope its custom made with a big green 3D cube on it!

    Don't be silly. It's shaped like a green pipe and has a fat bird emblazoned on it.

  • LovejoyLovejoy Member Posts: 2,078

    I make a great sidekick if any of you super hero experts need one.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited December 2014

    No Capes

Sign In or Register to comment.