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

wahmpire

  • 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!).

yoplalala

  • *
  • 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

mdotedot

  • 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:  http://www.stencyl.com/chat/

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

wahmpire

  • Posts: 81
Awesome, thank you both!

ceosol

  • *
  • 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.