Hi, I’m new to psychology, and I’m trying to make a self-paced reading task.
I would like to split the words in a sentence based on ‘*’ and show the words one by one when the user presses the spacebar.
The code I wrote is below.
When the user completes reading a sentence, I want to show the user a question about the sentence. After that, I want the user to decide if the sentence is correct or not.
The problem is that the code I wrote to make the words show up one by one isn’t working.
I’m not getting any specific errors, but instead of seeing the first word of the sentence and then the next word, I’m seeing the question right away.
How can I get the code to work correctly? Is there something wrong with my code? Please help.
I completely misunderstood your instructions. I’ve edited my reply.
I added ‘console.log’ to the code as you said, and tried checking the developer console (I followed the tutorial, is this correct?).
However, I couldn’t get any text.
Would these results mean that the split code was not working properly?
If so, how can I modify it so that it works properly?
I added console.log(“Start”); to the Begin Experiment tab as you suggested.
When I run the experiment, I see the text “Start” in the console.
Then, in the trial that displays words one by one, I see the text “nWords 5”.
(I haven’t edited the code at all since the last time I left a response).
It seems that split is working fine, considering that the nWords is the same as the number of words in the sentence.
Could you please advise on what I need to correct?
I’m not keen on seeing while clauses in Builder experiments. Could you change it to if? Is the behaviour that you are getting consistent with skimming thought all the words in one frame and then moving on to the question?
The current issue is the same as the first one.
After the first word of the sentence is shown, the next word is not shown.
I don’t think there’s anything wrong with the code I attached, but it doesn’t work.
I would like to know what I need to do so that the words will show sequentially.
Sorry, I believe I didn’t understand your suggestion very well.
I am not very good at coding, so it is difficult for me.
Would you please explain it in more detail?
If I remove the sentResponse as you suggested, wouldn’t I get the input with spacebar?
And if the sentResponse is causing the current issue, is there any solution other than removing it?
Also, does using a JS component affect the stability of the experiment?