Leanpub Header

Skip to main content

Getting started with NeuroTask Scripting, 2nd Edition

Create an online experiment in hours not days

Free With Membership

With Membership

Free!

$7.99

You pay

$0.00

Author earns

$0.00
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
About

About

About the Book

This book teaches you all you need to know to create online experiments using NeuroTask Scripting. Check it out at https://scripting.neurotask.com.

Share this book

Categories

Author

About the Author

Jaap Murre

I am Professor of Theoretical Neuropsychology at the University of Amsterdam studying memory and the brain. I often use neural network models to help understand how the brain works. I like programming and have created several systems for simulation and experimentation. Over the past years we have also conducted many experiments on learning and forgetting, both in the lab and via the Internet.

Contents

Table of Contents

Preface

  1. Audience
  2. Typographic Convention
  3. Acknowledgements

1Getting Started with NeuroTask Scripting

  1. 1.1What Are Scripts and Why Do We Need Them?
  2. 1.2Scripting Psychological Experiments
  3. Writing Scripts
  4. 1.3Scripts
  5. The Structure of an Experiment Script
  6. Your first script: A small experiment
  7. Walking through Script 1.1
  8. Script 1.2: A free recall experiment
  9. Script 1.3: A shorter script with a for loop
  10. White Space
  11. Variables
  12. Assigning Values to Variables
  13. Arrays
  14. for loops
  15. Parts of a for loop: Head and Body
  16. Increment
  17. Declaring Multiple Values at Once
  18. Script 1.4: Even shorter scripts with getwords()
  19. 1.4You have started with online experiments!

2Capturing Keys and Reaction Times

  1. 2.1Achieving Precise Timing with await()
  2. 2.2Handling Various Types of Events with Await()
  3. Click events
  4. 2.3Await-ing Keyboard Events
  5. A Simplified Script for a Lexical Decision Task
  6. Key presses
  7. I) Printable Keys
  8. II) Any Key
  9. III) Non-printable Keys
  10. Event Properties
  11. 2.4Measuring Reaction Time (with now(), await(), and awaitkey())
  12. Reaction Time in Theory (Long-hand)
  13. Reaction Time in Practice (Short-hand)
  14. Reaction Times with Timeouts
  15. 2.5if...then statements
  16. Operators
  17. Order of Interpretation of Operators
  18. 2.6More Examples with Keyboard Events
  19. Shift-Alt-Ctrl
  20. 2.7A More Complete Script for a Lexical Decision Task

3Screen layout with “Box” and “Block

  1. 3.1Maintaining Experimental Control in an Online Setting: Layout
  2. 3.2Two Standard Layout Choices in NeuroTask: Fill and Square
  3. The fill layout
  4. The square layout
  5. 3.3Cross-Browser Layout Issues
  6. Font size
  7. Zooming and Text-Sizing
  8. Font Type
  9. Centering Text and Images
  10. 3.4The Backbone of Layout in NeuroTask: Box and Block
  11. 3.5Box
  12. The Pre-set Box Called “main”
  13. main” is the Default for Many Box Functions
  14. Customizing Boxes
  15. Box Color
  16. Box Borders, Backgrounds, and Fonts
  17. 3.6Block
  18. Adding Blocks
  19. Removing and Destroying Blocks
  20. Removing vs. Destroying
  21. Example Block Layouts
  22. Showing Text in Blocks
  23. Showing Images in Blocks
  24. 3.7Combining Box and Block: the makebox() convenience function
  25. 3.8Deleting All Contents of a Box
  26. 3.9Using Blocks as Stimuli
  27. Corsi Block Tapping Task
  28. Random Dot Stimuli

4Images

  1. 4.1Visual recognition task
  2. concat(array1,array2)
  3. contains(array,element)
  4. log(variable,label)
  5. 4.2Image linking and uploading
  6. Uploading images
  7. Linking images
  8. Uploading versus linking images
  9. 4.3Where your images are stored
  10. 4.4Preloading images
  11. The preload() function
  12. Preloading is Block-specific
  13. 4.5Resizing images

5Style

  1. 5.1Style with style()
  2. Chaining of block function calls
  3. 5.2Setting font size of an entire Box
  4. 5.3Queries with tag name, class and id
  5. Styling the background behind boxes
  6. 5.4Color
  7. Named colors
  8. RGB and Hex
  9. Opacity and transparency
  10. 5.5Fonts and text styles
  11. Font family
  12. Font size and other text style properties
  13. Font weight: bold and bolder
  14. Font style: italic
  15. Text decoration: underline and line-through
  16. Font size and line-height
  17. Text align: left, right, or justify
  18. Top, left, width, height, and getshape()
  19. 5.6Borders
  20. 5.7Padding
  21. 5.8Preset functions versus block functions

6Survey questions with form controls

  1. 6.1Instruction
  2. 6.2Button
  3. 6.3Input
  4. 6.4Using response values in scripts
  5. Return values
  6. The response object
  7. Feedback with
  8. 6.5Largeinput
  9. 6.6Select, radio, and scale
  10. select()
  11. radio()
  12. scale()
  13. 6.7Check
  14. 6.8Sleep questionnaire example
  15. 6.9Combining controls with startform() and endform()
  16. 6.10Validation

7Data logging and handling

  1. 7.1Data logging with log()
  2. 7.2Data that is always logged in ‘activated’ scripts
  3. 7.3Data tables in your account
  4. What a ‘session’ is
  5. 7.4Data storage and retrieval
  6. Storing ‘behind the scenes’ or storing now
  7. Storing at the ‘script’ and ‘author’ level
  8. increase() and decrease()
  9. 7.5Working with the data tables
  10. Filtering data
  11. 7.6Exporting data
  12. Pivot tables, or how to make your tables ‘square’ again
  13. 7.7Logging, storing, and the ‘response’ object
  14. 7.8Deleting data
  15. 7.9Data Dashboard

8Animation and drag-and-drop

  1. 8.1Animation
  2. Feedback with blink()
  3. Blinking other properties with toggle()
  4. Using the animate() function
  5. A general approach to animation with RAF()
  6. Using icons with the icon() function
  7. An animation loop
  8. 8.2Drag-and-drop
  9. Drag-and-drop basics
  10. Dragging a block inside (on top of) another
  11. Drag-and-drop with multiple drop targets
  12. 8.3Putting everything together: A simple game

9Sound

  1. 9.1Preloading sounds
  2. 9.2Advanced options

10Working with video

  1. 10.1Subtitles and chapters
  2. 10.2Advanced options
  3. 10.3Supported video options
  4. 10.4Getting the video player
  5. 10.5Showing the same video simultaneously in two blocks

11Graphics

12Pivot Tables

13Synchronous and asynchronous programming

  1. 13.1Asynchronous programming (is still possible in NeuroTask Scripting!)
  2. 13.2The waitfor .. or construction

Appendix

  1. Background Code
  2. Example Scripts
  3. Corsi Block Tapping Task
  4. Random Dot Pattern Recognition

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub