Creating a Task
NIMH MonkeyLogic supports the original MonkeyLogic’s behavioral tasks, so a new task can be written in the traditional style using a conditions file and a timing script (runtime library version 1). You can also use a userloop function and a new runtime library (version 2). Many example tasks written in each style are under the "task" folder of the MonkeyLogic installation directory.
Conditions File & Timing Script
The conditions file is a tab-delimited text file which lists a set of stimuli that can occur in each trial. Each stimulus is referred to as a "TaskObject" and can take the form of a visual object, a sound, or an analog or TTL output. The timing script is a MATLAB program that determines when and under what conditions each of those stimuli is presented. For the stucture of those files and how to write them, please refer to the following online manual.
Conditions file: http://www.brown.edu/Research/monkeylogic/conditionsfiles.html
Timing script: http://www.brown.edu/Research/monkeylogic/timingscripts.html
The conditions file requires to define all trial conditions explicitly. This can be inconvenient sometimes, for example, when there are so many conditions and stimuli or when the task needs a flexible way of randomizing trial squences and handling error trials. A userloop function is a MATLAB function that feeds the information necessary to run the next trial, in lieu of the conditions file. It is called before each trial starts and allows user to determine the condition of the next trial without being restricted by the conditions file structure. You can also preload large stimuli in the userloop function and reuse them so that the inter-trial interval does not get increased by the stimulus creation time. The details of the userloop function are well-documented in the example tasks that are under the "task\userloop" directory of the MonkeyLogic installation folder.
New Runtime Library (V2)
In the previous set of timing file functions (or runtime library v1), stimulus presentation and behavior tracking were handled by toggleobject() and eyejoytrack(), respectively. This framework is disadvantageous in designing dynamic, interactive stimuli, because stimuli and behavior are processed separately and there is no proper way to change stimuli during behavior tracking. NIMH MonkeyLogic provides a new way to compose tasks which uses "adapters" as building blocks of task scenes and two new functions, create_scene() and run_scene(), that replace toggleobject() and eyejoytrack(). The examples of the runtime library v2 are in the "task\runtime v2" directory. There is also an online document in the following link.