Values greater than 9 causing weird issue

0 favourites
  • 3 posts
  • I'm giving layouts static numbers as names (1,2,3,etc) and I am testing these numbers for LocalStorage events, to figure out which level is unlocked. Strange thing is, if the layout name is greater than 9, it doesn't seem to be saving the value properly LocalStorage, since there's a condition to only save the item if the variable is greater than the current layouts name (when returned as a number rather than a string). Does LocalStorage think of 10 as being somehow below 2, or does LocalStorage only keep numbers on single digit?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Makes sure to convert the values back to numbers. At the moment it is comparing "2" to "10" as a string: "2" < "10".

  • Makes sure to convert the values back to numbers. At the moment it is comparing "2" to "10" as a string: "2" < "10".

    Ahh, works now I changed "Value /> LayoutName" to "Value /> int(LayoutName)" I must have been getting on by with luck until now! Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)