Stuck displaying text from text box in previous routine

Win10
2022.1.1

I am currently building an Investment task in which a participant selects three stocks at a time per trial. In each subsequent trial I would like the text value of stocks they had selected to appear above the appropriate stock (see image below for visual representation of where the previous trial information for each stock would go).

Using the online tutorial I have added the multiple clicks. But now don’t know how to add the relevant code so that the text in the textbox of the stock in previous trial is shown in carried over to the next trial and displayed above the appropriate stock.

I thought about adding a string variable to call for a saved data column in a textbox. But I do not how to save the text from the stock textbox that has ben clicked into a data column, I have only worked out how to save that it has been clicked.

Experiment .zip folder

Neal Investment Task v1.0.zip (1.6 MB)

Experiment .psyexp file

neal_investment_taskv1.0.psyexp (410.0 KB)

I am unsure on how too approach this, if any of this is unclear please say and I will provide more info. Any help much appreciated.

Best wishes,
Seline

So am I right in thinking that you want the text stimuli currently showing “trial 1 trial 2 trial 3” etc. to instead show the value of stock 1, stock 2, etc.? if so I would probably create a counter at the start of the experiment, something like stock1value = 0, stock2value = 0, etc. and each time the stock is chosen say stock1value += float(chosenStockValue) (with that value coming from whatever choice they made, via whatever mechanism you have in place)

For getting the value of the text stim clicked on, rather than it’s name, it looks like you have some code saying:

for clickable in clickables: 
    if mouse_9.isPressedIn(clickable):
       clicked_things.append(clickable.name)

If clickable is a TextStim, then it should have an attribute clickable.text, which you can append instead of clickable.name, to get the text contents.