Start and Stop a component based on typed responses


I am designing an experiment where a participant can spend credits per answer. I currently have it set so that once they type in their response, they press a “Continue” button using the mouse to carry on to the next part of the experiment.

This works as intended, however the issue comes when I try to tweak it a bit. I am trying to make it so that if the current count minus their typed credit input is less than zero, that the continue button disappears. I would then like the button to re-appear once their input value is back to 0 or above.

I tried setting the Start/Stop duration in components to:

Start: credit_spend.text
Stop: count- int(credit_spend.text) < 0

Which did get it to disappear, but then I couldn’t get it to show up again.

Additionally I tried a code component using the below in the Each Frame box, yet this didn’t make the continue box disappear at all. I also tried this with “NOT_STARTED”:

if credit_spend.text:
    if count- int(credit_spend.text) < 0:
        cont_text.status == FINISHED

Is what I am trying to do possible? I’m trying to avoid extra routines to send them back to ask them to input a new answer.

Best wishes

There’s probably a smarter way to do this, but you can certainly move the button offscreen when you want it to disappear.
e.g. if credits are too low, the button is at (9999,9999), else it’s where it belongs