I am trying to give my participants feedback after giving a response on the slider tool. The correct answer is supposed to be a random number between 1 and 10. If the random threshold is hit, participants should win the lottery and if the select a number below it, they should lose.
Somehow PsychoPy seems not be able to find the variable I want to use. If I complete a test experiment the variable is called “slider_lottery.response_raw” but when I put this in the code it gives me the error “AttributeError: ‘Slider’ object has no attribute ‘response_raw’”.
I am very new to PsychPy and Phyton, to begin with, but I remember a post on here saying that names are extremely important, so firstly, Does your slider component have the same name as the Excel sheet component you show? if so, I suggest maybe changing it; why do you need that column anwyay? since randint will generate a random number between 1-10. Second, if I understand correctly, you are saying you want it to say Gwonnen when correct and Verloren when incorrect and you want the ‘correct answer’ to be a random number between 1-10? If so, I think you need to separate out the random number assigned to the slider as being correct and the feedback that the participant is getting. Hopefully, this makes sense. Sorry that I couldn’t be of more help. I will try and link that post I talked about here.
that means that the routine ended before a rating has been given. I assume that the rating-component does not end the routine? See checkbox Force end of Routine
The experiment does not allow the rating component to end the routine, I need a seperate space bar activity to do so. Even though if I set a starting point on the slider, the experiment crashes if the slider is not moved before pressing space bar.
Your recommendation to use the code like that unfortunately does not work for my purpose. If I do it like you suggested, the Message would always be “kein Rating” even if the slider was put to zero, where it is always supposed to show “Verloren”.
The issue is the fact, that even if I set a starting point on the slider, PsychoPy does not seem to save any response as long as the slider is not being moved before pressing space bar. So my only solution would be to not set a starting point on the slider? Can I make PsychoPy “accept” the rating even if the starting point is used by participants in any way?
if not slider_lottery.getRating():
fbMsg = "Verloren"
elif slider_lottery.getRating >= randint(1,10):
fbMsg = "Gewonnen"
else:
fbMsg = "Verloren"
Well, a starting point is not a rating But the starting point is optional. According to the slider’s help page, it is not possible to set a rating. There is no setRating() equivalent to getRating().