Screen#

Introduction#

The Screen blocks control how the VEX AIM Coding Robot shows text, numbers, and graphics on its screen, and how it responds to screen presses.

Below is a list of all blocks:

Cursor Print — Manage text display using a row-and-column cursor system.

XY Print — Print text at pixel-based coordinates.

Settings — Customize text formatting and screen display.

Draw — Create graphics and visual elements.

Touch — Detect screen interactions.

  • screen pressed — Reports whether the screen is currently being pressed.

  • screen position — Reports the selected x or y coordinate of the last screen press.

  • when screen event — Runs attached blocks when the screen is pressed or released.

Cursor Print#

set cursor to row column on screen#

The set cursor to row column on screen stack block moves the cursor to a specific row and column on the robot’s screen. The next print on screen block will start printing at that location. How many rows and columns can comfortably fit depends on the selected font. With the default monospaced medium font, up to 8 rows and 13 columns can be displayed clearly. Text placed beyond this range may be cut off or become difficult to read.

Monospaced fonts have characters that are all the same width, making text placement consistent. In contrast, proportional fonts vary in character width, so some letters take up more space than others. However, regardless of which type is used, the set cursor to row column on screen stack block positions the cursor based on row and column size, not font style. The font size can be adjusted using the set font on screen stack block.

Set cursor stack block#
    set cursor to row [1] column [1] on screen

Parameters

Description

row

The row to move the cursor to.

column

The column to move the cursor to.

Examples

When started, moves the cursor to row 3, column 2 on the screen and prints ‘Row 3, Column 2’.#
    when started
    [Display text starting at Row 3 Column 2.]
    set cursor to row (3) column (2) on screen
    print [Row 3, Column 2] on screen ▶

A screenshot of the robot's screen, with Row 3, Column 2 printed in white just above the center of the screen, beginning at row 3 column 2.

    when started
    [Display cargo amounts in an organized list.]
    set font to [proportional v] [large v] on screen
    print [Sports Balls] on screen ◀ and set cursor to next row
    print [Orange Barrels] on screen ◀ and set cursor to next row
    print [Blue Barrels] on screen ▶
    set cursor to row [1] column [11] on screen
    print [2] on screen ▶
    set cursor to row [2] column [11] on screen
    print [3] on screen ▶
    set cursor to row [3] column [11] on screen
    print [3] on screen ▶

A screenshot of the robot's screen shows three lines of white text, listing Sports Balls 2, Orange Barrels 3, and Blue Barrels 3. The numbers are aligned to the right of each label, and the list begins at the top of the screen.

    when started
    [Display the ID of the detected AprilTag.]
    set font to [proportional v] [extra large v] on screen
    forever
    clear screen
    print [AprilTag] on screen ▶
    get [all AprilTags v] data from AI Vision
    if <AI Vision object exists?> then
    set cursor to row [3] column [4] on screen
    print (AI Vision object [tagID v]) on screen ▶
    end
    wait [0.1] seconds

A screenshot of the robot's screen with white text printed near the center, reading AprilTag on the first line and 4 on the second line.

set cursor to next row on screen#

The set cursor to next row on screen stack block moves the cursor to column 1 on the next row on the robot’s screen.

set cursor to next row stack block#
    set cursor to next row on screen

Parameters

Description

This block has no parameters.

Example

When started, prints ‘Line 1’ on the screen, moves the cursor to the next row, and then prints ‘Line 2’.#
    when started
    [Display two lines of text.]
    print [Line 1] on screen ▶
    set cursor to next row on screen
    print [Line 2] on screen ▶

A screenshot of the robot's screen with white text. The screen reads Line 1 on the top line, left-justified, and Line 2 directly beneath.

clear row on screen#

The clear row on screen stack block clears a single row of text on the robot’s screen.

Clear row stack block#
    clear row [1] on screen

Parameters

Description

row

The row number to clear.

Example

When started, prints text on two rows. The first row remains, while the second row disappears after 3 seconds.#
    when started
    [Display text on two rows.]
    print [This text stays] on screen ▶
    set cursor to next row on screen
    print [This text disappears] on screen ▶
    wait [3] seconds
    clear row [2] on screen

screen cursor column#

The screen cursor column reporter block reports the column number where text will be printed as a whole number.

screen cursor column reporter block#
    (screen cursor column)

Parameters

Description

This block has no parameters.

Example

When started, moves the cursor to row 3, column 2 on the screen and prints the current cursor column number.#
    when started
    [Display the cursor's current column.]
    set cursor to row [3] column [2] on screen
    print (screen cursor column) on screen ▶

A screenshot of the robot's screen, with a white 2 printed near the center of the upper left quadrant, at row 3 column 2.

screen cursor row#

The screen cursor row reporter block reports the row number where text will be printed as a whole number.

screen cursor row reporter block#
    (screen cursor row)

Parameters

Description

This block has no parameters.

Example

When started, moves the cursor to row 6, column 2 on the screen and prints the current cursor row number.#
    when started
    [Display the cursor's current row.]
    set cursor to row [3] column [2] on screen
    print (screen cursor row) on screen ▶

A screenshot of the robot's screen, with a white 3 printed near the center of the upper left quadrant, at row 3 column 2.

XY Print#

set screen origin#

The set screen origin stack block changes the origin (0, 0) used for drawing or printing on the robot’s screen. By default, the origin is the top-left corner of the screen. This block can reset the origin to an alternate (x, y) screen coordinate location.

set screen origin stack block#
    set screen origin x:[0] y:[0]

Parameters

Description

x

The x-coordinate in pixels to set as the new origin.

y

The y-coordinate in pixels to set as the new origin.

Example

When started, sets the screen origin to (120, 120) and draws a rectangle at the new origin with top-left corner at (0,0), width 80 pixels, and height 40 pixels.#
    when started
    [Set the origin to the center of the screen.]
    set screen origin x:[120] y:[120]
    [Draw a rectangle at the new origin.]
    draw rectangle [0] [0] [80] [40] on screen

A screenshot of the robot’s screen with a white rectangle drawn in the lower left quadrant. The upper left corner of the rectangle is the center of the screen.

Settings#

clear screen#

The clear screen stack block clears all drawings and text from the robot’s screen and resets the cursor position to row 1, column 1.

clear screen stack block#
    clear screen

Parameters

Description

This block has no parameters.

Example

When started, draws a circle with center (120,120) and radius 40 pixels. After 2 seconds, the screen is cleared.#
    when started
    [Draw a circle, and clear it after 2 seconds.]
    draw circle [120] [120] [40] on screen
    wait [2] seconds
    clear screen

fill screen#

The fill screen stack block clears all drawings and text from the robot’s screen, then changes the background to a specified color.

fill screen stack block#
    fill screen with [red v]

Parameters

Description

color

The background color to use:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan

Example

    when started
    [Say "Hello" then turn screen yellow.]
    print [Hello] on screen ▶
    wait [2] seconds
    fill screen with [yellow v]

set font on screen#

The set font on screen stack block sets the font and size used for displaying text on the robot’s screen. This font will apply to all subsequently printed text.

set font stack block#
    set font to [monospaced v] [super small v] on screen

Parameters

Description

type

The font type: monospaced or proportional

size

The font size (shown below):

  • super small
  • extra small
  • small
  • medium
  • large
  • extra large
  • super large

A screenshot of the robot's screen showing a sampling of numbers and letters printed in Mono 12 font. The alphabet spans 1 row of text. The bottom reads 26 characters across and 15 rows.
monospaced super small

The same image as the one previous, with Mono 15 font. The letters A-T span 1 row of text. The bottom reads 20 characters across and 12 rows.
monospaced extra small

The same image as the one previous, with Mono 20 font. The letters A-P span 1 row of text. The bottom reads 16 characters across and 9 rows.
monospaced small

The same image as the one previous, with Mono 24 font. The letters A-M span 1 row of text. The bottom reads 13 characters across and 8 rows.
monospaced medium

Same image as the one previous, with Mono 30 font. The letters A-K span 1 row of text. The bottom reads 11 characters across and 6 rows.
monospaced large

Same image as the one previous, with Mono 40 font. The letters A-H span 1 row of text. The bottom reads 8 characters across and 5 rows.
monospaced extra large

Same image as the one previous, with Mono 60 font. The numbers 1-6 span 1 row of text. The bottom reads 3 rows.
monospaced super large

Same image as the one previous, with  Prop 20 font. The letters A-s span 1 row of text. The bottom reads 20 characters across and 9 rows.
proportional small

Same image as the one previous, with Prop 30 font. The letters A-M span 1 row of text. The bottom reads 15 characters across and 6 rows.
proportional large

Same image as the one previous, with Prop 40 font. The letters A-J span 1 row of text. The bottom reads 11 characters across and 5 rows.
proportional extra large

A screenshot of the robot's screen showing a sampling of numbers printed in Prop 60 font. The numbers 1-7 span 1 row of text. The bottom reads 7 by 3.
proportional super large

Example

When started, sets the font to ‘monospaced extra large’ and prints ‘VEX’ on the screen.#
    when started
    [Display text using a larger font]
    set font to [monospaced v] [extra large v] on screen
    print [VEX] on screen ▶

A screenshot of the robot’s screen shows the word VEX in Mono 40 font printed in white in the upper left corner.

set print precision on screen#

The set print precision on screen stack block sets how many decimal places to show when printing numbers on the robot’s screen. This print precision will apply to all subsequently printed numbers.

set print precision stack block#
    set print precision to [0.1 v] on screen

Parameters

Description

precision

The print precision to use:

  • 1
  • 0.1
  • 0.01
  • 0.001
  • All Digits

Example

When started, sets print precision to two decimal places and prints 1/3 as 0.33 on the screen.#
    when started
    [Print 1/3 as 0.33.]
    set print precision to [0.01 v] on screen
    print ([1] [math_division v] [3]) on screen ▶

A screenshot of the robot’s screen reads 0.33 in white in the upper left corner.

set pen width on screen#

The set pen width on screen stack block sets the thickness of drawn lines and shape outlines.

set pen width stack block#
    set pen width to [10] on screen

Parameters

Description

width

The pen width, in pixels, from 0 to 32.

Example

When started, sets the pen width to 10 pixels and draws a rectangle with the top-left corner at (50,50), width 130 pixels, and height 60 pixels.#
    when started
    [Draw a rectangle with a pen width of 10.]
    set pen width to [10] on screen
    draw rectangle [50] [50] [130] [60] on screen

A screenshot of the robot's screen with a thick white rectangle drawn across the upper half.

set pen / font color on screen#

The set pen / font color on screen stack block sets the color of text, pixels, lines, and shape outlines.

set pen / font color stack block#
    set pen / font color to [red v] on screen

Parameters

Description

color

The pen and font color to use:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

Example

When started, sets the pen color to red and draws a rectangle with the top-left corner at (50, 50), width 130 pixels, and height 60 pixels.#
    when started
    [Draw a rectangle with a red pen.]
    set pen / font color to [red v] on screen
    draw rectangle [50] [50] [130] [60] on screen

A screenshot of the robot’s screen with a red rectangle with a thin border drawn across the upper half.

set fill color on screen#

The set fill color on screen stack block sets the fill color used when shapes are drawn.

set fill color stack block#
    set fill color to [red v] on screen

Parameters

Description

color

The fill color to use:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

Examples

When started, sets the fill color to orange and draws two rectangles. The first is at (50, 50), and the second is at (50, 130), both with a width of 100 pixels and a height of 60 pixels.#
    when started
    [Draw two orange rectangles.]
    set fill color to [orange v] on screen
    draw rectangle [50] [50] [100] [60] on screen
    draw rectangle [50] [130] [100] [60] on screen

A screenshot of the robot’s screen with two parallel orange rectangles with thin, white outlines positioned to the left center of the screen.


When started, sets the background fill color to purple and prints ‘Highlight’ on the screen.#
    when started
    [Display text with a purple background.]
    set fill color to [purple v] on screen
    print [Highlight] on screen ▶

A screenshot of the robot’s screen reads Highlight in white text with a purple highlight around it, beginning in the upper left corner.

Draw#

show image file on screen#

The show image file on screen stack block draws a custom user-uploaded image on the robot’s screen.

show user image stack block#
    show image file [1 v]

Parameters

Description

image slot number

The custom image to use, number 1 to 10. The image number aligns with the number shown in the AIM control panel.

Example

    when started
    [Draw uploaded Image 1.]
    show image file [1 v]

draw pixel on screen#

The draw pixel on screen stack block draws one pixel at the selected x and y coordinate using the current pen color.

By default, the origin is located at the top-left corner of the screen at (0, 0). On the x-axis, 0 is on the left side of the screen, and 240 is on the right side. On the y-axis, 0 is at the top of the screen, and 240 is at the bottom. You can use the set screen origin block to move the origin to a different location. When the origin is changed, the x- and y-coordinate ranges will also change.

For example, if the origin is set to (120, 120), the x and y range will be from -120 to 120 for the x and y coordinates.

draw pixel stack block#
    draw pixel [0] [0] on screen

Parameters

Description

x

The x-coordinate to draw the pixel, from 0 to 240 with the default origin.

y

The y-coordinate to draw the pixel, from 0 to 240 with the default origin.

Example

When started, draws a pixel at the center of the screen at coordinates (120, 120).#
    when started
    [Draw a pixel at the center of the screen.]
    draw pixel [120] [120] on screen

A screenshot of the robot’s screen with a single white pixel in the center.

draw line on screen#

The draw line on screen stack block draws a line from the first screen coordinate (x1, y1) to the second screen coordinate (x2, y2) using the current pen width and pen color.

By default, the origin is located at the top-left corner of the screen at (0, 0). On the x-axis, 0 is on the left side of the screen, and 240 is on the right side. On the y-axis, 0 is at the top of the screen, and 240 is at the bottom. You can use the set screen origin block to move the origin to a different location. When the origin is changed, the x- and y-coordinate ranges will also change.

For example, if the origin is set to (120, 120), the x and y range will be from -120 to 120 for the x and y coordinates.

draw line stack block#
    draw line [0] [0] [10] [10] on screen

Parameters

Description

x1

The x-coordinate in pixels of the start of the line, from 0 to 240 with the default origin.

y1

The y-coordinate in pixels of the start of the line, from 0 to 240 with the default origin.

x2

The x-coordinate in pixels of the end of the line, from 0 to 240 with the default origin.

y2

The y-coordinate in pixels of the end of the line, from 0 to 240 with the default origin.

Example

When started, draws a diagonal line from the top-left corner (0,0) to the bottom-right corner (240,240) of the screen.#
    when started
    [Draw a line from the top left to bottom right of the screen.]
    draw line [0] [0] [240] [240] on screen

A screenshot of the robot’s screen with a thin white diagonal line drawn from the upper left corner to the lower right corner.

draw rectangle on screen#

The draw rectangle on screen stack block draws a rectangle using the current pen width, pen color, and fill color.

By default, the origin is located at the top-left corner of the screen at (0, 0). On the x-axis, 0 is on the left side of the screen, and 240 is on the right side. On the y-axis, 0 is at the top of the screen, and 240 is at the bottom. You can use the set screen origin block to move the origin to a different location. When the origin is changed, the x- and y-coordinate ranges will also change.

For example, if the origin is set to (120, 120), the x and y range will be from -120 to 120 for the x and y coordinates.

draw rectangle stack block#
    draw rectangle [0] [0] [10] [10] on screen

Parameters

Description

x

The x-coordinate in pixels of the top-left corner of the rectangle, from 0 to 240 with the default origin.

y

The y-coordinate in pixels of the top-left corner of the rectangle, from 0 to 240 with the default origin.

width

The width of the rectangle in pixels.

height

The height of the rectangle in pixels.

Example

When started, draws a rectangle on the screen with the top-left corner at (50,50), width of 130 pixels, and height of 60 pixels.#
    when started
    [Draw a rectangle on the screen.]
    draw rectangle [50] [50] [130] [60] on screen

A screenshot of the robot’s screen with a white rectangle drawn across the upper half.

draw circle on screen#

The draw circle on screen stack block draws a circle using the current pen width, pen color, and fill color.

By default, the origin is located at the top-left corner of the screen at (0, 0). On the x-axis, 0 is on the left side of the screen, and 240 is on the right side. On the y-axis, 0 is at the top of the screen, and 240 is at the bottom. You can use the set screen origin block to move the origin to a different location. When the origin is changed, the x- and y-coordinate ranges will also change.

For example, if the origin is set to (120, 120), the x and y range will be from -120 to 120 for the x and y coordinates.

draw circle stack block#
    draw circle [0] [0] [10] on screen

Parameters

Description

x

The x-coordinate in pixels of the center of the circle, from 0 to 240 with the default origin.

y

The y-coordinate in pixels of the center of the circle, from 0 to 240 with the default origin.

radius

The radius of the circle in pixels.

Example

When started, draws a circle on the screen with the center at (120,120) and a radius of 40 pixels.#
    when started
    [Draw a circle on the screen.]
    draw circle [120] [120] [40] on screen

A screenshot of the robot’s screen white a white circle drawn in the center.

Touch#

screen pressed#

The screen pressed Boolean block reports whether the robot’s screen is currently being pressed.

  • True — The screen is being pressed.

  • False — The screen is not being pressed.

screen pressed Boolean block#
    <screen pressed?>

Parameters

Description

This block has no parameters.

Example

When started, continuously checks if the screen is pressed. If pressed, all LEDs turn white; otherwise, they remain off.#
    when started
    [Turn LEDs white only when the screen is pressed.]
    forever 
        if <screen pressed?> then
            set [lightall v] LED color to [white v]
        else
            set [lightall v] LED color to [off v]
        end
    end

screen position#

The screen position reporter block reports the selected coordinate of the last screen press. The x-coordinate is from 0 (left) to 240 (right). The y-coordinate is from 0 (top) to 240 (bottom).

screen position reporter block#
    (screen [x v] position)

Parameters

Description

coordinate

The coordinate of the last screen press to report: x reports the horizontal position, and y reports the vertical position.

Example

When started, continuously checks for screen presses. If pressed, clears the screen and prints the x- and y-coordinates of the touch position.#
    when started
    [Display the x and y coordinate of where the screen is pressed.]
    forever 
        if <screen pressed?> then
            clear screen
            print (screen [x v] position) on screen ▶
            set cursor to next row on screen
            print (screen [y v] position) on screen ▶
        end
    end

when screen event#

The when screen event hat block runs the attached stack of blocks when the robot’s screen is pressed or released.

when screen event hat block#
    when screen [pressed v]

Parameters

Description

action

When to run the attached stack of blocks: pressed runs when the screen is pressed, and released runs when the screen is released.

Example

When the screen is pressed, all LEDs turn green.#
    when screen [pressed v]
        [Set the LEDs to green when the screen is pressed.]
        set [lightall v] LED color to [green v]