input and output


alert

input and output

text (word or longword) | buttonnames (list) | actions (list of lists)

none

(Web only) Displays a dialogue that prompts for button input, then executes the associated commands. See example

alert |Pick your animal| [cow pig] [[print "moo][print "oink]]


allopen

input and output

none

list

Returns a list of all open files. See open

show allopen


answer

input and output

none

word, number or list

Returns the last answer typed by the user as a response to a question. See question.

question [What is your name?]
make "username answer


autosave

input and output

none

filepath (word)

Returns the path and filename of the most recent autosave such that ‘load autosave’ will load the current project’s most recent autosave into the workspace.

load autosave


catalog cat

input and output

none

none

Opens the project catalog

cat


clearanswer

input and output

none

none

Clears the ‘answer’ parameter, which contains the input value from the previous ‘question’. See question, answer.

clearanswer


clearchar

input and output

none

none

Clears any buffered keyboard presses. See readchar, peekchar

clearchar


close

input and output

filename (word)

none

Closes the specified file. See open

close "file


closeall

input and output

none

none

Closes all files that are currently open. See open, close

closeall


copyfile

input and output

source (word) | destination (word)

Copies the specified file to the specified destination.

copyfile “myfile “myfile2


createdir

input and output

directory

none

Creates a new directory in the current path.

createdir "newdir


delete

input and output

file (word)

none

Deletes the specified file from the current turtleSpace. For safety, delete can only delete files from the root of the turtleSpace.

delete "myfile


dribble

input and output

file (word)

none

Sends a copy of the characters displayed on the screen to a file. nodribble stops it. See nodribble

dribble "mydribble.txt


editfile

input and output

filename (word)

none

Opens the specified file for editing in the editor.

editfile "myfile


export

input and output

name (word)

none

Saves an .lgo file with the provided name containing the current turtlespace code.

export "MyCode


filelen

input and output


files

input and output

none

[[list] [list]]

Returns a list of entries in the current directory divided into two lists: the first contains folders, the second files.

show files


fileselect

input and output

extension (word)

path

Takes an extension mask as input (without the .) and prompts the user to select a file, returning the path and file selected.

show fileselect “lgo


fork

input and output

name (word)

none

Duplicates the current project and gives it the specified name, and switches to it as the currently active project. Note: If the project has a lot of files in it, this may take some time!

fork "forkedproject


gameaxis

input and output

axis

value

Returns a digital value (-1 0 1) of the specified gamepad axis. Note this only reads gamepads, not the mouse. For analog values use paddle

show gameaxis 1


gamebuttons

input and output

none

buttons

Returns a list of the buttons currently pressed on the gamepad.

show gamebuttons


import

input and output

file (word)

none

Imports (copies) the specified file into the current turtleSpace. Root / is the current user folder.

import "/myfile


input

input and output

word | number

none

Allows the user to enter a word or number which is stored in a container with the name of the first parameter, and whose length is limited by the number provided in the second parameter. For example, ‘input “name 10’ will wait for the user to enter their name, but it can be at most ten characters in length.

input "name 10
melody
print :name
melody


keys

input and output

word

none

Places the given list of characters into the keyboard buffer.

keys "abcde


listfiles

input and output

none

none

Lists the files and folders in the current working directory

listfiles


load

input and output

projectname (word)

none

Loads the specified project from disk. If that project has a procedure called .autostart defined in the Myrtle turtle, that procedure is executed upon load.

load "myproject


loaddatabase

input and output

filename (word)

none

Loads a database into memory. See savedatabase, newdatabase

loaddatabase "mydb


loaddictionary

input and output

filename | dictionaryname

none

Loads the given dictionary from the filename into the dictionary with the given dictionaryname. See dictionary, newdictionary

loaddictionary "dictfile "mydict


loadimage

input and output

imagename (word) | imagefile (word) OR imageurl (url)

none

Loads the specified image from disk or URL into memory. PNG is the only supported image type. A URL must have pipes around it (longword).

loadimage "myimage "imagefile.png


loadmodel

input and output

modelname (word) | modelfile (word)

none

Loads the specified model file into the specified model name, replacing it if it already exists or creating it if necessary.

loadmodel "mymodel "modelfile.mdl


loadmusic

input and output

musicname (word) | musicfile (word)

none

Loads the specified music file into memory.

loadmusic "mymusic "music.sng


loadplot

input and output

filename (word) | plotname (word)

Loads the specified plot file into the specified plot name. The plot does not need to have been previously defined. See plot

loadplot “myplotfile “myplot


movefile

input and output

sourcefile (word) | destinationfile (word)

none

Moves the specified file to the specified destination.

movefile "myfile "newfile


mousebutton

input and output

none

number

Returns 0, 1 (left button), 2 (right button) or 3 (both buttons). See buttonp

show mousebutton


mouseclick

input and output

screenposition (list) | clicktype (number)

none

Simulates a mouse click. The provided screen position should be in terms of percentages of the width and height of the screen, with 0 being the left and top respectively. The second parameter is one of the following: 1 – left click, 2 – right click, 3 – both / middle click. This is useful for tutorials or test workers

mouseclick [50 50] 1


mousex

input and output

none

percentage (number)

Returns the current horizontal mouse position in terms of the percentage of the screen width, with 0 being the left edge.

show mousex


mousey

input and output

none

percentage (number)

Returns the current vertical mouse position in terms of the percentage of the screen height, with 0 being the top edge.

show mousey


nodribble

input and output

none

none

Ends a current dribble, if any. See dribble

nodribble


nostlbacking

input and output

none

none

Discards the backside triangles from 2D and 3D shapes when exporting an STL file. This is enabled by default to make STL file exports from turtleSpaces better compatible with 3D printer ‘slicing’ software. To export them with backside triangles for use in other 3D applications, call stlbacking before savestl. See stlbacking, which enables backside triangles from export.

stlbacking


open

input and output

filename (word)

none

Opens a file for reading or writing. You must also setread / setwrite the file in order to read from / write to it. See close, setread, setwrite

open "myfile


openlink

input and output

link (longword)

none

opens the specified URL (weblogo only) Provided URL parameter must be a longword (enclosed in pipes, see example).

openlink |https://turtlespaces.org|


paddle

input and output

paddle (number)

value (number)

Takes a value from 0 to 3 that indicates the ‘paddle’, which is the axis value of a controller and can be from 0 to 255. Paddles can be controlled either from a joypad (paddle 0 and 1 is usually the horizontal and vertical axes of the left thumbstick respectively, and 2 and 3 the right thumbstick) or using the mouse (paddle 0 and 1 return results based on the mouse’s position on the window.) See buttonp, gameaxis, gamebuttons

show paddle 0


path

input and output

none

word

Returns the current file path.

show path


peekchar

input and output

none

character

Returns the current next character in the keyboard buffer, if any. This character is left in the buffer. See readchar, clearchar

show peekchar


pofile

input and output

filename (word)

none

Prints out the specified text file to the screen.

pofile "textfile


prefix

input and output

none

path

Returns the ‘prefix’ or current file system path. / is the user’s folder.

show prefix


question

input and output

word or list

none

Asks the user the ‘question’ posed in the provided word or list. The answer is retrieved through the answer primitive. See answer

question [What is your name?]


readchar rc

input and output

none

character

Reads a character from the keyboard buffer and returns it. If there is no key in the buffer, it will wait for the user to press a key. See keyp

show readchar


readchars rcs

input and output

number

word

Reads the specified number of characters from the keyboard buffer and returns them as a single word. If there are insufficient keys in the buffer, readchars will wait for the user to press a sufficient quantity of keys to meet the required amount.

show readchars 5


reader

input and output

none

filename

Outputs the name of the current file open for reading. You can change the current read file with the setread primitive. reader returns an empty list if the current reader is the keyboard.

print reader
/myfile.txt


readfile

input and output

filename

list

Returns a list of ‘long words’ (words with spaces), each long word in that list containing one line of the specified input file. You can use ‘parse’ to turn each long word into a list. See parse

show readfile "myfile.txt


readlist rl

input and output

none

list

Inputs a list from the keyboard OR currently open file. See question, readchar, setread

make "name readlist


readpos

input and output

none

number

Returns the current read position in the read file in bytes.

show readpos


readword rw

input and output

none

word

Reads a ‘word’ from the keyboard or open file. As opposed to readlist, this input is returned as a word, or a ‘long word’ if it includes spaces. See readlist, setread

make "input readword


redo

input and output

none

none

Redo reverts the library of procedures in the current turtleSpace to those contained in the next (forwardly) available autosave – it redoes those changes. Hence it is only available after using undo. See undo for a better explanation.

redo


renamefile

input and output

source | destination

none

Renames a file.

renamefile "oldname "newname


revert

input and output

none

none

Reverts to the last formal save, for example if you load a turtleSpace and muck about with it, but want to quickly return it to its original state.

revert


save

input and output

none

none

Creates a save point in the current turtleSpace project.

save


savedatabase

input and output

database (word) | file (word)

none

Saves the specified database under the specified filename. See newdatabase, loaddatabase

savedatabase "database "mydb


savedictionary

input and output

dictionaryname | filename

none

Saves the given dictionary into a file with the given filename. See dictionary, newdictionary

savedictionary "mydict "dictfile


savepict

input and output

filename (word)

Saves a screenshot of the current output window into the specified filename. For high-resolution captures, use savepng

savepict “mypic.png


saveproc

input and output

procedure (word) | filename (word)

none

Saves the specified procedure into the specified file in the current working turtleSpace project.

saveproc "myproc "myproc.to


saveplot

input and output

filename (name) | plotname (name)

none

Saves the specified plot to the specified file. See plot

saveplot "myplotfile "myplot


savepng

input and output

[width height] (list) | name (string)

none

Saves a PNG image rendered using FauxGL using the specified dimensions into the current turtleSpace project folder, as opposed to savepict or snapshot which captures the current rasterized window image. savepng allows you to save extremely high resolution renders, but be careful, since it uses a lot of memory!

savepng [1920 1080] "mypicture.png


savestl

input and output

modelname (word)

none

Creates a folder in the current project folder called modelname.mdl and exports a series of STL files inside it containing the current displayed vectors, one for each color displayed. These can be used with 3D printers, although they may need to be ‘validated’ by another application first (and the sides potentially extruded). See setstllinethickness, which sets the radius of exported lines (they are exported as ropes) See also savestlmono, which saves a single amalgamated STL file

savestl "mymodel


savestlmono

input and output

modelname (word)

none

Creates a folder in the current project folder called modelname.mdl and exports a single STL files inside it containing the current displayed vectors as a single color. This can be used with 3D printers, although it may need to be ‘validated’ by another application first (and the sides potentially extruded). See setstllinethickness, which sets the radius of exported lines (they are exported as ropes) and savestl, which separates the vectors by color

savestlmono "mymodel


savewebm

input and output

seconds

none

Downloads a WEBM of the graphical screen of the specified duration after that duration has elapsed. Web only

savewebm 20


setpath

input and output

path (word)

none

Sets the current file path. Root / is the current user folder.

setpath "/


setprefix

input and output

path

none

Sets the path for file operations. / is always the root of the user’s folder

setprefix "/


setread

input and output

filename (word)

none

Sets a file previously opened with ‘open’ to be read from using readchar, readchars, readword or readlist. setread ” returns input to the keyboard. See open, close, setreadpos, setwrite

setread "inputfile
setread "


setreadpos

input and output

bytes (number)

none

Sets the read position of the current ‘reader’ (the input file set using setread). The provided number must be between 0 and the length of the file.

setreadpos 100


settitle

input and output

name (word)

none

Sets the title of the current turtlespace. Renames the current untitled turtlespace folder or changes the title of the currently open workspace folder. To create a new turtlespace, see initialize

settitle "MyGame


setstllinethickness

input and output

radius (number)

none

Sets the thickness of the rope used to represent lines in models exported using savestl.

setstllinethickness 10


setwrite

input and output

filename (word)

none

Sets the previously ‘open’ed file or output device for writing. setwrite ” returns output to the interactive text area. See open, close, setread

setwrite "file
setwrite "api
setwrite "webtext


setwritepos

input and output

byte (number)

none

Sets the write position in the currently opened file. See setwrite

setwritepos 60


sharevectors

input and output

none

URL

Returns a shareable URL that contains a web view version of the currently displayed vector information. It also displays the sharing user and project description (about). The viewer has a simple camera mechanism, and so models are best oriented to the camera’s typical starting position. It also contains a link allowing for the opening of the current workspace in webLogo. See setabout

sharevectors


stlbacking

input and output

none

none

Includes the backside triangles from 2D and 3D shapes when exporting an STL file. This is turned off by default (nostlbacking) to make STL file exports from turtleSpaces better compatible with 3D printer ‘slicing’ software. To export them with backside triangles for use in other 3D applications, call stlbacking before savestl. See nostlbacking, which disables backside triangles from export.

stlbacking


takecover

input and output

none

none

Takes a cover photo, which is displayed in the file catalog when a turtleSpace is selected. If no cover photo exists, the file catalog displays the most recent auto-created snapshot (created when save is called). See save

takecover


takesnapshot

input and output

none

none

Takes a snapshot (PNG image), and places it in the snapshots folder in the current turtleSpace.

takesnapshot


title

input and output

none

title (word)

Returns the title (filename) of the current turtleSpace.

show title


undo

input and output

none

none

turtleSpaces autosaves any additions or changes to its current library of procedures. To revert to the previous autosave, use undo. To then revert to the next autosave (the one you were previously at) use redo. Note: if you add or change any procedures while in the autosave ‘chain’, the new autosave will be at the end of the chain, and you will need to undo back from the end to return to the state you were at prior to making the change. See redo

undo


writepos

input and output

none

bytes (number)

Returns the current write position in bytes.

show writepos


writer

input and output

none

filename (word)

Returns the name of the file currently open for writing.

show writer