multanip

Forum Replies Created

Viewing 5 posts - 31 through 35 (of 35 total)
  • Author
    Posts
  • multanip
    Participant

    Yes, what you wrote is what I want. I want first and the last picture to remain on the screen for 400ms before moving on. tbe audio one needs to rmain until it finishes but there still needs to be 400 ms gap after the audio is finished.
    I Tried that already for each of the images except the last image before it moves to the enxt item in the group (newTimer(“displayTime”, 400).start().wait(),), it didn’t work properly. Either it didn’t work or it showed the middle image or the first imaage but not all of them. I removed or at least put double // to turn all the new key inot comment so it does’n interfere. I started getting error messages.
    I will try agian.

    multanip
    Participant

    This is the most recent script. still no luck in figuring out how to move automaticallz to next image or page automatically

    PennController.ResetPrefix(null) // Keep this here
    PennController.DebugOff()
    //The experiment is design for Eng based study 
    //CREDIT: The credit for the picture and Audio to Psychling lab and Dr. Dato for all the files
    //Credit: the script was learned and borrowed from PCIbex website
    //
    //Resources such as audio and video are located in a server
    PreloadZip("https://psyli-lab.research-zas.de/Eye-tracking_eng_Priya/Eyetracker_eng_resources/Images.zip")
    PreloadZip("https://psyli-lab.research-zas.de/Eye-tracking_eng_Priya/Eyetracker_eng_resources/Audio.zip")
    PreloadZip("https://psyli-lab.research-zas.de/Eye-tracking_eng_Priya/Eyetracker_eng_resources/Neutral.zip")
    
    //URL where the PHP and data is stored 
    EyeTrackerURL("https://psyli-lab.research-zas.de/Eye-tracking_eng_Priya/Eyetracker_eng_results/Eng_eyetracker_priya.php")
    
    var showProgressBar = false;
    
    //Sequence of the experiment
    Sequence("Preload","Welcome","Webcam_Check","ChromeCheck","L1Check","Introduction","Consent","QuestionairePage","WebcamSetUp","AudioSetUp","Instructions","Counter",randomize("eyetracking"),"Send","Exit")
    // CheckPreloaded
    CheckPreloaded("Preload")
    
    //Welcome message
    newTrial("Welcome",
        newVar("Subject", randomnumber = Math.floor(Math.random()*1000000))
            .global()
            .log()
        ,
        newText("WelcomeMessage", "<b>Hello and Thank you very much for participating in our eye-tracking experiment.</b><br><br>Before we proceed, we have three quick questions.</b> <br><br>Please press the <b>SPACEBAR</b> to continue.")
        ,
        newCanvas("InstructionsCanvas", "80vw" , "40vh")
            .add(0,0, getText("WelcomeMessage"))//https://farm.pcibex.net/r/wqCsWk/experiment.html?test=true
            .print("center at 50%", "top at 25%")
        ,
        newKey("next", " ")
            .wait()
    )
    //.setOption("hideProgressBar", true)   
    
    
    //Asking Participants whether they give permission to the Webcam, reminder to use chrome, and English language skill L1. If answer 'no' to any of these questiosn, they cannot participate in the experiment.
    newTrial("Webcam_Check",
        newText("Permission_Webcam", "Question 1:<br><br> In order to be able to record your line of sight on the computer screen, we ask for permission to access your webcam. We will <b>not</b> record a video of you or collect any other data that allows conclusions to be drawn about your identity. Do you give your permission for us to access your webcam?")
        ,
        newText("No_Permission", "<p><b>No, I don't give permission.</b><br>Click the 'N' on the keyboard</p>")
        ,
        newText("Yes_Permission", "<p><b>Yes, I give permission.</b><br>Click the 'Y' on the keyboard</p>")
        ,
        newCanvas("ChecksCanvas", "60vw" , "20vh") 
            .add("center at 50%", "top at 10%", getText("Permission_Webcam"))
            .add("center at 20%", "top at 80%", getText("Yes_Permission"))
            .add("center at 80%", "top at 80%", getText("No_Permission"))
            .print("center at 50%","top at 25%")
        , 
        newKey("yes_no", "NY")
            .wait()
        ,
        getKey("yes_no")
            .test.pressed("Y")
            .failure(
                getCanvas("ChecksCanvas")
                    .remove()
                ,
                newCanvas("No_Permission", "60vw" , "20vh")
                    .add("center at 50%", "top at 10%", newText("Unfortunately, you cannot participate in this study. Please close this window by ending the browser session, possible pop-up windows can be ignored."))
                    .print("center at 50%", "top at 25%")
                ,
                newButton("waitforever")
                .wait()
            )
    )
    
    //Chrome
    newTrial("ChromeCheck",
        newText("ChromeCheckText", "Question 2:<br><br>The display and the course of the experiment will only work without problems if you use the Google Chrome browser on a laptop or desktop computer (not on a smartphone or tablet). Are you currently using Google Chrome?</p>")
        ,
        newText("NoChrome", "<p><b>No, I'm not currently using any of the options</b><br>Click the 'N' on the keyboard</p>")
        ,
        newText("YesChrome", "<p><b>Yes, I'm currently using Chrome Browser</b><br>Click the 'Y' on the keyboard</p>")
        ,
        newCanvas("ChecksCanvas", "60vw" , "20vh")
            .add("center at 50%", "top at 10%", getText("ChromeCheckText"))
            .add("center at 20%", "top at 80%", getText("YesChrome"))
            .add("center at 80%", "top at 80%", getText("NoChrome"))
            .print("center at 50%", "top at 25%")
        ,
        newKey("yesno", "NY")
            .wait()
        , 
        getKey("yesno")
            .test.pressed("Y")
                .failure(
                getCanvas("ChecksCanvas")
                    .remove()
                ,
                newCanvas("NoChrome", "60vw" , "20vh")
                    .add("center at 50%", "top at 10%", newText("Unfortunately, the experiment only works with Google Chrome (which can be downloaded for free). Please close this window by ending the browser session (possible pop-up windows can be ignored) and open the link to the experiment again with Google Chrome."))
                    .print("center at 50%", "top at 25%")
                ,
                newButton("waitforever")
                    .wait()
            )
    )
    
    //Language check
    newTrial("L1Check",
        newText("L1CheckText","Question 3:<br><br> In order to take part in this study, you must speak <b>English as your mother tongue</b>. Is English your mother tongue?</p>")
        ,
        newText("NoL1","<p><b>No, English is not my mother tongue</b><br>Click 'N' on the keyboard<b><p>")
        ,
        newText("YesL1","<p><b>Yes, English is my mother tongue</b><br>Click 'Y' on the keyboard</b></p>")
        ,
        newCanvas("ChecksCanvas", "60vw" , "20vh")
            .add("center at 50%", "top at 10%", getText("L1CheckText"))
            .add("center at 20%", "top at 80%", getText("YesL1"))
            .add("center at 80%", "top at 80%", getText("NoL1"))
            .print("center at 50%", "top at 25%")
        ,
        newKey("yesno", "NY")
            .wait()
        ,
        getKey("yesno")
            .test.pressed("Y")
                .failure(
                getCanvas("ChecksCanvas")
                    .remove()
                ,
                newCanvas("NoL1", "60vw" , "20vh")
                    .add("center at 50%", "top at 10%", newText("Unfortunately, you are not eligible to participate in this study. Please close this window by ending your browser session (any pop-up windows can be ignored.)"))
                    .print("center at 50%", "top at 25%")
                ,
                newButton("waitforever")
                    .wait()
            )
    )
    
    //Introduction
    newTrial("Introduction",
        newText("IntroductionText","<b>Thank you for answering the questions about the system requirements!</b><br><br>The eye-tracking experiment will be very simple and will take about 10-15 minutes. Look at the three pictures and listen to the sentence for the middle picture. <br><br>Your task is to look at the images and the content of the spoken sentences as closely as possible. Press SPACE to continue in between pictures and trials. During the entire experiment, please try to sit as still as possible but comfortably and never take your eyes off the computer screen.<br><br>We will <b>not</b> record a video of you or collect any other data that allows conclusions to be drawn about your identity. We will only collect data related to your eye movements on the computer screen.<br><br>It is important that you are in a well-lit and quiet environment, otherwise the webcam will not be able to detect your eye movements. Please turn off any music and other applications and websites (such as cell phones, email notifications, etc.) that could distract you during the experiment.<br><br>The next pages will be displayed in full screen mode. Please do not close the full screen for the remainder of the experiment.<br><br>Click the <b>SPACEBAR</b> to continue.")
        ,
        newCanvas("InstructionsCanvas", "60vw" , "20vh")
            .add(0,0, getText("IntroductionText"))
            .css("front-size","25px")
            .print("center at 50%", "top at 25%")
        ,
        newKey("next", " ")
            .wait()
        ,
        fullscreen()
    )
    //.setOption("hideProgressBar",true)
    
    //Consent Form
    newTrial("Consent",
        newHtml("consent_form","consent_pilot_5item_eng.html")
            .center()
            .cssContainer({"width":"720px"})
            .checkboxWarning("You must give your consent to continue.")
            .print()
        ,
         newButton("continue", "Click here to continue.")
            .center()
            .print()
            .wait(getHtml("consent_form").test.complete()
                      .failure(getHtml("consent_form").warn())
            )
    )
    //.setOption("hideProgressBar", true)
    
    //Participant Questionaire
    newTrial("QuestionairePage",
        newHtml("Questionnaire","questionnaire_pilot_eng.html")
            .center()
            .cssContainer({"width":"720px"})
            .checkboxWarning("You must give your consent to continue.")
            .print()
        ,
        newButton("continue","Click here to continue.")
            .center()
            .print()
            .wait(getHtml("Questionnaire").test.complete()
                      .failure(getHtml("Questionnaire").warn())
            )
    ) 
    //.setOption("hideProgressBar", true)
    
    
    //Set up the webcam:need calibrtion, the resources will preload at the same time. 
    newTrial("WebcamSetUp",
        newText("WebcamSetUpText", "The next few pages will help you set up the webcam and audio player. The webcam is set up through a simple calibration process. You will see video of the webcam recording during the calibration process. As previously mentioned, we will not store any footage of these webcam recordings. Please make sure your face is fully visible and that you are centered in front of your webcam.<br><br>You can start the calibration process when the box is GREEN by clicking the start button that will appear in the center of the computer screen.<br><br>During the calibration process, you will see eight dots on the screen. Please click on all these points and follow the mouse pointer closely with your eyes. Once you have clicked all the dots, a new dot will appear in the middle of the screen. Please click on this dot and <b>look at it for three seconds</b> so that the algorithm can check if the calibration process was successful.<br><br>If the calibration fails, the last step repeated again. <br><br> Press <b>SPACEBAR</b> to continue.")
            .center()
            .print()
        ,
        newKey("next", " ")
            .wait( newEyeTracker("tracker").test.ready())
        ,
        fullscreen()
        ,
        // Start calibrating the eye-tracker, allow for up to 3 attempts
        // 50 means that calibration succeeds when 50% of the estimates match the click coordinates
        // Increase the threshold for better accuracy, but more risks of losing participants
        getEyeTracker("tracker").calibrate(5,3)
      )
      .noHeader()
      //.setOption("hideProgressBar", true)
    
    // Audio set-up
    newTrial("AudioSetUp",
        newText("AudioInstructions", "The webcam is now calibrated so that the audio player can be set up in the next step. In this experiment, you will hear several sentences. You can play a sample sentence that will appear in this study by pressing the play button. Please use the audio recording to adjust the volume as well. You can play this sample set as many times as you like. Once you're ready, you can go to the next page.")
        , 
        newAudio("cocktail","02_1_b_test.wav") ///ADDD EXAMPLE WAV TO CHECK 
        ,
        newCanvas( "myCanvas", "60vw" , "60vh")
            .settings.add(0,0, getText("AudioInstructions"))
            .settings.add("center at 50%", "top at 20%", getAudio("cocktail"))
            .print("center at 50%", "top at 25%")
        ,
        newButton("Next Page")
            .center()
            .print("center at 50%", "top at 70%")
            .wait()
    )
        .setOption("hideProgressBar", true)
    
    // Experiment instructions//
    newTrial("Instructions",
        newText("TaskInstructions", "<p>We are ready to start the experiment! First will be a practice round and then the experiment round. <b>PLEASE keep your gaze FIXED</b> on the computer at ALL TIMES and head must remain still.<br><br>In BOTH practice and experiment round, <b>DO NOT</b> scroll or move up and down or sideways, <b>ONLY</b> or <b>DO as Instructed</b>.<br><br>BEFORE each section, a green dot will appear in the middle of the screen for web re-check. Just look at it <b>for THREE SECONDS</b>. IF the camera is still calibrated, it will continue, otherwise the computer will recalibrate. In Practice and Experiment, you will see a action picture followed by static picture with audio and a final action picture and <b>DO NOT TOUCH THE MOUSE DURING THIS SCREEN</b>. You <b>MUST QUICKLY</b> only look at the picture and then <b>Press SPACEBAR</b>.</b> <br><br> We will now start with the trial run and then the experimental run. It should take approximately 15-20 minutes.")
        ,
        newCanvas("myCanvas", 800 , 300)
            .settings.add(0,0, getText("TaskInstructions"))
            
            .print("center at 50%", "top at 25%")
        ,
        newButton("Begin the Experiment")
            .center()
            .print("center at 50%", "top at 70%")
            .wait()
    )
    //.setOption("hideProgressBar", true)
    //.setOption("hideProgressBar", true)
    
    SetCounter("Counter", "inc", 1);
    
        //.setOption("hideProgressBar", true)
    
    //Experimental trial
    Template("EyeTracking_english.csv", row=>  // all newText commands will automatically print the text centered when run
        newTrial("eyetracking",
            defaultImage.center().print(),     // all newImage commands will automatically print the image centered when run
            defaultImage.size(400,300).print(),
            defaultText.center().print()
        ,
        newEyeTracker("tracker",1).callback( function (x,y) {
            if (this != getEyeTracker("tracker")._element.elements[0]) return;
            getEyeTracker("tracker")._element.counts._Xs.push(x);
            getEyeTracker("tracker")._element.counts._Ys.push(y);
            })
        ,
        newFunction(()=>{
            getEyeTracker("tracker")._element.counts._Xs = [];
            getEyeTracker("tracker")._element.counts._Ys = [];
        }).call()
        ,
            getEyeTracker("tracker")
                .calibrate(5)  // Make sure that the tracker is still calibrated
                .log()  // log the calibration scores
        ,
        newTimer("pre-trial", 250).start().wait()
        ,
        newImage("image1", row.main_picture), // the first image is set in design.csv
        newText("pressSpace", "Press Space to move on"), // some instructions so the participant knows what to do
        newKey("space", " ").wait(),
        getImage("image1").remove(),getText("pressSpace").remove(),// take the image and text off the page after the keypress
        newTimer("mid-image", 400).start().wait() // wait 400ms before moving on to the next image
        .log()
        ,
        newImage("image2", "Neutral.jpg"),// we always use middleImage.png as the middle image
        newAudio("audio", row.wav_file).play(), // the audio file is set in design.csv
        newText("AudioSpace", "Please wait for the audio to finish and then press Space").print(), // we reuse the same Text element as before (same instructions)
        getKey("space").wait(), // we reuse the same Key element as before (keypress on Space)
        getAudio("audio").wait("first"), // wait until the Audio element has finished playing back
        getImage("image2").remove(),getText("AudioSpace").remove(),
        newTimer("last-image", 400).start().wait() //wait 400ms befoere moving to the last iamge
        .log()
        ,
        newImage("image3", row.end_picture), // the third image is set in design.csv
        getText("pressSpace").print(),
           getKey("space").wait(),
            getImage("image3").remove(),getText("pressSpace").remove(),
            newTimer("post-trial", 250).start().wait()
            .log()
            ,
           // newTimer("post-trial", 250).start().wait() // wait 250ms before moving on to the next trial
            //,
            getText("pressSpace").print(),
            getKey("space").wait()
            .center()
        )
    .noHeader()
      .log("group"                  ,row.group)
      .log("Condition"              ,row.Condition)
      .log("ID_No"                  ,row.ID_No)
      .log("main_picture"           ,row.main_picture)
      .log("end_picture"           ,row.end_picture)
      .log("ID_No"                   ,row.ID_No)
      .log("ViewportWidth" 	    	,window.innerWidth	 		) // Screensize: width
      .log("ViewportHeight"	    	,window.innerHeight 		) // Screensize: heigth
    )
    
    SendResults("Send");
    
    //Exit
    newTrial("Exit",
        exitFullscreen()
        ,
        newText("Final","Thank you. This is the end of the experiment, you can now close this window. Thank you!")
        ,
         newCanvas("myCanvas", "60vw" , "60vh")
            .settings.add(0,0, getText("Final"))
            .css("font-size", "1.1em")
            .print("center at 50%", "middle at 50%")
        ,
        newButton("waitforever")
            .wait() // Not printed: wait on this page forever
    )
    in reply to: design three page experiment with loop #8363
    multanip
    Participant

    thank you so much. I will get started with the recommendation above and the script. Thank you so much.
    I have actually gone through some of these pages already.
    I wanted know for future references. I can’t keep asking for scripts. how does one know what to put into script to indiviualize it? is just through the documentation provided and sheer practicing skills?

    in reply to: design three page experiment with loop #8361
    multanip
    Participant

    also since its an eyetrackign study. I cant have next button, i think it needs to automatic. Also in between iamges in set I would need to have 400 ms gap. I understand that could be done with the code. newTimer(400).start().wait() I believe.

    in reply to: design three page experiment with loop #8360
    multanip
    Participant

    Yes, this is what I wanted. the middle image is same with different sound. in between each set i just need a break screen. but I don,t have enough coding experience to even know where to start. i understand the log() part. I tried to use the code from the experiment about the “the game master” and the deck of cards but that just led to errors. How do I write the code for something like this? do you have example for this?
    I thought about the using the example from the basic tutorial but I don#t know how to change it.
    Do you have example code for the example above? or where I can start? I will make a new csv file like the one u have.
    thank you.

Viewing 5 posts - 31 through 35 (of 35 total)