Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Mc-question and feedback item doesn't work when using inline-script

edited January 2015 in OpenSesame

i'm a beginner in phyton ;)
I tried to get a feedback on my mc-items (response1, 2 , 3 ,4 . In experiment, independent if answer was correct or not, the feedback is always:" your answer was wrong". the variable with the correct response is called: correct_response

I used following inline script:

correctness = self.get ("correct")

if correctness == 1:
feedback = "answer was correct"
else:
feedback = "answer was wrong"

exp.set ("correct", correctness)
exp.set ("Feedback", feedback)

it would be great, if someone would find the mistake :) Thanks a lot

Comments

  • edited 5:19AM

    Hi Laura,

    Based on what you posted, I can see only one error, which is unlikely to have caused your troubles, but just for completion, the line:
    exp.set ("correct", correctness) exp.set ("Feedback", feedback)
    should be
    exp.set ("correct", correctness); exp.set ("Feedback", feedback)
    (note the semicolon between commands).
    Aside of that, I can't see what went wrong right away. I suppose your variable correct doesn't look like you expect it (wrong datatype?). You can try to print it and its type at different positions in your script to see whether it looks how it should be and is not changed at any point. In general printing variables is the simplest way to find out what your code is doing. So, give it a try. From my side, I can't help much more without seeing the entire experiment (You can upload it if you like)

    Let us now if you find the error or have more questions.

    Good luck,

    Eduard

    Btw. I don't see why you set correct to correctness again. This is probably unnecessary.

    Buy Me A Coffee

  • edited 5:19AM

    Hi Eduard,
    thx for your reply! The variable correct didn't worked well because i used the multiple choice form. After replacing the multiple choice form with a sketchpad, it finally worked!
    Another question: I would like to set a break into my experiment. Before and after the break, 20 randomised questions are presented. its important that before and after the break should be presented 10 different questions. So ten questions before, and 10 questions after the break :) i tried to use the countmemorysequence in the run if options in the sketchpad, but nothing has happened
    Greets,
    Laura

  • edited 5:19AM

    The solution for the problem: Insert the break as a sketchpad into the questionloop and type in the run if condition: [count_sequencename]==number of questions before break plus one. so if you want to show 10 items before the break and your sequence is called sequencebreak it's : [count_sequencebreak]==10

  • edited 5:19AM

    Good to hear that you found the problem.
    I will mark your question as solved.

    Buy Me A Coffee

Sign In or Register to comment.