# How to dynamically generate stimuli based on subjs' prior responses?

**URL:** <https://discourse.psychopy.org/t/how-to-dynamically-generate-stimuli-based-on-subjs-prior-responses/41192>\
**Category:** Online experiments\
**Created:** [August 27, 2024, 9:59pm UTC](https://discourse.psychopy.org/t/how-to-dynamically-generate-stimuli-based-on-subjs-prior-responses/41192 "2024-08-27T21:59:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jonathan.kominsky](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jonathan.kominsky](https://discourse.psychopy.org/u/jonathan.kominsky)\
**Post date:** [August 28, 2024, 8:06am UTC](https://discourse.psychopy.org/t/how-to-dynamically-generate-stimuli-based-on-subjs-prior-responses/41192/2 "2024-08-28T08:06:12Z")

</div>

[https://www.psychopy.org/recipes/builderFeedback.html](https://www.psychopy.org/recipes/builderFeedback.html)

> [@Presentation of picture based on previous response](https://discourse.psychopy.org/t/presentation-of-picture-based-on-previous-response/32666):
>
> Hi! So far, I’ve only built experiments in the Builder, but I think what I need now is the coder. So, it’s a simple picture selection task. 2 pictures are displayed on the screen. If the participant chooses one of them, the chosen picture needs to be displayed in the next screen together with a new picture, etc. I think you can’t design it in the builder. As for the Coder, the way I see it is that in the beginning of the routine I would need to create some variable ‘chosen\_pic’, and at the end …

> [@How to randomize feedback or create conditional feedback](https://discourse.psychopy.org/t/how-to-randomize-feedback-or-create-conditional-feedback/27282):
>
> Hello, I am trying to create conditional feedback for my experiment, I usually use the builder so writing the code for this has been a little bit more complicated than I hoped. The goal is for on some trials, the participant sees “correct” or “incorrect” based on how they responded. I have this working properly. But, I also need it on some trials (randomly) to not say anything at all, no feedback. I’m not sure in python or JS how to make this work. Initially, I was thinking I could add a colum…

Generally speaking what you’re doing is the same as making a feedback trial, but instead of providing feedback you’re just taking the response and using it to fill in a stimulus. It should be fairly straightforward to use code components and either store the response to a separate variable, or actually access the data from the previous trial directly (the first link shows how to do this in Python, and the auto-\>JS translator in the code component can probably make it work the same way online as well).

---

_[View the full topic](https://discourse.psychopy.org/t/how-to-dynamically-generate-stimuli-based-on-subjs-prior-responses/41192)._
