PennController for IBEX › Forums › Support › html layout/event times/selector vs. scale/ compatibility › Reply To: html layout/event times/selector vs. scale/ compatibility
Hi,
thank you for the reply, reuploading the main js file works.
I am working in this part:
Template( row => newTrial("blank", newVar("answer1","").global(),newVar("answer2","").global(),newVar("answer3","").global() , newTimer("loop", 50).callback( getVar("answer1").set(v=>(document.querySelectorAll("textarea[name^='blank']")[0]||{value:v}).value ), getVar("answer2").set(v=>(document.querySelectorAll("textarea[name^='blank']")[1]||{value:v}).value ), getVar("answer3").set(v=>(document.querySelectorAll("textarea[name^='blank']")[2]||{value:v}).value ) , getTimer("loop").start() ).start() , newController("Form", blank("It was so ea__ to get lost in an anc__ buil____")) .print() .wait() , newVar("correct1").global().set(getVar("answer1")).set( v=>v==row.Correct1 ), newVar("correct2").global().set(getVar("answer2")).set( v=>v==row.Correct2 ), newVar("correct3").global().set(getVar("answer3")).set( v=>v==row.Correct3 ) ) .log("answer1", getVar("answer1")) .log("answer2", getVar("answer2")) .log("answer3", getVar("answer3")) .log("correct1", getVar("correct1")) .log("correct2", getVar("correct2")) .log("correct3", getVar("correct")) )
I am not sure newVar(“correct1”).global().set(getVar(“answer1”)).set( v=>v==row.Correct1 ),
performs the operation that I want to do.
I placed in a template the columns with the right answers, one column per answer, and the column name are “ansa_right_blank_1”, “ansa_right_blank_2”, ecc..
The name of the text is “ansa”, so I named the trial and variables with this label
I want to do something like test.selected, so if the answer written by the participant matches correct1, a variable should mark the hit (like 1), and a variable should add + 1.
In the main experiment I have used this strategy: exp score gets the total accuracy, item score marks either 0 or 1.
.success( getVar("exp_score").set(s_exp=>s_exp+1) , getVar("item_score") .set(1) ) .failure( getVar("item_score") .set(0) )
Can I use something like .test.selected for the answers obtained with the blank function? and then add a calculation like the one above for accuracy?
newVar("correct1").global().set(getVar("answer1")).set( v=>v==row.Correct1 )
Does this write in answer1 the answer only if it matches the one in the template?
the results look like this:
# 13. ansa_1. (this is answer1 in your script) # 14. ansa_2. # 15. ansa_3. # 16. ansa_right_blank_1. (this is correct1 in your script) # 17. ansa_right_blank_2. # 18. ansa_right_blank_3. # 19. Comments. 1649154382 aaa344f7a0904712475fe5f0de010eb2 PennController 41 0 ansa NULL PennController 45 _Trial_ Start 1.64915E+12 poo ggoa bbo false false false NULL 1649154382 aaa344f7a0904712475fe5f0de010eb2 PennController 41 0 ansa NULL Controller-Form Form blank170 poo 1.64915E+12 poo ggoa bbo false false false Any addtional parameters were appended as additional columns 1649154382 aaa344f7a0904712475fe5f0de010eb2 PennController 41 0 ansa NULL Controller-Form Form blank179 ggoa 1.64915E+12 poo ggoa bbo false false false Any addtional parameters were appended as additional columns 1649154382 aaa344f7a0904712475fe5f0de010eb2 PennController 41 0 ansa NULL Controller-Form Form blank186 bbo 1.64915E+12 poo ggoa bbo false false false Any addtional parameters were appended as additional columns
Thank you!
HPI