Forum Replies Created
-
AuthorPosts
-
April 6, 2021 at 6:59 pm in reply to: How do I log whether the person pressed the right key or not? #6844
Jeremy
KeymasterIt says “Wait success,” which means that the keypress successfully validated a
wait
commandJeremy
April 6, 2021 at 11:57 am in reply to: Problems with test.text and selector.add in self-paced reading experiment #6841Jeremy
KeymasterGlad to see that you got things to work!
Note that in this case, you have the alternative option to use the JavaScript ternary conditional rather than a
test
command, because the value you are checking (row.Question
) is already set at the beginning of your experiment and doesn’t change upon runtime. More information on this page of the documentationJeremy
Jeremy
KeymasterHi Cecile,
One solution is to move your test at the beginning of the trial, so that you immediately end it as soon as it starts if the right conditions are met. This is what I illustrated in this post.
Also, if you want to re-run the same list of trials a given number of times, you don’t have to create duplicate entries in your table: simply reference their labels multiple times in the
Sequence
command.Here is a project to illustrate what I said: https://farm.pcibex.net/r/txQFla/
Let me know if you have questions
Jeremy
April 6, 2021 at 11:00 am in reply to: How do I log whether the person pressed the right key or not? #6839Jeremy
KeymasterHi,
PennController adds one line to the results file per event that is logged. The start and end of a trial are logged by default, and you additionally log your Text, Key and Timer elements: you get one line for when the Text element was printed, one line for when a key was pressed, and two lines corresponding to the start and end of the Timer element. The third line is the one for the Key element, and you can see that the key that was pressed is
R
, which matches the correct column, which reportsr
(it’s not a perfect match because you added a space character beforer
in your table, and you use lower-case when the pressed character is reported in upper case)Jeremy
Jeremy
KeymasterHello,
A simple enough solution is to use JavaScript to generate a unique completion code at the top of your script and print a Text element with that code in the last trial of the experiment. The general idea takes the following form in your project’s script:
code = 'my unique completion code' Sequence( "intro" , randomize("trials") , SendResults() , "end" ) newTrial("end", newText( code ).print() , newButton().wait() // end = wait on this screen forever ) code = undefined // make it harder to fetch the code by other means
Here is a more elaborate illustration of this idea: https://farm.pcibex.net/r/BIHiHw/
Jeremy
Jeremy
KeymasterHi Ana,
Glad to see that the issue has been fixed. However it shouldn’t matter whether you open your results file in a new tab and save it as a .txt file, or whether you click “download” to directly get a .csv file: the content is the same in both cases, it’s a comma-separated table.
Judging from the error message that you got, I suspect that something went adrift with the filename that was passed to
read.pcibex
. Maybe saving the file with a.txt
extension somehow helped in passing the proper value to the functionBest,
JeremyJeremy
KeymasterHi Rick,
For some reason Ibex saves the reception time in seconds, while PennController saves event times in milliseconds. You can take look up the participant’s first row, take the Event Time and subtract it from the Reception Time (times 1000) and you’ll get a proxy for the duration in milliseconds
Jeremy
Jeremy
KeymasterI think what happened is that the stylized double-quote characters were not properly handled by Excel and/or TextEdit, which would cause the exported CSV file to be unreadable once uploaded onto the PCIbex Farm.
You should replace those characters (both the opening and the closing ones) with
"
: that expression will be rendered as a double-quote character by the browser running the experimentI just tested it and it worked: I couldn’t directly open the file items1.csv in the PCIbex Farm editor (just like you reported) so I downloaded it (checked the box to the left of its filename, then clicked the “download” icon) then opened it in a text editor, replaced all occurrences of the character � (which had replaced the stylized quotes) with
"
and re-uploaded it back to the project. The experiment then ran smoothly, and I was able to open the file directly in the project’s editorJeremy
-
This reply was modified 4 years, 3 months ago by
Jeremy.
Jeremy
KeymasterHello,
PennController should automatically detect when the argument is an actual number, or a string exclusively consisting of digits. Visibly it fails to do so, and therefore expects a keypress producing the character with code 12, which is inaccessible in a single keystroke.
To fool PennController, add a dummy non-digit character to your digit string, for example
�
(this one’s called the “replacement character,” I doubt anyone would have configured their keyboard to type it in a single keystroke):newKey("1or2", "�12") .wait() .test.pressed("1") .success( newText("success", "You're right!").print() ) .failure( newText("failure", "You're wrong, 0.999... and 1 do refer to the same number").print() )
Jeremy
Jeremy
KeymasterHi,
When PennController cannot read a CSV file, it would normally throw an error in the Error tab of the Debug window. What you are describing is different, and I don’t think I’m familiar with this error. Where do you see it, is it in the web console?
In any case, feel free to share the demonstration link of your experiment (“Share” option in the right menu on your project’s page), whose copies will contain a copy of that CSV file
Jeremy
Jeremy
KeymasterHi Rick,
Thank you for reporting this issue
This could happen in two instances: either when trying to access the results while another request to access the results is still running (as reported by the message)—for example a double-click on “Results” could open two tabs, or a refresh of the results tab before it has finished loading would give you this message; or it could also happen when a previous request for the results failed for some reason (because of a disconnection, for example), in which case the message could fail to go away and I would need to fix things manually
The first case is a feature, so it’ll remain this way: it is not possible to open/download the results file multiple times in parallel. The second case was a bug, and it should now be fixed: in the worst case, you’d need to wait up to 4min before the message disappears
Jeremy
Jeremy
KeymasterYour experiment contains two
Sequence
commands, so PennController will ignore one of them. Because you usepick
ahead of the secondSequence
command and your file pick.js, which is supposed to define that function, is empty, the script crashes on the first call topick
and all the code below it, including the secondSequence
command and theTemplate
command that generates your trials labeled"experiment"
, is not executed.Your table does contain a cond column listing values from
A
toH
and values starting withdist
, so it does make sense to userow.cond + "-" + row.item
in your projectI have re-filled the file pick.js with the content from the project I initially shared and minimally edited your code along the lines of what we’ve discussed here, you can see the result here: https://farm.pcibex.net/r/MXPSBL/
(note that it runs only 8 experimental trials and 8 fillers, for the reasons I mentioned above)Jeremy
Jeremy
KeymasterThe
"experiment"
in the code referred to the Sequence of presentation:Sequence("TCLE" (consent), "info","instructions", "treino" (trainning),"experiment", SendResults(), "end")
But the
Sequence
command that we have been working on so far is not this one, it’s the one that you report later in your message:Sequence( conditions[0], pick(fillers,1), conditions[1], pick(fillers,1), conditions[2], pick(fillers,1), conditions[3], pick(fillers,1), conditions[4], pick(fillers,1), conditions[5], pick(fillers,1), conditions[6], pick(fillers,1), conditions[7], pick(fillers,1) )
If there is no reference to your trials labeled
"experiment"
in thatSequence
command, then they won’t be included in the experimentJeremy
Jeremy
KeymasterThis line
row => newTrial("experiment", row.cond + "-" + row.item,
labels all your trials"experiment"
and does nothing ofrow.cond + "-" + row.item
. If your table hasA
,B
, etc. in cond, simply delete"experiment",
and that part should work fine (I think)You also reference a variable
dist
in the firstpick
function ofSequence
but you have defined no such variable: I think the variable name you mean there isfillers
, which three lines above you have reference all the trials (in a random order) whose label starts with “dist”. You will only have such trials (that is, after deleting"experiment",
) assuming that cond in your table isdist
(or at least starts withdist
) for your filler itemsOne last thing: you need to close the parenthesis of you
newController
immediately after the}
(and then accordingly delete one of the three closing parentheses at the end of your code)Because your calls to
pick
all have1
as their second argument, your code will include 16 trials in your run: 1 experimental trial, 1 filler trial, 1 experimental trial, 1 filler trial, and so onFYI, you can also share code with me (and readers of the forum) by sharing the demonstration link of your project (option “Share” in your project’s right panel menu)
Jeremy
Jeremy
KeymasterI’m not sure why you are trying to pass the
conditions
array as thes
parameter of your DashedSentence Controller elements.The
conditions
array contains references to labeled trials, and its cells are therefore meant to feature in theSequence
command, as in my example.If you take a look at my example project, I simply use a single Button element in the trials I generate. That’s the part where you should use a Controller element with DashedSentence if you need to use it, and presumably reference
row.sentence
(or, to be consistent with your example,variable.sentence
) as thes
parameter. You can read more about how theTemplate
command works here, and more about theSequence
command hereJeremy
-
This reply was modified 4 years, 3 months ago by
-
AuthorPosts