zoe_f

Forum Replies Created

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • in reply to: Behavioural task score #5546
    zoe_f
    Participant

    Dear Jeremy,

    You are absolutely right, this was the problem! Thank you so much. My apologies for wasting your time on such a trivial fix; the update to 1.8 (which I thought I’d synced, but evidently not) was the issue, and indeed now the test runs, and the ‘score’ variable updates and prints perfectly.

    Thanks again,

    Zoë

    in reply to: Behavioural task score #5542
    zoe_f
    Participant

    Hello again Jeremy,

    Thank you for this response.

    Unfortunately and mysteriously, the code above does not run as expected. It still goes directly to the next trial after pressing a valid key, meaning that even when outside of the .callback element, the getKey(“question1”) test does not run and no text is printed. (Like I mentioned in my last post, the text printing isn’t actually what I want to do, I’m just using it as a toy example to make it clearer what code should be running when. Eventually the ‘success’ test that I want to implement is whether they pressed the correct key, and then update the ‘score’ variable. But first I have to get a test command to actually run!).

    I must be using a Timer element wrong. The the only way I can get the test to run and the text to print (code below) is if I remove the getTimer(“window”).stop() from the .callback function, but then of course the trial continues for 5s even if a valid key is pressed, and of course it’s at the end of this 5s that the text prints (putting the getTimer(“window”).wait() after the getKey().test.pressed call also, naturally, results in no evaluation of the test.pressed function and immediately starts the next trial when a valid key is pressed, the same as the code in your last response).

    In any case, you’ve given quite a few responses to this so far, I totally understand if you don’t have time to give another response. I just figured I should give an update on what was/wasn’t working. I guess I’ll need to bump around the Timer commands and see what gives.

    Thank you so much!

    Zoë

    Template("recall_practice_stimuli.csv",
        row => 
        newTrial("recall-"+row.block,
        newVar("score", 0).global(),
        newText(row.item)
            .center()
            .css("font-size", "2em")
    	    .css("font-family", "verdana")
            .print()
        ,
        newText("instruction", "Which condition did you encounter this word experiment? Press the F KEY for INNER, the J KEY for OUTER, and the SPACEBAR for NEW WORD")
            .print()
        
        ,
        newTimer("window", 5000).start()
        ,
        newKey("question1", "FJ ")
            .log()
            .callback(
                getText(row.item).remove()
                ,
                getText("instruction").remove()
                
            )
         ,
        getTimer("window")
            .wait()    
        ,
        getKey("question1")
            .test.pressed("F")
            .success(
                newText("Good job!").print()
                ,
                newTimer(1000).start().wait()
        
            )
        )
        .log(row.item)
        .log(row.Group)
        .log(row.condition)
        .log(row.correctKey)
        .log("score", getVar("score"))
    );
    in reply to: Behavioural task score #5445
    zoe_f
    Participant

    Hello Jeremy,

    Thank you so much for your response. That really does clarify why my .test.pressed wouldn’t be evaluated…there’s no time!

    However, I’ve tried implementing this, and the problem is that it still won’t read the .test.pressed line. Here’s my code: I implemented the .callback that you provided, and to narrow down what the problem was, I simplified the test.pressed to test for “F” and print a message when that is done.

    Template("recall_practice_stimuli.csv",
        row => 
        newTrial("recall-"+row.block,
        newVar("score", 0).global(), 
        newText(row.item)
            .center()
            .css("font-size", "2em")
    	.css("font-family", "verdana")
            .print()
        ,
        newText("instruction", "In which condition did you encounter this word in the experiment? Press the F KEY for INNER, the J KEY for OUTER, and the SPACEBAR for NEW WORD")
            .print()
        ,
        newTimer("window", 5000)
            .start()
        ,
        newKey("question1", "FJ ")
            .log()
            .callback(
                getText(row.item).remove()
                ,
                getText("instruction").remove()
                ,
                getKey("question1")
                    .test.pressed("F")
                    .success(newText("Good job!").print())
                ,
                getTimer("window").stop()
                )
        ,
        getTimer("window")
            .wait()
        )
        .log(row.item)
        .log(row.Group)
        .log(row.condition)
        .log(row.correctKey)
    );

    So, the problem is that when I press “F” at the Key Press, it just takes me to the next trial with no ‘Good job!’ output. I must be doing something wrong with the .callback element (I suspect I may be using the Timer element wrong which in turn impacts .callback?); any insight would be appreciated.

    Thank you so much for your replies so far!

    Best wishes, Zoë

    in reply to: Behavioural task score #5401
    zoe_f
    Participant

    Hello there!

    I’m still wrestling with this bit of code. Basically, I want to display the score variable after all trials, not at the end of each. So the code below is the task where the score variable is referenced and updated (‘recall’ Template) and the one-off ‘score_time’ Trial which displays the score variable.

    The problems are twofold, and related: 1) where to put the score variable, and 2) how to access the score variable. I launch ‘score’ as a global variable every time, but:
    – when I launch the score variable inside the ‘recall’ Template, it is not referenced later in the ‘score_time’ Trial, and ‘score_time’ only displays: ‘Your score on the recall task was: ‘ with no number (so I guess it didn’t find the ‘score’ Variable)
    – when I launch the score variable outside the ‘recall’ Template, the recall score always prints as 0 in the ‘score_time’ Trial (no matter how many correct Keys I press in the trials). So I guess my code under the “question1” Key for test.pressed is not working.

    Given this, it seems that launching the global score variable outside the ‘recall’ Template will at least get that variable accessible, but then I must do something that allows its value to be changed trial-by-trial, and displayed in its final, updated form at the very end. Any errors you can spot below, or any guidance you have, would be very much appreciated. Thank you so much!

    Template("recall_practice_stimuli.csv",
        row => newTrial("recall-"+row.block,
        newVar("score", 0).global(), // score variable
        newText(row.item)
            .center()
            .css("font-size", "2em")
    	.css("font-family", "verdana")
            .print()
        ,
        newText("instruction", "Which condition did you encounter this word experiment? Press the F KEY for INNER, the J KEY for OUTER, and the SPACEBAR for NEW WORD")
            .print()
        ,
        newTimer("window", 5000)
            .start()
        ,
        newKey("question1", "FJ ")
            .log()
            .test.pressed(row.correctKey)
                .success(getVar("score").set(v=>v+1))
            .callback(getText(row.item).remove())
            .callback(getText("instruction").remove())
            .callback( getTimer("window").stop() )
        ,
        getTimer("window")
            .wait()
        )
        .log(row.item)
        .log(row.Group)
        .log(row.condition)
        .log(row.correctKey)
        .log("score", getVar("score"))
    );
    
    newTrial("score_time",
        newText("Your score on the recall task was: ")
            .after(newText("").text(getVar("score")))
            .print()
            .wait()
    );

    (P.S. thank you so much for the server update – everything is running and loading so fast now!)

    in reply to: Behavioural task score #5275
    zoe_f
    Participant

    Dear Jeremy,

    I see, creating a global variable that can be referenced in whatever set of trials/block in the future. Thank you so much!

    Best wishes,

    Zoë

    in reply to: Pseudo-randomising stimulus presentation #5259
    zoe_f
    Participant

    Oh I see, it only starts the experiment once it has generated a fullly specified order which follows the rules (I had thought the Sequence function made up the order trial-by-trial during stimulus presentation, but of course it’s much smarter than that). This is excellent. Thank you!

    in reply to: Pseudo-randomising stimulus presentation #5256
    zoe_f
    Participant

    Great, thank you so much for this! That’s very helpful, I’ll upload that to my script folder. I’ve now had a look at Nora’s question at well in the original Ibex platform.

    Thanks also for flagging up this potential problem. In theory it shouldn’t be an issue as I have equal numbers of stimuli distributed across all group/condition combinations (i.e., 12 1As, 12 1Bs, etc.), but could it possibly happen that the function accidentally doesn’t use a particularly category at the beginning of the Block/trial set, and is therefore ‘forced’ to use them at the end and crash itself? While I’ll of course test the experiment many times before publishing it, this seems like the kind of issue/error which might only be exposed at random, or across a very large number of iterations.

    Thank you so much!

    in reply to: Pseudo-randomising stimulus presentation #5246
    zoe_f
    Participant

    P.S. I am aware of the rshuffle command, which could potentially be useful for this problem (certainly easier than manually deciding an order for stimulus presentation!). However, as far as I understand rshuffle, you have to specify a set order for the categories you’re drawing from, so in my case I’d have to say present items in order e.g., B-A-C (wherein items from within each of those three groups are randomly selected). So category is not really randomly presented, but items are.

Viewing 8 posts - 1 through 8 (of 8 total)