Including Block/Loop Number in Text

This thread has been extremely helpful in tackling my very similar issue, so many thanks to everyone who has contributed! However, my code is flat out not working to show incremental blocks as one of the examples in this thread outlined. Here is a snapshot of my routine:

Within Instructions_3, I have a code object executing the following at Beginning of Experiment:

blockCounter = 0;

For Block_Increment, I have a code object executing the following at End Routine:

blockCounter += 1;

I also have a text object in Block_Increment, $"Block N: " + str(blockCounter)

The experiment runs smoothly, but the blockCounter is not working and only displays “Block N: 0” each time through. Would anyone know what the issue is? I have tried inserting the codes at different points in and outside the loops with no luck.

Is this object set to update each repeat?

Thanks for the reply. I thought the value of block increment should be set up to increase in value each loop. The text object in Block Increment should just read the updated value, correct? I have a feeling this is not the case because it has not worked for me though.

image
I cannot seem to get this to work as it says this error. When it sometimes allows me to click ok with this input the result is a screen with the entire text box on the screen i.e. "Please take a break and let the researcher know when you are ready to proceed! $'Number of blocks completed = ’ + str(Ten_Blocks.thisRepN + 1) " is on the screen. I cannot get this to work. Please help!

It there’s any code it has to be all code.

$"Please take a break...proceed!\n\nNumber of blocks completed = " + str(Ten_Blocks.thisN + 1)

I usually use .thisN but .thisRepN might be what you want

1 Like

Thanks for this! I feel really dumb for this error!