Jeremy

Forum Replies Created

Viewing 15 posts - 196 through 210 (of 1,522 total)
  • Author
    Posts
  • in reply to: Printing NewText with parts of the text colored/bolded #9928
    Jeremy
    Keymaster

    Hi Kate,

    You can use HTML in Text elements, like this:

    newText("Please press<br><span style='color:green;margin-right:5em;'><strong>F</strong> for <strong>YES</strong></span> <span style='color:red;'><strong>J</strong> for <strong>NO</strong></span>")

    Jeremy

    Jeremy
    Keymaster

    Hi Sanghee,

    1. Your Sequence command references the label "practiceSession" but the newTrial command in Template labels trials "PracticeSession" (capital P)

    2. You’re using AddHost in place of PreloadZip

    Jeremy

    Jeremy
    Keymaster

    Hi Sanghee,

    You have a line that reads var showProgressBar = True; in your script, when it should be var showProgressBar = true; — since True (capital T) refers to nothing in your script, it simply crashes on that line and fails to create the trials you define below, resulting in no items in the running order

    Jeremy

    in reply to: Item numbers the same accross trials? #9921
    Jeremy
    Keymaster

    Hi,

    It depends on what exactly you mean by item number:

    1. there is an Ibex-internal notion of item number, which corresponds to an index in the items array
    2. there is a PennController-specific notion of “trial” number, which corresponds to when the PennController trial was created (newTrial commands inside Template commands are executed after non-embedded newTrial commands, so the former have greater trial numbers than the latter)
    3. then there is the notion of an item/trial’s runtime number, which would correspond to when the participants saw that trial relative to the other ones; this is not reported by default anywhere in the results file, but you could keep track of that with a global Var element that you increase at the beginning of each trial
    4. finally, you could have a column named “item” in your table, whose values you decide how to assign; if you have a latin-square design for example, you could decide to have the same value in multiple rows that correspond to different groups

    The numbers associated with points 1 and 2 will be the same across participants: no matter the actual sequence of trials they see, those “item numbers” will always be the same, so the question associated with item #189 in this sense will always be the same. The number associated with point 3 can obviously vary from one run to the other, since it corresponds to the runtime “item number,” so the question associated with item #189 in this sense could vary. As for the number associated with point 4, it will depend on what you decide to do with your design; if you have multiple rows with 189 in the “item” column but a different string in the “question” column, then item #189 will not always be the same question

    Jeremy

    in reply to: Pre-determined line breaks in self-paced reading experiment #9920
    Jeremy
    Keymaster

    Hello,

    The DashedSentence controller does accept the \n character as a linebreak, but when looking up the table Template reads that sequence as two characters (\+n) which in a javascript string you would write as \\n

    The solution is to replace all occurrences of \\n with \ns: row.acceptability.replace(/\\n/g,"\n")

    Jeremy

    in reply to: Changing the location of the Progress Bar #9919
    Jeremy
    Keymaster

    Hi Mete,

    If you want the bar’s bottom edge aligned with the bottom edge of the page’s frame as scrolled (when applicable) then you need to do this:

    (()=>{
        let bar;
        (function barAsLast(){
            bar = bar || document.querySelector("#bod table:first-child");
            if (bar) {
                if (document.body.scrollHeight > window.innerHeight) {
                    bar.style.position = 'unset';
                    bar.style.bottom = 'unset';
                    bar.style.left = 'unset';
                    bar.style.transform = 'unset';
                    let pc = document.querySelector("p.PennController-PennController");
                    if (pc) pc.append(bar);
                    else (document.querySelector("#bod table:last-child")||document.body).append(bar);
                }
                else {
                    bar.style.position = 'absolute';
                    bar.style.bottom = '0px';
                    bar.style.left = '50vw';
                    bar.style.transform = 'translateX(-50%)';
                    document.body.prepend(bar);
                }
            }
            window.requestAnimationFrame(barAsLast);
        })();
    })();

    When there’s no vertical scroll bar, the bar will “jump” to the bottom of the visible frame, but when there is a scroll bar, then it will be placed below all the content that comes before it (ie. you’ll need to scroll down to see it)

    Jeremy

    in reply to: Fit pictures of different size to selector #9902
    Jeremy
    Keymaster

    Hi,

    I answered this question via email, but I’m posting the answer here too for other users

    The simplest solution in this case is to simply set a max-height and max-width on the Image elements to the same dimensions of the containing Canvas elements:

    newCanvas("left", 500, 290)
        .add(  "center at 50%" , "middle at 50%" , getImage("target").css({"max-height":"290px", "max-width":"500px"})),
    
    newCanvas("right",500, 290)
        .add(  "center at 50%" , "middle at 50%" , getImage("foil").css({"max-height":"290px", "max-width":"500px"})),

    Jeremy

    in reply to: Scale feedback and timeout #9901
    Jeremy
    Keymaster

    Hi,

    I wrote a simplified version of your trial where I took out some elements for the sake of illustration. The main takeaway is that, since all three scenarios (correct choice, incorrect choice, no choice) end the same way (print “press a key” and wait for a keypress) you don’t have to repeat that sequence of events three times, you can write it just once at the end of the trial instead (you also don’t have to use a Var element to check the value of a column, you can pass it directly to test):

    newTrial(row.condition,
        defaultText.center().print()
        ,
        newText("prueba", "<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>")
        ,
        newTimer("timer", 7000)
        ,
        newScale("acceptability_checks", 7)
                .before(newText("<p style=font-family:lucilda margin-right:2em><i>completamente inaceptable</i></p>"))
                .after(newText("<p style=font-family:lucilda><i>completamente aceptable</i></p>"))
                .callback( getTimer("timer").stop() )
                .button()
                .keys()
                .center()
                .print()
                .log("all")
        ,
        getTimer("timer").start().wait()
        ,
        clear()
        ,
        getScale("acceptability_checks")
            .test.selected()
            .success(
                getScale("acceptability_checks").test.selected(row.check)
                    .success( newText("<p style=font-family:helvetica;color:darkgreen padding-bottom: 25px>¡Correcto!</p>") )
                    .failure( newText("<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Incorrecto!</p>") )
            )
            .failure( newText("lento","<p style=font-family:helvetica;color:red padding-bottom: 25px>¡Muy lento!</p>") )
        ,
        newText("<p style=font-family:helvetica>Presione la barra espaciadora para continuar</p>")
        ,
        newKey(" ").wait()
    )
    .log("group", row.group)
    .log("item", row.item)
    .log("condition", row.condition)

    Jeremy

    in reply to: click button and file attachment #9899
    Jeremy
    Keymaster

    Hello Eleni,

    Currently you’re inserting a trial labeled “sep” between your experimental trials, which uses Ibex’s Message controller to display some text, and invites participants to use a keypress since you use transfer: "keypress". You could use transfer: "click" instead if you wanted participants to invite the participants to click instead (you can set continueMessage to a custom message if you’d like)

    You cannot use the PCIbex Farm to host a file that you invite your participants to download. But if you have another hosting solution and have a direct link to that file, then you can use the HTML tag <a>, as in <a href="https://link.to.your/file" target="_blank" download="filename.ext">Click here to open/download the file</a>

    Jeremy

    in reply to: Changing the location of the Progress Bar #9898
    Jeremy
    Keymaster

    Hi Mete,

    You could use javascript to make sure the progress bar is always the last element on the page. Assuming you’ll always either have PennController trials or native-Ibex trials, placing the following at the very top of your script (before PennController.ResetPrefix) should do the job:

    (()=>{
        let bar;
        (function barAsLast(){
            bar = bar || document.querySelector("#bod table:first-child");
            if (bar) {
                let pc = document.querySelector("p.PennController-PennController");
                if (pc) pc.append(bar);
                else (document.querySelector("#bod table:last-child")||document.body).append(bar);
            }
            window.requestAnimationFrame(barAsLast);
        })();
    })();

    Jeremy

    in reply to: Logging randomly generated IDs for MTurkers #9897
    Jeremy
    Keymaster

    Hi Jun,

    Your “ID” trial comes after your SendResults, so whatever the participant types after that point just won’t be sent as part of the results

    Jeremy

    in reply to: Logging randomly generated IDs for MTurkers #9895
    Jeremy
    Keymaster

    Hi Jun,

    Do you mind sharing the raw content of your HTML file? You can either post the code or share your experiment’s URL on this thread, or send it at support@pcibex.net if you don’t want to share it publicly

    Jeremy

    in reply to: response timeout #9894
    Jeremy
    Keymaster

    Hi,

    As long as you keep the 200ms timer before removing the Canvas, you should see the frame for 0.2s:

    newTimer("timeout", 5000)
    ,
    newSelector("pal_sel")
        .add(getText("pal1"), getText("pal2"), getText("pal3"))
        .frame("dashed 3px violet")
        .log()
        .callback( getTimer("timeout").stop() )
    ,
    getTimer("timeout").start().wait()
    ,
    newTimer(200).start().wait()
    ,
    getCanvas("canvas12").remove(),

    Jeremy

    in reply to: NULL results in the data #9882
    Jeremy
    Keymaster

    Hi Meri,

    I apologize, I seem to have missed your initial message. Let me answer the last three, unanswered questions:

    2) The “buffer” lines report when the audio started the play but had to pause because not enough data had been downloaded to play fully. This can be pretty useful to determine whether participants had a smooth playback experience, as some experimental designs require time-sensitive measures

    3) This is a problem with how the farm saves edits your bring to a file. When this happens, the solution is to create a new file, paste the code you have in the new file, and then delete the original file, to force the farm to take the latest updates into account

    4) This error comes from the original IBEX and is pretty generic. It tends to happen when there is a syntax error in the script and the items variable fails to be created as a result. The bug I mention in #3 makes it more likely to occur, especially if the farm saved your script as you were typing and therefore stored an incomplete code

    Jeremy

    in reply to: Audio replay only once #9881
    Jeremy
    Keymaster

    Oops, I copied and pasted the code from my previous message but completely forgot to edit it!

    I’ve updated my message, the commands are now in the appropriate order

    Apologies
    Jeremy

Viewing 15 posts - 196 through 210 (of 1,522 total)