Demo Scripts
Tutorial Demos
Example ExperimentExample Experiment
Example experiment showing how to invite subjects with an extra 'token' argument to communicate to the script in which condition to place the subject.Multiple Buttons
Multiple Buttons
Shows how to await() for several buttons, each of which can be pressed.Likert
Likert
Gives a variant on the scale() control but with the ability to provide labels per choice above or below.Check a response with the distance function
Check a response with the distance function
Shows how you can use the distance() function to check a response, allowing for a certain amount of error like typos.Visual Recognition Memory - Script 3.1
Visual Recognition Memory - Script 3.1
Metronome Demo
Metronome Demo
Demostrates preloading and then playing a sound every 500 ms for 10 s. Also shows how to use the standard JavaScript functions setInterval() and clearInterval().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
Style