Is there a bug with the formula : "n"..floor((

LordTarantorLordTarantor Member, PRO Posts: 890
edited November -1 in Working with GS (Mac)
I dont know if it was the update but the formula I have with images to show the score stop counting at some random point. I create an actor to display the game.score and it counts like it is supposed to. Does this happened to somebody else?

Comments

  • LordTarantorLordTarantor Member, PRO Posts: 890
    bump!
  • PhoticsPhotics Member Posts: 4,172
    Floor is just for rounding down... 5.6 would become 5.

    If you want to limit the counting of numbers, it's Min/Max

    X = min(99,game.score)

    X will not be larger than 99 with that formula.

    The Unofficial GameSalad Textbook has a math section that explains the different expressions.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    I am using one of tshirt's templates' formula to substitute the score with images of numbers. The formula that he uses is this one-
    "n"..floor(( game.bestScore % self.Div )/( self.Div /10))..".png"

    Is there a better one for this?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    are your images named n1,n2 ect?

    the n isnt part of the actual expression. You see how its in quotes? It represents the text in the images name. the second part will bring you back another, and the last part ads the .png extension to give you a complete image name so it can pick the image.

    So if your images are not named n1.png up to n9.png it wont work
  • SkyMapleSkyMaple Member Posts: 817
    right, If your images are just named "1.png" and "2.png" then you can take out the "n"..

    If your image is something like 1_1.png and 2_1.png you can can the end of the expression to something like

    .."_1.png"
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Yes, I just double check and they are named like that. From n0 to n9.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    And like I said, It stars counting great but then it just stop. Not always at the same number and I verify with a display score actor to see if the game keeps counting and it does.
  • DrGlickertDrGlickert Member Posts: 1,135
    Are you using constrain attributes?

    I use a change attribute and a rule in my custom fonts. So when a "score" happens it changes a game.ScoreHappened to 1, and my custom font's have a rule that when game.ScoreHappened = 1, change attribute to floor((game.score....".png"

    I would suggest, so sake of clarity and simplicity, to rename your .png files to 0.png, 1.png, 2.png, etc and remove the "n" portion of your code.

    It makes more sense to do that and it's simpler. (Unless you have two differnt fonts being used, then I think that's the best route to go).
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks everybody.
    @DrGlickert- I just did this and still, I just stop at a certain point.
Sign In or Register to comment.