Feedback on trials

I have an experiment where I am conducting a memory test. In the recognition phase, I show participants images and ask them to rate the images based on a scale of 1-6 based on how old or new they think the image is. 1-3 on the scale = old, and 4-6 = old. I need participants to get feedback (correct! or incorrect!) based on the number they press. Eg. if they press either 1,2 or 3 and the image is old, i want the feedback to be correct. If they press 4 and the image is new, then the feedback should read incorrect and vice versa if they image is new.

How can I accomplish this?

What you need to do is make a code component with something like this:

if mySlider.rating in [1, 2, 3] and correctAns == "old":
    feedbackText = "correct"
if mySlider.rating in [1, 2, 3] and correctAns == "new":
    feedbackText = "incorrect"
elif mySlider.rating in [4, 5, 6] and correctAns == "old":
    feedbackText = "incorrect"
elif mySlider.rating in [4, 5, 6] and correctAns == "new":
    feedbackText = "correct"
else:
    feedbackText = ""

and then set a :text: Text or :textbox: Textbox component’s “Text” parameter to be $feedbackText

Thank you! When I add in that code I get this error:

if mySlider.rating in [1, 2, 3] and correctAns == “old”:
NameError: name ‘mySlider’ is not defined

What is your slider component called?

I changed it to mySlider, and now the experiment doesn’t crash, but there is no feedback, I just see a black screen after I make my rating.

I use mySlider.markerPos instead of rating but you could print(‘rating’,mySlider.rating) to try to work out what’s happening.

Where is your code component in relation to your text component setting feedbackText each routine?

I did print but when i ran the experiment nothing printed.

The code component is in the same routine, I have attached a picture.

Sorry I should have said! I tend to use mySlider, myText, myMouse, etc. as placeholders for component names. You can call it whatever you like, so long as the code and the name match :slight_smile:

Thanks I still get this error

FeedbackTextBox_3.setText(feedbackText)
NameError: name ‘feedbackText’ is not defined

Although I made everything consistent.

When is your text component’s text set to update?

I’m not sure what you mean?

The Text :text: component you’re using to display the feedback, next to the box for its text there should be a drop down menu saying “constant”, “update each frame” or “update each repeat” - which one of these do you have selected?

set every repeat

Try adding feedbackText = "" to the Begin Experiment tab of your Code component, that way the variable will exist before the routine starts and the text is set

Ty! I added that, but i still see the image, make my rating and then the screen goes blank and gets stuck.