Reply To: Multiple choice buttons and recording responses

PennController for IBEX Forums Support Multiple choice buttons and recording responses Reply To: Multiple choice buttons and recording responses

#5085
chahlabena
Participant

Hello!

Thank you!
So I managed to make the buttons work by changing them entirely to clickable pictures. As for the results, whenever I put a .log after one of the trials, my experiment stops working after the first test trial and when I remove them, it goes all the way to the end of the main experiment (as I want it to) but I don’t get a downloadable .csv file for each participant – instead I get their results in the raw_result/result files.

This is how the code is now set up, how/where would I put I put a .log function here to give me a downloadable output, and in the validation part towards the end, the link I’m supposed to put is the link to my experiment, yes?

PennController.ResetPrefix(null)

Sequence( "welcome" , "trialintro", "trial1","trial2", "mainintro", randomize("experiment"), "send" , "final" )

newTrial("welcome",
    defaultText
        .print()
    ,
     newText("<p>Welcome!</p>")
    ,
    newText("<p>This is the first part of a two-part experiment.</p>")
    ,
    newText("<p>In this <strong>Identification</strong> experiment, you will hear a series of words, and identify which of the four sounds <strong>p</strong>, <strong>b</strong>, <strong>f</strong> or <strong>v</strong> was heard.</p>")
    ,
    newText("<p> The experiment will take you approximately 10-15 minutes and you will be compensated for your time appropriately.")
    ,
    newText("<p>Please enter your name, ID (if relevant) and course code (if relevant) and then click the button below to start the experiment.</p>")
    ,
    newText("<p> If the ID and course code's are not applicable, please insert <strong>N/A.</strong></p>")
    ,
    newTextInput("inputID")
        .settings.before(newText("ID:  "))
        .center()
        .print()
    
    ,
    
    newTextInput("inputName")
        .settings.before(newText("Name:  "))
        .center()
        .print()
        ,
        
         newTextInput("inputCoursecode")
        .settings.before(newText("Course code:  "))
        .center()
        .print()
        ,  
        
        
    newButton("Start")
        .print()
        .wait()
    ,
    newVar("ID")
        .global()
        .set( getTextInput("inputID") )
        ,
         newVar("Name")
        .global()
        .set( getTextInput("inputName") )
        ,
        
          newVar("Coursecode")
        .global()
        .set( getTextInput("inputCoursecode") )
)
.log( "ID" , getVar("ID") )
.log ("Name", getVar("Name"))
.log ("Course code", getVar("Coursecode"))
,
newTrial("trialintro",
 defaultText
        .print()
    ,
newText("<p>We will begin with a trial.</p><p>You will hear a word, please identify the first <strong>or</strong> last sound you heard by choosing the appropriate sound.</p>")
.settings.css("font-size", "xxem")
,
 newButton("Continue to trial")
        .print()
        .wait()
)

 

newTrial("trial1",
newAudio("description", "but.mp3")
.center()
    .print()
    .play()
,
newText("What sound did you hear?")
.center()
.print()
,

newImage('b' , 'b.png' )
    .settings.size(211, 167)
,
newImage('p' , 'p.png' )
    .settings.size(213, 170)
,
newImage('f' , 'f.png' )
    .settings.size(205, 159)
,
newImage('v' , 'v.png' )
    .settings.size(212, 173)
,

newCanvas( 'four letters', 700, 500)
    .settings.add( 128, 155, getImage('b'), 0 )
    .settings.add( 0, 146, getImage('p'), 1 )
    .settings.add( 257, 155, getImage('f'), 2 )
    .settings.add( 382, 147, getImage('v'), 3 )
    .center() 
    .print()
,
newSelector('four letters')
    .settings.add( getImage('p') , getImage('b'), getImage('f'), getImage('v') ) 
    .wait()
    .settings.log()
    ,
        
     getAudio("description")
    .stop()
    .log() 
    
        
)

newTrial("trial2",
newAudio("description", "peace.mp3")
.center()
    .print()
    .play()
,
newText("What sound did you hear?")
.center()
    .print()
,
newImage('b' , 'b.png' )
    .settings.size(211, 167)
,
newImage('p' , 'p.png' )
    .settings.size(213, 170)
,
newImage('f' , 'f.png' )
    .settings.size(205, 159)
,
newImage('v' , 'v.png' )
    .settings.size(212, 173)
,

newCanvas( 'four letters', 700, 500)
    .settings.add( 128, 155, getImage('b'), 0 )
    .settings.add( 0, 146, getImage('p'), 1 )
    .settings.add( 257, 155, getImage('f'), 2 )
    .settings.add( 382, 147, getImage('v'), 3 )
    .center()
    .print()
,
newSelector('four letters')
    .settings.add( getImage('p') , getImage('b'), getImage('f'), getImage('v') ) 
    .wait()
    .settings.log()
        
)
,

newTrial("mainintro",
 defaultText
        .print()
    ,
newText("<p>We will now move to the main experiment.</p><p>You will hear a word, please identify the first <strong>or</strong> last sound you heard by choosing the appropriate sound.</p>")
.settings.css("font-size", "xxem")
,
 newButton("Continue to experiment")
        .print()
        .wait()
) 



Template( variable => 
  newTrial("experiment",
    newAudio("description", variable.SoundFile)
        .play()
    ,
newText("What sound did you hear?")
.center()
.print()
,
   newImage('b' , 'b.png' )
    .settings.size(211, 167)
,
newImage('p' , 'p.png' )
    .settings.size(213, 170)
,
newImage('f' , 'f.png' )
    .settings.size(205, 159)
,
newImage('v' , 'v.png' )
    .settings.size(212, 173)
,

newCanvas( 'four letters', 700, 500)
    .settings.add( 128, 155, getImage('b'), 0 )
    .settings.add( 0, 146, getImage('p'), 1 )
    .settings.add( 257, 155, getImage('f'), 2 )
    .settings.add( 382, 147, getImage('v'), 3 )
    .center()
    .print()
,
newSelector('four letters')
    .settings.add( getImage('p') , getImage('b'), getImage('f'), getImage('v') ) 
    .wait()
    .settings.log()
    ,
    getAudio("description")
       .wait("first")
  )
  .log( "ID" , getVar("ID") ) 
  .log ("Name", getVar("Name"))
   .log ("Course code", getVar("Coursecode"))
  .log( "CorrAns"   , variable.CorrAns   )
  .log("Word", variable.SoundFile)
)




SendResults("send") 

newTrial( "final" ,
    newText("<p>Thank you for your participation!</p>")
        .print()
    ,
    newText("<p><a href='https://expt.pcibex.net/ibexexps/chahlabena/Identification/experiment.html'>Click here to validate your participation.</a></p>")
        .print()
    ,
    newButton("void")
        .wait()
)

Thank you!