Comparing Labeled Text Elements

PennController for IBEX Forums Support Comparing Labeled Text Elements

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5078
    glossaphile
    Participant

    Hi! For my lexical decision experiment, I’m trying to test if two labeled text elements (“Resp” and “Lex”) are identical and then have the browser display one of two different responses depending on whether they match. My best attempt is this:

    
    getText("Resp")
                .test.text(getText("Lex"))
                    .success(
                        newText("Correct!")
                            .print()
                        ,
                        newTimer(1000)
                            .start()
                            .wait()
                        ,
                        getVar("Acc").set(1)
                    )
                    .failure (
                        newText("Incorrect!")
                            .print()
                        ,
                        newTimer(1000)
                            .start()
                            .wait()
                        ,
                        getVar("Acc").set(0)
                    )

    But this just returns “Incorrect!” for all trials regardless of whether the text elements match or not. I welcome any advice!

    #5079
    Jeremy
    Keymaster

    Hi!

    I don’t know why it’s not working, I’d have to double-check that. In the meantime, you can use a Var element as a proxy:

    newVar("RespVar"),newVar("LexVar")
    ,
    getText("Resp").setVar("RespVar"),
    getText("Lex").setVar("LexVar")
    ,
    getVar("RespVar")
        .test.is( getVar("LexVar") )
        .success(
            newText("Correct!")
                .print()
            ,
            newTimer(1000)
                .start()
                .wait()
            ,
            getVar("Acc").set(1)
        )
        .failure (
            newText("Incorrect!")
                .print()
            ,
            newTimer(1000)
                .start()
                .wait()
            ,
            getVar("Acc").set(0)
        )

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.