Oh, actually, I've got an idea! ^^'
You just need to have a dictionary, right?
So, what if you make it *beforehand*?
I mean, if you have it already sorted, all you need to do is to have such input data:
000: AA+
001: H HED
//it makes AAH, AAHED, AA
002: AB+
003: A ACA
//it makes ABA, ACA, AB
004: AC
005: ACIA ACIAS ADEME
//it makes ACACIA, ACACIAS, ACADEME; without AC, because there's no plus sign
...
AAA: AT+
AAB: LAS, MOSPHERE, TACK,
//ATLAS, ATMOSPHERE, ATTACK, AT
...
CCC: CA
CCD: LIGRAPHY RT ST T
//CALIGRAPHY, CART, CAST, CAT; no CA, because there's no plus sign
Which would work this way:
- items at the even positions (0, 2, 4, 6, ...) would be added to Index
- items at the odd positions would be split into lists which would be added to Dictionary
- if item at the even position has length of three (which I marked with plus sign), an empty string would be added to the recent list
This wouldn't require the adder Custom Block, apparently, and since you'll probably use the same data all the time, it should be safe to use already sorted list.
Here's what you'd add in creation code instead:
set List ID to [0]
while <[List ID] < [number of items in [Default List]]>
add [ split [ get item # [[List ID * 2]+1] from [Default List]] into words] to [Dictionary]
set Prefix to [ get item # [List ID * 2] from [Default List] ]
if < [ [Prefix] length ] = 2>
add [ Prefix ] to [ Index ]
otherwise
add [ part of [Prefix] start: [0] end: [2] ] to [Index]
add [] to [get item # [List ID] from [Dictionary]]
"split something into words" should work quite fast; I've repeated 6000 times split for text counting 2000 words, which would make over 12 million words. It means that if you want to split about 100,000 words, it should take about 0.02 seconds (on my computer, at least, I don't know what about other devices); a frame lasts not much less than that.
So yes, maybe try using the dictionary already sorted in such way I presented at the beginning? ^^'
(the other thing would be to sort it, but I suppose that doesn't have to be made in Stencyl; rather in some language which allows to handle input/output files O.o')
Oh, and since Stencyl doesn't handle the lists in the most fortunate way, and I haven't found a way to clear lists so far, I suggest doing something like that:
- keep the actual list in a text file, with each item in its line, however long that line would be
- load that file to the behavior
- if the list changed and you want to update the behavior Default List attribute, remove the behavior and add again; the list will be cleared! ^_^