Using 'virtual' pixel coordinates to set on-screen stimuli


Software from October 2022 changes the Zanscript's default way of setting stimuli position on the screen (e.g., setting lights, sprite images or panning lights). Previously, the default was to use 'virtual' pixel coordinates of the screen to set the position. With this latest software, in order to allow existing scripts (which use 'virtual' pixel coordinates) to continue to run exactly as before, a new function, Set(DrawUnits,virtual), must be added to the top of your scripts. Below are examples of the functions using 'virtual' pixel coordinates.

Screen Coordinates Vn2
Screen coordinates (in 'virtual' pixels) for each corner, centre point of each edge and the middle point of the unit's screen (the edge of the screen may not be visible as it is covered by the cut-out the tank sits inside).
Top

SETLIGHT

sets the type of visual stimulus to be displayed, as well as its location in the cut-out which your tank/cage sits within. For ‘sprite’ images (.bmp) you can also set the size.

Examples:

SETLIGHT(LIGHT1,SQUARE,1475,100,140) 
SETLIGHT(LIGHT2,SQUARE,800,500,1600) 
SETLIGHT(LIGHT3,SPRITE,800,200,0 

SETLIGHT(LIGHT1,SQUARE,1475,100,140) - sets LIGHT1 as a square shape of light with the centre of the square located to be with the centre of the square located at the coordinates 1475,100 on the screen. The size of the square is set at 140 'virtual' pixels.

SETLIGHT(LIGHT2,SQUARE,800,500,1600) - sets LIGHT2 to the size of the entire screen (1600).

SETLIGHT(LIGHT3,SPRITE,800,200,0) - specifies that LIGHT3 is a 'sprite' bitmap image to be displayed on the screen coordinates 800,200 on the screen. The image's original size is used, as indicated by the final value 0. The size of the sprite can be altered by changing this number to the required size in 'virtual' pixels.

The defined LIGHTs can then be controlled using the LIGHTS command (see below).

Top

PANLIGHT

to have a sprite image scroll across the screen from a set starting position (i.e., from its original location as detailed in a SETLIGHT function or from the position it moved to following the previous PANLIGHT function) to the position detailed after the PANLIGHT command:

Examples:

DEFINE SCROLL_TIME 8 
LOAD(SPRITE_IMAGE,"1:zebrasingle") 
SETLIGHT(LIGHT1,SPRITE,1500,200,0) 
 
ACTION EXAMPLE 
 
LIGHTS(LIGHT1,ON) 
PANLIGHT(LIGHT1,1500,1200,SCROLLTIME) 
 
COMPLETE

PANLIGHT(LIGHT1,1500,1200,8) - will make the image move from its starting position (as detailed above in the SETLIGHT setting) to the position on the screen defined here (1500,1200), over a period of 8 seconds.

PANLIGHT(LIGHT1,1500,1200,SCROLLTIME) - will move the image from its starting position (as detailed above) to the position on the screen defined here (1500,1200), moving for the pre-defined time SCROLLTIME (see DEFINE directive above).

For an example script using these functions, see Lights demo script page.