Skip to content
Eoin Travers edited this page Jun 8, 2014 · 1 revision

PsychScript is a framework for running cognitive psychology experiments online, consisting of a set of JavaScript functions, HTML templates, and a simple PHP/MySQL setup for logging responses on a server. It is in many ways similar to jsPsych, although taking a different approach, making it generally more flexible, but requiring more effort to set up.

Using PsychScript

HTML Templates

The base of any experiment is a HTML page, which defines the structure that participants will interact with (i.e. regions of text, buttons, images, etc.). PsychScript currently includes two HTML templates, defining a lexical decision task using either clickable response buttons, or accepting keyboard responses. More templates will be added in the near future. Users can modify these templates as required, or create their own from scratch, when implementing their own experiments.

JavaScript functions

The core of PsychScript is a set of JavaScript functions, used to dynamically manipulate the content and layout of the HTML page: showing and hiding components, changing values, and dealing with input from participants. Thus, calling show_text('Spam'); will change the contents of the part of the page designated for text output to 'Spam', and is equivalent to

document.getElementById('probeText').innerHTML = 'Spam';

Similarly, get_keyboard_response('YN'); will wait for the participant to press a key, and if that key is 'y' or 'n', will log this response, along with the response time.

Style

The third factor in an experiment or web page is the CSS (Cascading Style Sheet), which defines the aesthetics of the HTML page: colours, fonts, visibility, etc. This can also be manipulated using JavaScript, but is for the most part set up in advance to style your experiment as appropriate.

Logging

Participants complete the experiments on their own computers, but the experimenter needs their responses to be saved to a central server. PsychScript achieves this using a MySQL database, and a simple script written in PHP which runs on your server, processing data sent from participants' computers and storing it in the database.