Jeremy

Forum Replies Created

Viewing 15 posts - 901 through 915 (of 1,522 total)
  • Author
    Posts
  • in reply to: Ensure the audio files have been played before moving on #6804
    Jeremy
    Keymaster

    Hi Zara,

    Using .test.hasPlayed sounds like a good idea, and there would be a way to make it work. But if you want to automatically move on to the Selector element immediately after the second audio has played back, there is a simpler way: just insert getAudio("soundl").wait("first"),getAudio("soundr").wait("first") before the newSelector line. Because of the "first" argument, even if soundl is played after soundr, the two waits will be validated in a row because "first" in the second wait will automatically detect that soundr was played back before

    Let me know if that worked

    Jeremy

    Jeremy
    Keymaster

    Hi Matthias,

    You are not waiting for any interaction after your trial’s last command (.log()) so it moves on to the next trial before the participant can see anything. Simply stack .wait() below that .log() command and you will have ample time to read the question and press a key before your experiment moves on to the next trial 🙂

    Note however that your Text elements AnswerL/AsnwerR’s .print() commands are not executed in the scope of selector.add: that’s a bug, which I should fix, but anyway, you can move those .print() commands onto the newText commands. Note also that the Selector element simply makes elements “selectable,” it does not control their position on the page (except, marginally, through the shuffle command). If you want your two Text elements to be displayed on the same line, you can either use the after/before commands, or place them on a Canvas element (or pass coordinates to their print commands to position them relatively to the page, but in your case you probably want them to be printed below the preceding Text element “Question,” wherever that one ends up on the page)

    Jeremy

    in reply to: Choosing subet of items to present #6800
    Jeremy
    Keymaster

    But, anyway, would it assure that the items (experimental and fillers) are randomly selected for each participant?

    Yes, the script is run anew for each participant, so the randomize and sort(...) parts in particular will give you a (possibly) different output for each participant. This means that the pair of “A” trials will be random and (possibly) different for each participant, same thing for the pair of “B” trials and so on. The order in which those pairs are run will also be random and (possibly) different for each participant: one participant for example will see “E,E,filler-4,filler-1,C,C,…” and another one could see “C,C,filler-2,filler-3,A,A,…”

    Jeremy

    in reply to: Choosing subet of items to present #6798
    Jeremy
    Keymaster

    Hi Ana,

    If I understand you correctly, your cond column will go from A through H (8 conditions) with 4 rows for each letter (4 items).

    What I’m not clear about are your fillers: does your cond column go from filler-1 through filler-5 (5 types of fillers), with 4 rows for each one again (as hinted at by the repeated “1” in your example)?

    The other thing I am confused about is how you get 2 fillers between each experimental item, when you run a total of 2*8 = 16 experimental items while you have defined 5*4 = 20 filler items: if you want 2 fillers between each of the 16 experimental items (and assuming you don’t want to repeat any filler) then you will need a total of at least 15*2 = 30 fillers items (if you do not run another 2 filler items after the last experimental item)

    Maybe you meant “2 exp item + 2 fillers,” in which case you would need between 7*2 = 14 and 8*2 = 16 fillers items, so now you have defined too many: would you randomly pick 14 or 16 fillers out of the 20? This is what I will describe here anyway

    So what I would do is label the trials generated from your table by their cond (and item) columns, so you can refer to “A”, “B”, etc. and randomly pick 2 of each when building your sequence. Randomizing a set of labeled trials is pretty straightforward, for example you can randomize all the trials who label starts with A- with randomize(startsWith("A-")). In order to pick 2 trials out of this set, you will need the function pick defined in this thread, then you can simply do pick( randomize(startsWith("A-")) , 2 ). Finally, you can store all your pairs of trials in an array and shuffle the array to run the pairs in a random order:

    conditions = [
        pick(randomize(startsWith("A-")), 2),
        pick(randomize(startsWith("B-")), 2),
        // etc.
    ]
    .sort( ()=>Math.random()-0.5 ) // shuffle
    

    Here is a project that implements this idea: https://farm.pcibex.net/r/GtBCVh/

    Let me know if you have questions

    Jeremy

    Jeremy
    Keymaster

    I’m not sure what you mean: you’re already logging the Key element, and the printing of the Text element is the first thing that happens in the trial, so you get the response time by subtracting the event time in the result line for the trial’s start, from the event time in the result line for the Key element

    Jeremy

    Jeremy
    Keymaster

    Hi,

    The problem does come from the Sequence command indeed, although you can actually use it wherever you want, it does not matter to PennController.*

    There are a couple problematic aspects. First, you have two Sequence commands: the first one references trials labeled "experiment-trial2", the second one references trials labeled "experiment-trial". The second Sequence command overrides the first one, which is why the trials labeled "experiment-trial2" (presumably the ones you mean to run before the full experiment) end up not being included in your experiment run.

    Second, both your Sequence commands also reference trials labeled "instructions" and "send". However, one trial that you create is labeled "instructions2", so that one simply won’t be included in your experiment run. Moreover, there is no trial explicitly labeled "send": although it’s pretty clear to us humans that you want to include the trial generated by your SendResults() command, the program won’t just infer that, so you should explicitly label that trial by using SendResults("send") instead.

    Finally, you should also label your very last trial (“final screen”) and reference the label after "send" in the Sequence command, so that your final screen is indeed included as the very last screen in your experiment (after the results have been sent)

    Let me know if you have questions

    Jeremy

    * The only constraint is, if you use the prefix-less Sequence instead of PennController.Sequence, it must come after PennController.ResetPrefix(null)

    in reply to: Filled TextInput #6787
    Jeremy
    Keymaster

    Ah, I’m able to reproduce the issue if I select all the text and start typing in the expectation that it will overwrite the selected text: no (printing) character replaces the old text, which simply remains unedited (and still selected) in the input box. However, if I press the backspace key, the content is deleted as it should, and I can start typing successfully again.

    I didn’t notice it before because I just wouldn’t select the text at all; instead, I would place my cursor at the end of the text, press the backspace key twice and start typing. Am I describing the same issue as yours?

    Jeremy

    in reply to: Data repetition during collection #6785
    Jeremy
    Keymaster

    Hi Muxuan,

    Apparently the link to your pilot experiment was filtered out again, not sure why this seems to keep happening

    How are you implementing the test, precisely? You can take a look at this page from the advanced tutorial for an example of using a test before validating a click on a button. Note that you also need to explicitly tell the program to display any feedback: the tutorial illustrates that with getHtml("consent_form").warn(), but you will more commonlly use something like newText("Please do whatever before proceeding").print()

    Jeremy

    in reply to: Filled TextInput #6784
    Jeremy
    Keymaster

    Hi Anna,

    Thank you for the feedback and the suggestion. Which code are you referring to exactly? When I open https://farm.pcibex.net/r/SsqEZD/ and enter “AP” in the “age” textbox and try to click the button (regardless of whether I filled the other fields correctly) I get an error message, which disappears as soon as I start typing again in the textbox. If I click on the button again after typing a 2-digit number in the textbox (and with the other fields correctly filled) then the experiment proceeds.

    Did you include a Key element with callback as suggest in this message to have the error message automatically disappear upon keypress?

    Jeremy

    in reply to: .zip file problems #6777
    Jeremy
    Keymaster

    Hi,

    This is because you are trying to load https://maddiegilbert.com/abxziptest/abx_zipped.zip when you should load https://www.maddiegilbert.com/abxziptest/abx_zipped.zip

    Not sure why the policy does not transfer to the subdomain-prefix-less URL though

    Jeremy

    in reply to: Filled TextInput #6775
    Jeremy
    Keymaster

    Hi Kathy,

    This is because you’re testing that the content of your “country” TextInput should be empty: whenever you click the button and there is at least one character in that input box, your last test will fail and accordingly print the ‘errorcountry’ Text element. Because all the ands are attached to the first test on “job,” whenever one test fails it systematically triggers failure for that first one too (the “parent”), hence the printing of the “errorjob” Text element.

    So the solution is to make your test on ‘country’ check that there’s at least one character in the input box (see this message above) and, if you want to make each test’s failure independent from one another, you can insert a dummy test as the parent and make all the other ones children of that test:

    newFunction('dummy', ()=>true).test.is(true)
    // age
    .and( getTextInput("age").test.text(/^\d+$/)
    // ...

    (Note that you no longer need to move the last test up to the top of the stack in order for the error messages to show in the correct order, now that we’re using a dummy test as the parent)

    I have updated the code at the project whose demonstration link I shared in my previous post

    Jeremy

    in reply to: .zip file problems #6773
    Jeremy
    Keymaster

    Hi,

    The .htaccess file is not supposed to be publicly visible, so it’s a good sign that you can only access it when you’re logged in onto DreamHost. I get no error message when I preload your zip file in a project on farm.pcibex.net: the Log tab of the Debug window confirms that the download is successfull (“[14:15:16] Download of https://www.maddiegilbert.com/abxziptest/abx_zipped.zip complete (PennController: 0)”)

    Jeremy

    in reply to: Display timer as countdown #6770
    Jeremy
    Keymaster

    Hi Sam,

    Here is a code that illustrates the basic idea:

    newVar("finishTime").set(v=>Date.now()+90000) // 90000 = 90s = 1min30s
    ,
    newText("countDown", "1m30s").print()
    ,
    // This Timer element will execute a callback after 1s
    newTimer("updateCountdown",1000).callback( 
        newVar("difference")
            .set(getVar("finishTime")).set(v=>v-Date.now())
            .test.is(v=>v>0) // Positive value means current time still below finish time
            .success(
                // Transform the Var element into an appropriately formatted string
                getVar("difference")
                    .set(v=>Math.trunc(v/60000)+"m"+Math.round((v/1000)%60)+"s")
                ,
                getText("countDown").text(getVar("difference")) // Update the Text element
                ,
                // Relaunch the timer to update again in 1s
                getTimer("updateCountdown").start()
            )
    ).start() // Don't forget to start the timer initially

    You can see it live here: https://farm.pcibex.net/r/hvXkjO/

    Jeremy

    in reply to: Mouse Tracking Data Analysis #6763
    Jeremy
    Keymaster

    Hello,

    The new documentation has not been updated with it yet, but there is an R script on the old documentation page of the MouseTracker element. The first four numbers (preceded by w, h, x and y) report the width and height of the page, and the x/y coordinates of the mouse when the MouseTracker element’s start command is executed. After that, the string is a series of triplets of numbers, each triplet is prefixed with t and the numbers are separated by +/-: the first number is the number of milliseconds that have elapsed since the previous triplet (t is for “time”), the second number is how many pixels the mouse moved horizontally (+ = right, - = left) and the third number is how many pixels the mouse moved vertically (+ = down, - = up)

    Jeremy

    in reply to: Troubleshooting #6758
    Jeremy
    Keymaster

    Hi Juliana,

    So if you turn the Debugger back on, you’ll get an error message saying “Format of table is invalid.” That message disappears once I remove all the " characters from your table, and the experiment then proceeds normally. You should in theory be able to use those characters, so I’ll have to investigate what’s happening. Fortunately for you, you don’t actually need them in your table, as your sentences don’t contain any commas (which are otherwise used to separate columns)

    Jeremy

Viewing 15 posts - 901 through 915 (of 1,522 total)