Tagged: Selector; Pause trial; Template;
October 3, 2021 at 8:46 pm #7340LorrainyParticipant
Hey, so I’m having some trouble finding the solution for this two:
1) I have an experiment in which I created a template to show some sentences and the participant should select where, in the sentence, is the suject. With that, I wanted to collect the accuracy of it’s answer and set 1 or 0 for it. In my table I set a column named “acuracia” where I put which is the column with the correct answer.
I did it for the task with a scale and it worked, however it’s not working for the selector command.
Here’s what I did:
getSelector ("fraseT2") .test.selected(row.acuracia) .success( getVar("acuracia").set(1) ) .failure( getVar("acuracia").set(0) ) .log("acuracia" , getVar("acuracia"))
2) The second thing that it’s not working is that I need to put a pause trial between each sentence that it’s being called from a template.
For example: In the sequence(), I have –>
rshuffle("tarefa2Alvo", "tarefa2Distratoras"), "transiTarefa2",
The trial that should work as a pause it’s the “transiTarefa2” and it should appear between EACH sentence from the templates of “tarefa2Alvo” and “tarefa2Distratoras”. I saw something with a separator function, but it didn’t work (I don’t think I understood it well).
Oh, if it posible…
3) How can I put 2 buttons side by side? I tried using the .settings.before but it didn’t work how I wanted :/
Here’s the link for my project: https://farm.pcibex.net/r/WzOKfG/
October 4, 2021 at 11:14 am #7345JeremyKeymaster
- This topic was modified 2 years, 2 months ago by Lorrainy.
1) The command
selector.test.selectedtakes a reference to an element as its argument, not just the element’s name: https://doc.pcibex.net/selector/selector-test-selected/
Your code should be:
getSelector ("fraseT2") .test.selected( getText(row.acuracia) ) .success( getVar("acuracia").set(1) ) .failure( getVar("acuracia").set(0) )
(The next line
.log("acuracia" , getVar("acuracia"))has no effect, since you already call
logon that Selector element when you create it—you seem to be trying to use
newTrial().loghere, so you should move that line on the closing parenthesis of
newTrial, which actually comes immediately on the next line in your code)
rshuffle("tarefa2Alvo", "tarefa2Distratoras")outputs a sequence of shuffled trials labeled
tarefa2Distratoras, and adding
,"transiTarefa2"just after it will simply run any trial labeled
transiTarefa2after that sequence
The function you are looking for is
sepWith( separator , subsequence ), in your case you want to use
sepWith( "tarefa2Distratoras" , rshuffle("tarefa2Alvo","tarefa2Distratoras") )
3) In your code you first attempt to add a Button element named botao8
beforethe Button element named botao7, but you reference that Button element (
getButton("botao8")) before you even create it, so nothing effectively gets added to the left of botoa7. Even if it did, you
What you want is:
newButton("botao7", "Voltar") .callback(jump("pratica1"),end()) .before( newButton("botao8", "Seguir") ) .css("margin-left","1em") .print() , getButton("botao8").wait()
- You must be logged in to reply to this topic.