The SETCOLOUR command enables you to change how an image is lit from the screen, in this instance this command will be used to change how the blue bar image is lit, so it will appear black.

The first two SETLIGHT commands position square images on the screen, the first two numbers are the coordinates of their centre, and the third number is the size (in pixels) of the square (which is actually seen as a rectangle on the screen in this case).

The next four SETLIGHT commands tell the unit to look for a bitmap image from the Assets directory, and load this in the position as indicated by the screen coordinates for its centre (i.e. 0,500 for three of them*) and keep each one at its original size (0 deems no change to size of image).

The LOAD command tells the unit which bitmap image should be used for which light, i.e. LIGHT8 will be the asset "blue_stripe_vertical" and LIGHT11 will be "danio_small".

Action Main

The next set of ACTION MAIN commands (above) details the order of the whole experiment. In this case:

At the beginning and end all the lights all turned off.

The experiment comprises four parts, the parts are run sequentially, with OVERHEAD_LIGHTS starting. Three of the parts are run the same number of times as indicated by TRIALS (i.e. they run once, as defined in the first section of commands above). One of the parts, STRIPE_MOVEMENT, is run 3 times, the value defined for STRIPE_TRIALS in the first section of commands.

These commands are for the FISH_MOVEMENT period as invoked in ACTION MAIN. They detail:

LIGHT11 comes on - as defined in the first section, this is a 'sprite', a bitmap image, loaded in the Assets directory, called "danio_small" (in this case it is a small fish).

This image pans across the screen from the position where it was originally set, as instructed by the SETLIGHT command in the first section, to the new position (co-ordinates 800,1000* on the screen). It will pan across the screen in the time as defined in the first section (i.e. SCROLLTIME).

The unit will wait for the number of seconds as defined in the first section as WAIT_TIME before turning off LIGHT11 (i.e. the image). This period of time must be at least as long as the time alloted for the image to pan across the screen (i.e. the WAIT_TIME is 1 second longer than the SCROLLTIME).

These commands are for the STRIPE_MOVEMENT section of the experiment as invoked in ACTION MAIN. They instruct the unit to:

Turn a white light on the screen.

Set LIGHT8, a blue vertical bar (the image that is loaded in the assets directory) in a position across the front end of the screen.

LIGHT8 then turns on, illuminated by the screen light.

LIGHT 8 pans across the screen, reaching the coordinates 1800,500 in the SCROLLTIME.

After a short period of time, QUARTER_SCROLLTIME, the next light (LIGHT9, again a blue horizontal bar) pans across the screen in a similar fashion to LIGHT8.

The only difference is that this bar appears black because of the command - LIGHTS(LIGHT9,10) - as the control for how the image is lit is set in the first section after the command SETCOLOUR(10,0.01,0.01,0.01).

LIGHT10, another blue horizontal bar, behaves in a similar fashion to LIGHT8.

This ACTION is repeated 3 times (following the ACTION MAIN command - INVOKE(STRIPE_MOVEMENT,STRIPE_TRIALS), and the previous DEFINE command - STRIPE_TRIALS 3) These three lights scroll continuously across the screen three times.

The ACTION BLOCK_COLOURS gives the commands for this part of the experiment as invoked in ACTION MAIN. It details:

The unit waits for a period (SCROLLTIME) to give the rolling images time to finish panning across the screen in the previous ACTION.

The colours that will appear on the screen, LIGHT1 fills the front half of the screen and LIGHT2 fills the back half of the screen. The position and size of the lights is defined in SETLIGHT commands found in the first part of the code.

Script download

Here you can download the lights demo script as a .zs file. Right click on the download link below and download / save the file as a zanscript file, i.e. in the same format: lights_demo.zs. You then need to upload this zanscript file into the Zanscript directory on your unit.

You also need to download the bitmap files that are used in the script (blue_stripe_vertical.bmp and danio_small.bmp), and save these into the Assets directory on your unit. Make sure that the assets named in your script exactly match the names of the assets / bitmaps loaded into your Asset directory (including upper and lower case used).