KEITH you are an absolute angel of a human being. IT WORKS.
Okay so I’ll summarise the issues I had to fix before it finally worked for others if they need a similar fix. Also here’s a quick summary of what the experiment is actually doing for those who are interested, and if anyone needs to create a similar one:
During the experiment, participants see words appearing one by one on the screen. Together, these words form a sentence. One word in the sentence is substituted by a picture. Next, a letter will appear in the middle of the screen. Their task is to indicate whether the sound of this letter is present in the picture name and they will be given feedback to this.
The excel list, thus, consists of a ‘sentencebefore’ list and a ‘sentenceafter’ list with what needs to appear before and after the picture and the letter. However, one problem that I JUST realised because of your comment, Keith, is that this means there are sometimes cells containing only ‘the’ or cells containing only an enter (because the sentence ends with the picture). This did work in Psychopy, which is why I was so confused when I got the error. What I did now, is I put words in every cell (right now it says ‘boo boo’ because that’s my mood) and now it does recognise it as a string. I do need to still find a solution how to create a ‘fake’ string of words that will not be seen by the participant but I think I’ll be able to find something.
Some things I did (with a lot of help from your replies) before it worked in Pavlovia:
- Define the len(SentAfterPrac.split()) in one of the custom codes boxes first, so that the code included the JS translation (instead of putting it in the $rep in the loop options box) - and this is important for any code that you put directly in the variable box.
- The JS code for
len(SentAfterPrac.split()) is indeed
SentAfterPrac.split(" ").length; and crucially NOT
SentAfterPrac.split().length; which is what PsychoPy automatically translates it to.
Thanks again Keith and Wakecarter! You’ve been a big help!