jaynabonne wrote:Otherwise - are you just looking to break the input up into "words" based on spaces as separators?
This. My switch cases are all simple verb patterns, it's a bare fist fight so no other objects are involved. So if the player types in "punch man in head" I want the script to be able to extract "punch" from that sentence and ignore the rest of the words.
I've deleted all the split things I tried so I can't remember exactly what I had, but this is my first attempt at using split so a simple error somewhere is likely. My biggest confusion is where should "split" come in relation to the rest of the code. My impression from the wiki was I should either add the whole string to a named list and then split it. If I split the input to begin with, I don't know how to add it to the list I've created. Everything else in the code works (foreach, if listcontains etc.) but I get stuck around:
Get Input, then:
findverb = NewStringList()
list add (findverb, result)
split (findverb, " ")
I realise that third line would try and call a function and so wouldn't work, I used it in different ways but I wanted to show how I tried to use the space as the string separator.