OSWeb - Logging Multi-Character Input
Hi all!
I am trying to design a free-recall test using OS. Since OSWeb does not support the use of the text input item, I made use of Sebastiaan's script for multi-char text input. However, in the current version of my experiment, all the words typed in are logged in the same cell in the output which makes it difficult for me to identify correct responses.
Is there an alternative way to make individual words logged in separate cells? I've tried myself and made it work for OS but not for OSWeb.
Thanks in advance!
Bugay

Comments
Hi @bugay,
Let's say that the response consists of multiple words, each separated by a space, and that this is stored in the variable
multichar_responses. Then you can first usesplit()to split this string into an array of substrings, each corresponding to a single word. And then you can loop through the words, and assign them to separate experimental variables (word1,word2, etc.). That should get you some way, I think?The JavaScript code below, to be inserted in an
inline_javascriptitem, shows how to do this.vars.multichar_responses = 'one word and another word' let words = vars.multichar_responses.split(' ') for (let i in words) { vars.set('word' + i, words[i]) console.log('word' + i + ' = ' + words[i]) }Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Perfect, thank you so much @sebastiaan!