Demo Scripts

Tutorial Demos

Call external library

Call external library

This demo illustrates how to load such an external library and then use it.

Set the Random Seed

Set the Random Seed

Generate pseudo-random numbers but with a specific seed, so all subjects get the same pseudo-random series.

How to Temporarily Hide a Block

How to Temporarily Hide a Block

Sometimes you want to temporarily hide blocks. For example, you may want to show a bunch of images. Hide the block in which you present them, show some instructions for Part 2 of your experiment, and they show the block again. Destroying will work but this also destroys the preloaded images.

How to Log a Non-Printable Key

How to Log a Non-Printable Key

Shows how you can log a non-printable key by its NeuroTask Scripting name. Als gives a simple function you can use.

Set the Font Size for All Controls

Set the Font Size for All Controls

If you are using the standard controls like input(), instruction(), select() the standard font size is usually too large. You can make it smaller as follows with one line: main.setfontsize(70) (for 70% sized font size).

Clearing the Key Buffer

Clearing the Key Buffer

If you use an awaitkey() the subjects's response will 'linger' even after the awaitkey() call and will remain active. E.g., an Enter key stroke will 'linger' and remain active and will 'click' the following OK button. This can easily be prevented by using preventDefault(), a standard JavaScript function. See the code.

White Text on Black

White Text on Black

To achieve white text on a completely black background, you can use a new Box as described in the book but it is usually easier to restyle the main function, because all of the standard controls still work and are easier to use, especially for beginners with NeuroTask Scripting. See the code.

Get URL Parameters

Get URL Parameters

Illustrates how to send subjects to a different webiste (e.g., a survey in Google Forms). Also shows how to decode any parameters sent from another site with your script (e.g., when using NeuroTask with a proprietary subject management system).


Progress Bar

Progress Bar

Shows how to make a simple progress bar by superimposing two blocks and then changing the shape of the upper block.

Script 1.4

Script 1.4


Sound Simplest

Sound Simplest


Grid Control Demo

Grid Control Demo