Hi, so I'm trying to build a version of an nth order frequency text scrambler in twine using Harlowe and its internal coding. I thought it would be possible without resorting to javascript, but am a bit stuck.
The idea is that you have a source text (contained in an array), from which the process finds every example of a string (for example "I am") it then selects at random one of the strings that follows one of the original strings (for example "a cat" or "a dog"). It then combines the two strings ("I am a cat") and continues with the process. ("I am a cat who likes" etc.)
The issue is that once I have created the array there doesn't seem to be a way to find the positions of a set of repeated strings in it. If I can find how to do this, I think this should be pretty doable.
Any ideas?
The idea is that you have a source text (contained in an array), from which the process finds every example of a string (for example "I am") it then selects at random one of the strings that follows one of the original strings (for example "a cat" or "a dog"). It then combines the two strings ("I am a cat") and continues with the process. ("I am a cat who likes" etc.)
The issue is that once I have created the array there doesn't seem to be a way to find the positions of a set of repeated strings in it. If I can find how to do this, I think this should be pretty doable.
Any ideas?