PennController for IBEX › Forums › Support › Timers
- This topic has 17 replies, 2 voices, and was last updated 3 years ago by
Jeremy.
-
AuthorPosts
-
September 29, 2021 at 10:48 pm #7325
Elias.mohammad2
ParticipantFor my project, I am struggling to set up a timer for two different columns in my Stroop file. My two columns are “word” for the words to be presented and “transition” for the transition between each shown flashcard meaning that that column is empty. The word column is set to 6000ms while I need the transition column to be only 2000 ms. When this is listed, it works
newTimer(6000).start().wait() ) .log( "word" , row.Word ) )
However, when I used the other code for the transition column, it did not work and gave me the error “There must be some items in the running order”.
newTimer(2000).start().wait() ) .log( "transition" , row.Transition ) )
This is the beginning of the script before the timers.
Template("Word Pair List .csv" , row => newTrial( "experimental-trial" , defaultText.center() , newText("word", row.Word) .css("font-size", "24pt") .log() .print() , newText("transition") .log() .print() ,
Does anyone have any suggestions for this? Thank you in advance!
September 30, 2021 at 11:08 am #7326Jeremy
KeymasterHello,
It would help if you could share the demonstration link to a project that exhibits the problem. When I try to complete the beginning of the script with either pieces of code, things run normally
This works:
Template("Word Pair List .csv" , row => newTrial( "experimental-trial" , defaultText.center() , newText("word", row.Word) .css("font-size", "24pt") .log() .print() , newText("transition") .log() .print() , newTimer(2000).start().wait() ) .log( "transition" , row.Transition ) )
and this works too:
Template("Word Pair List .csv" , row =&g; newTrial( "experimental-trial" , defaultText.center() , newText("word", row.Word) .css("font-size", "24pt") .log() .print() , newText("transition") .log() .print() , newTimer(6000).start().wait() ) .log( "word" , row.Word ) )
Here is my mock
Word Pair List .csv
table, for reference:Word,Transition hello,transition1 world,transition2
Jeremy
September 30, 2021 at 1:03 pm #7327Elias.mohammad2
ParticipantHi Jeremy,
Sorry, I should have clarified. I need both timers because I want the word column to be 6 seconds while the transition to be only 2 seconds.
Here is the link: https://farm.pcibex.net/r/iAXgPj/
Elias
September 30, 2021 at 2:28 pm #7329Jeremy
KeymasterYou get this error message because you are attempting to close the content of
newTrial(
twice:, // Wait 1s before moving to the next trial newTimer(6000).start().wait() ) .log( "word" , row.Word ) // Append the value of 'Word' at the end of the results lines newTimer(2000).start().wait() ) .log( "transition" , row.Transition ) // Append the value of 'Word' at the end of the results lines )
The first lone
)
in this code matches the(
of thenewTrial(
above in your code. The next.log
line applies to thatnewTrial(...)
object whose content was just closed with the preceding)
. However, on the next line, you are trying to add yet anothernewTimer
element, even though that line is no longer placed inside the parentheses of anewTrial
: that does not make sense to the script, which for all it knows is inside the parentheses ofTemplate
, but is done with thenewTrial(...)
it has already processed at that point. BecausenewTrial
has already been closed, the next lone)
matches the remaining open(
, which is the one from theTemplate(
above in your code. Accordingly, the last.log
command applies to thatTemplate(...)
object, but there is nolog
command on such objects, only onnewTrial(...)
objects (and on trial-internal elements, but they have a different meaning). Finally, the very last lone)
matches nothing, because at that point in your script there’s no open(
leftYou can see short error messages about those issues in the text editor on your project’s page, if you move your cursor over the red X icons that appear to the left of the line numbers
What you probably want is this:
Template("Word Pair List .csv" , row => newTrial( "experimental-trial" , defaultText.center() // Horizontally center all Text elements automatically , newText("word", row.Word) // Show the text from the 'Word' column .css("font-size", "24pt") // Increase the font size .log() // Reports when the Text is displayed in the results file .print() , newTimer(6000).start().wait() // Give 6s to read the word , getTex("word").remove() // Take the word off the page , newTimer(2000).start().wait() // Wait 2s on the empty page ) .log( "word" , row.Word ) // Append the value of 'Word' at the end of the results lines .log( "transition" , row.Transition ) // Append the value of 'Transition' at the end of the results lines )
Let me know if you have questions
Jeremy
October 1, 2021 at 10:01 pm #7338Elias.mohammad2
ParticipantJeremy,
Thanks for the help and the advice. It worked great now!
Another question I have is that for a later phase (phase 3.js) in my project, I am using the same parameters except I am now testing the participants with the second word of the word pair. So on the screen of “word” I would want to have a text box that they would have to fill out the answer to the one word I present in front of them. On top of that, I want it to assess it and give feedback if it is correct or not (Incorrect is also if they run out of time). Is this possible? I will send you my link for you to see what I have tried. Thanks for the help again!
Link: https://farm.pcibex.net/r/iAXgPj/
Elias
October 3, 2021 at 10:20 pm #7342Jeremy
KeymasterHi Elias,
As you can see in the Errors tab of the Debug window, your column is named
CorrectKey
and notCorrectKey
(note the space character at the beginning)You should have a
wait
command before yourtest.text
, because otherwise the script will rush through the lines even before the participant has had time to type anything in the box, so the test will necessarily fail (because the box is initially empty). Also note that theCorrectKey
cells in your CSV table that do have some text in them all start with a space character, and the third one additionally ends with a space characters: those matter, and unless your participant types space characters in the box at the exact same place, the test will fail too; you probably want to remove those space characters from the cellsOnce you fix those issues, you should get something functional and close to what you want
Jeremy
October 11, 2021 at 11:52 am #7360Elias.mohammad2
ParticipantHi Jeremy,
Thank you for the help! I followed your instructions and it seems to work but the text box isn’t shown as well the timer not being in effect. Do you see where the issue is?
https://farm.pcibex.net/r/iAXgPj/
Elias
October 11, 2021 at 1:12 pm #7361Jeremy
KeymasterHi Elias,
You never
print
the TextInput element so it won’t appear on the page. Your script gets stuck on itswait
command because, the element not being displayed on the page, you cannot press Enter to validate it.I suspect that what you want is:
newTimer("allotted time", 6000).start() , newTextInput("feedback", "Enter your answer") .log() .lines(0) .size(400, 200) .print() .callback( getTimer("allotted time").stop() ) , getTimer("allotted time").wait() , getText("word").remove() // Take the word off the page , getTextInput("feedback") .remove() // .wait( getTextInput("feedback").test.text(/^.+[\r\n].+[\r\n].+$/) ) .test.text( row.CorrectKey ) .success( newText("Good job!").print() ) .failure( newText("Wrong anwser!").print() ) , newTimer(2000).start().wait() // Wait 2s on the empty page
Jeremy
October 15, 2021 at 5:18 pm #7369Elias.mohammad2
ParticipantHi Jeremy,
That definitely helped so thank you but for some reason, the textbox is still not showing. Not sure if I messed up the code anywhere else but would you mind giving it a look and seeing where the problem might be. Thanks!
https://farm.pcibex.net/r/iAXgPj/
Elias
October 15, 2021 at 5:31 pm #7371Jeremy
KeymasterYou are not properly closing your
newTrial
andTemplate
commands: you need to add two closing parentheses after line 56 of your file Phase 3.js, as hinted at by the message that appears when you move your cursor over the red cross signaling an error:You can see short error messages about those issues in the text editor on your project’s page, if you move your cursor over the red X icons that appear to the left of the line numbers
Jeremy
November 10, 2021 at 2:06 pm #7488Elias.mohammad2
ParticipantHi Jeremy,
Thank you for all your help thus far. I have finished phase 1 and phase 3 of my experiment but I am struggling to create phase 2. In phase 2, I will have four separate blocks.
The first block is the participants restudying 15-word pairs just as we did in phase 1. However, the difference is that I only need 15 of the word pairs out of 60 in that specific block. Is there any way to specify that I want that in the program?
The second block is where the participants will study the next 15 words (16-30) where one word will be shown and then only the first three letters of the second word will be shown where they then will have to type in the rest.
Block three and four are replications of one and two respectfulling except i need to have an audio file playing the whole time in the backround.
So the three things that i need help with is how to specify a range of words out of the total list of 60 words, how to only show the first three letters of a words with the rest to fill in, and how to have music play in the backround for block 3 and 4.
Best,
EliasNovember 10, 2021 at 3:33 pm #7490Jeremy
KeymasterHi Elias,
There are several different and somewhat advanced questions in your message, I won’t be able to fully address them at the moment. Maybe other users of the forums might be able to help you with them. In the meantime, let me give you pointers:
– The command
GetTable().filter
lets you subset your tables. You could add a column to your table where you number your items from 1 to 60 and usefilter
in three differentTemplate
commands to generate trials with formats specific to each block in phase 2– You can use
.substring(0,3)
on a string to return just the three first characters, e.g.row.Word.substring(0,3)
. You can use the TextInput element to have people type in text, and thebefore
/after
commands to place the Text and TextInput next to each other, or place them on a Canvas element if you need more control on the visual layout– The Audio element will let you play audio files (which you’ll need to upload to your project or to a host space first, of course). The tutorial illustrates how to use it
Jeremy
December 30, 2021 at 7:55 pm #7643Elias.mohammad2
ParticipantHi Jeremy,
I was wondering if you could help me out with an issue I have. I was trying to see if I could put specific files in a specific order. I have the files all completed but need to be placed in a specific way. Would you be able to help me with that? The order I would need it to be is consent->instructions-> questionnaire->phase 1, phase 2, and then phase 3. Here is the link also. Thanks!
January 10, 2022 at 11:40 am #7654Jeremy
KeymasterHi Elias,
Use the command
Sequence
, as illustrated here, to control the order of presentation of your trials. For example:Sequence("consent", "instructions", "questionnaire", randomize("phase1"), randomize("phase2"), randomize("phase3"))
(the details will depend on the specificities of your project, but I cannot see trials labeled “questionnaire” or “phase1/2/3” in the project at the link you shared—all three )Jeremy
January 19, 2022 at 3:36 pm #7686Elias.mohammad2
ParticipantHi Jeremy,
Is there any way to send you my project code with all the files? As in what I see when I am working on it because I am struggling to sequence it. I read the instructions and followed them but it continues to not sequence correctly.
Best,
Elias -
AuthorPosts
- You must be logged in to reply to this topic.