dictionarystencyl

Stencyl -- get more than one value from a Map


How can I get all 3 values from a Map with the key "2" ? Right now it takes always the last one from any number, for example if i type in "1" it will take the last letter of it "f".

Is it because there is no loop ?

enter image description here

MAPS


Solution

  • AFAIK, it is not possible to directly store multiple values with the same key in Stencyl, nor in any programming language. Each value will overwrite the previous one, which is why your 2 key is returning i. Instead, you could consider these workarounds:

    1. Name your keys 0a, 0b, 0c, 1a, 1b, 1c, and so on. It's pretty simple to get the values with this method.
    2. Store your values in a single key, separated by commas. E.g. key 0 is a,b,c, 1 is d,e,f, and so on. Then you can use the list blocks with split (value of 0 for TT) using separator , to get the 3 values (which will be a, b and c).

    If you have any questions about either of these methods, don't hesitate to ask!