Before reading this section you should first read about cells.
If you want to display text on the screen, you can make an image holding that text and display the image using an image cell. That way you can control all the font properties of the text: you know exactly what it will look like, and it will look the same on every computer you might use to run the experiment.
However, sometimes you want your participant to enter text as a response, and sometimes you have many slightly different pieces of text to display and it's not worth making an image of each one. For this situations PsyScript provides text cells.
The smallest amount of code required to show a text cell would be …
If you've already set up a text field with a length you can change the text in it using
Your participant can change the contents of a text cell by clicking in it and typing. If you want to allow this you normally put a button on the display that they can click when they're finished making their change – make an image that looks like a button, use an image cell to display it, and wait for a click on that cell. However, PsyScript gives you many other ways to limit their usage. For example you could use a command like wait for 20 seconds.
Unfortunately, putting a text cell on the display can make the interface think that you wantyour user to type into it. This can lead to the cell being highlighted and containing a flashing cursor. If this is not what you want, put another text field on the display then show and hide it before your user gets a chance to interact with it, like this:
You can find out what has been typed into a cell (for comparison or logging purposes) by referring to the appropriate variable, for instance …
load cell cellname with text value at length value
Sets up a text cell containing the value supplied. The text cell will be wide enough to contain roughly the number of characters given (though it can actually contain more characters than that, they just won't all be shown).
load cell A with text Hello, Mom ! at length 20
load cell A with text $varDummyText at length 5
load cell A with text Hello, Mom ! at length $varAnswerLength
set text cell cellname to value
Changes the text in an existing text cell to something new.
set text cell C to newpetname
set text cell C to $varPictureCaption
set text cell C to $lastKey