Stencyl 3.4.0 is now out. Get it now!

Top times should be 999 but sometimes showing as 0

nicktendowii

  • *
  • Posts: 93
I have a list of Top Times for levels. with the default value supposed to be set to 999 (so when the level has been completed it can check if the top time is higher than the level time and swap it accordingly. I have set the default values to 999 (see screenshots) and got it to change all items in the list to 999 when the data is reset. but for some reason it only seems to work for the first few items. the rest are all 0 which means the level times wont be saved at all...

Can't figure out where i've gone wrong so any help would be much appreciated!

Thanks in advance.

Nick.

merrak

  • *
  • Posts: 1487
Feels like there's more to this story than the code snippets you posted. My first thought was that the "Replace Item" block is interpreting "999" as text... or there is some other kind of type error. A telling sign of this problem is if your code works as intended on one platform, but doesn't on another. Different platforms seem to make different assumptions about how to interpret a string that looks like a number. I usually encountered the problem when loading game attribute values using the 'load game' wrapper. The fix is to use the 'as number' block.

But--if this was the issue here, I'd expect the list to not work at all. Working for a few of the items is interesting. What did the print statements print to the log?

nicktendowii

  • *
  • Posts: 93
Feels like there's more to this story than the code snippets you posted. My first thought was that the "Replace Item" block is interpreting "999" as text... or there is some other kind of type error. A telling sign of this problem is if your code works as intended on one platform, but doesn't on another. Different platforms seem to make different assumptions about how to interpret a string that looks like a number. I usually encountered the problem when loading game attribute values using the 'load game' wrapper. The fix is to use the 'as number' block.

But--if this was the issue here, I'd expect the list to not work at all. Working for a few of the items is interesting. What did the print statements print to the log?

Thanks for the reply. I've kind of found a workaround and that is just to state the amount of times I wanted the code to loop rather than relying on the repeat number of items code... The print was bringing back only the first 4 results even though the list had default attributes for 39 entries... well it seems to be working now but I still dont know what's causing it to be weird... and as for the different platform i've been exclusively testing it on IOS and it used to work fine... weird!