Checking new items added in a list

waelouaijan

  • Posts: 78
Hi There,

I created a list for my achievements and I am trying to implement a codeblock at the game over screen which checks which new items have been added to the list, and displays the achievement at the game over screen. Does anyone know how I could have the system only check for newly added items to the list?

PS: I used the codeblock 'add x to list' when an achievement is unlocked.

I appreciate any help I could get.

Best,

Will

Tuo

  • *
  • Posts: 2469
If you are doing the "add x to list", then your number of items in the list will reflect if there have been items added into the list. Perhaps store the old count as a number attribute and then if the new count of items is more than your old count, then check the items starting at the index of your old count to the new length (minus 1) for all of the new items.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Hectate

  • *
  • Posts: 4643
To clarify what Tuo said:

Items in lists are stored starting with the first one being item 0 (zero). But if you count how many items you have in a list you're going to get a result from 1 and up, that's why you have to subtract one from the length. For example, a list of 10 items will be number from 0 to 9, so if you want to look at the 10th item you do 10th item -1 = item 9.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

flyingninja77

  • Posts: 30
Alternately, you could create a second (maybe scene?) list that stores which achievements are completed at the end of a level.  Then you just need to rig up a Drawing code that shows the achievements on separate lines.