Using rating values to present the highest ranked stimulus in the next routine

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v2022.2.5
Standard Standalone? (y/n) Y
What are you trying to achieve?: Hello, hi! I am encountering a problem with my experiment. Due to my Master thesis project, I am trying to create a SDT (sexual discounting task), that allows me to display previously rated stimulus (during the prior routine, with the highest score) for participants, and to assess it once again. The first part of experiment wasn’t that complicated to create, however, the coding is what bothers me the most. Watching YT tutorials, reading manuals haven’t helped me that much. Thus, I would very much appreciate any help, clue, and/or a rookie-friendly-manual on PsychoPy coding. Many thanks for your help!

What did you try to make it work?: I was trying to “play” with coding, but I did not succeed. Only first part of the experiment works perfectly fine.

What specifically went wrong when you tried that?: name ‘stimuli_rating.response’ is not defined.

You can store the value of your first routine’s rating at the end of your first routine.
Then, when the second routine starts, access this variable.

At the end of the first routine:

lastRating = rating.getRating()

Now, at the second routine, you can access the lastRating variable:

Here is an example:
rating_last.psyexp (12.9 KB)

Dear Chen,

Many thanks for your response, and your input! I surely didn’t make myself clear, due to the late hours and my cognitive functions not working properly :smiley:

Mainly, I’m trying to create a routine that would show a participant’s most rated stimulus (based on their responses), in order to rate that stimulus once again. Let’s say, I’d rate the first stimulus on my slider as 80%, the second one as 75%, the third one as 30% etc. Then, I’d have shown the stimulus with the highest rate I’d previously chosen from, so I could rate that again.
[In my mind: first routine (a few stimuli shown → I’m rating them) → second routine (the most rated stimulus → I can rate it again)].

Please, find the print screen from my flow below:

Does each routine (for example, attractive_rating) have multiple ratings?
Seeing the components in your routine could help.

Please take a look at this example:
rating_last.psyexp (14.8 KB)

This example has five trials. Each trial has a rating slider.
I append all the rating values into a list whenever the participant rates. Then, I get the max value from the list at the routine that starts after the loop.

SDDT.psyexp (25.3 KB)

Yes, absolutely! There you go (it’s just a prototype, so it may seem messy).

Did you take a look at my second comment with the example? I think it answers your question.

Actually, as I can see in your experiment it works fine, however, I can’t implement it my piece of work. Nevertheless, I’ll be trying further. Many thanks for your help!