How to do a sum total of values in a Map?


  • Posts: 81
I thought the attached code would work, but I get a "cannot iterate on dynamic list" error.   Search is not helping me, though Im sure this has been asked before (sorry!).


  • *
  • Posts: 1611
you cannot iterate on game attributes

but you can create a list attribute  and set it to game attribute
then you should be able to iterate on it


  • Posts: 1640
Ha Yop crossed mine!

This is what I made:

You can store anything in a Game Attribute. The compiler does not know that you put in an Array.
Hanging out in the Chat:

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.


  • Posts: 81
Awesome, thank you both!


  • *
  • Posts: 2274
You can also add each key (with the text&text block) to a text attribute. Then, split the text string into a list and total the list.