input and output
none
list
Returns a list of all open files. See open
show allopen
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
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
input and output
none
none
Opens the project catalog
cat
input and output
none
none
Clears the ‘answer’ parameter, which contains the input value from the previous ‘question’. See question, answer.
clearanswer
input and output
none
none
Clears any buffered keyboard presses. See readchar, peekchar
clearchar
input and output
filename (word)
none
Closes the specified file. See open
close "file
input and output
none
none
Closes all files that are currently open. See open, close
closeall
input and output
source (word) | destination (word)
Copies the specified file to the specified destination.
copyfile “myfile “myfile2
input and output
directory
none
Creates a new directory in the current path.
createdir "newdir
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
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
input and ouput
filename (word)
none
Opens the specified file for editing in the editor.
editfile "myfile
input and output
name (word)
none
Saves an .lgo file with the provided name containing the current turtlespace code.
export "MyCode
input and output
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
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
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
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
input and output
none
buttons
Returns a list of the buttons currently pressed on the gamepad.
show gamebuttons
input and output
file (word)
none
Imports (copies) the specified file into the current turtleSpace. Root / is the current user folder.
import "/myfile
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
input and output
word
none
Places the given list of characters into the keyboard buffer.
keys "abcde
input and output
none
none
Lists the files and folders in the current working directory
listfiles
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
input and output
imagename (word) | imagefile (word)
none
Loads the specified image from disk into memory. PNG is the only supported image type.
loadimage "myimage "imagefile.png
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
input and output
musicname (word) | musicfile (word)
none
Loads the specified music file into memory.
loadmusic "mymusic "music.sng
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
input and output
sourcefile (word) | destinationfile (word)
none
Moves the specified file to the specified destination.
movefile "myfile "newfile
input and output
none
number
Returns 0, 1 (left button), 2 (right button) or 3 (both buttons). See buttonp
show mousebutton
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
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
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
input and output
none
none
Ends a current dribble, if any. See dribble
nodribble
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
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
input and output
none
word
Returns the current file path.
show path
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
input and output
filename (word)
none
Prints out the specified text file to the screen.
pofile "textfile
input and output
none
path
Returns the ‘prefix’ or current file system path. / is the user’s folder.
show prefix
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?]
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
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
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
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
input and output
none
list
Inputs a list from the keyboard OR currently open file. See question, readchar, setread
make "name readlist
input and output
none
number
Returns the current read position in the read file in bytes.
show readpos
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
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
input and output
source | destination
none
Renames a file.
renamefile "oldname "newname
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
input and output
none
none
Creates a save point in the current turtleSpace project.
save
input and output
filename (word)
Saves a screenshot into the specified filename.
savepict “mypic.png
input and output
procedure (word) | filename (word)
none
Saves the specified procedure into the specified file.
saveproc "myproc "myproc.to
input and output
filename (name) | plotname (name)
none
Saves the specified plot to the specified file. See plot
saveplot "myplotfile "myplot
input and output
filename (name)
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)
savestl "mymodel
input and output
path (word)
none
Sets the current file path. Root / is the current user folder.
setpath "/
input and output
path
none
Sets the path for file operations. / is always the root of the user’s folder
setprefix "/
input and output
filename (word)
none
Sets a file previously opened with ‘open’ to be read from using readchar, readchars, readword or readlist. See open, close, setreadpos, setwrite
setread "inputfile
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
input and output
radius (number)
none
Sets the thickness of the rope used to represent lines in models exported using savestl
setstllinethickness 10
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
input and output
filename (word)
none
Sets the previously ‘open’ed file for writing. See open, close, setread
setwrite "file
input and ouput
byte (number)
none
Sets the write position in the currently opened file. See setwrite
setwritepos 60
input and output
imagename (word)
none
Takes a snapshot of the screen and places it into the internal image library with the given imagename. That image can then be used with ‘sample’ to provide basic 2D collision detection, or used on a ‘billboard’. See listimages, sample, billboard
snapshot "screenshot
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
input and output
none
none
Takes a snapshot (PNG image), and places it in the snapshots folder in the current turtleSpace.
takesnapshot
input and output
none
title (word)
Returns the title (filename) of the current turtleSpace.
show title
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
input and output
none
bytes (number)
Returns the current write position in bytes.
show writepos
input and output
none
filename (word)
Returns the name of the file currently open for writing.
show writer