input and output


alert

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

Returns:   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

Takes:   none

Returns:   list

Returns a list of all open files. See open

show allopen


answer

Takes:   none

Returns:   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

Takes:   none

Returns:   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

Takes:   none

Returns:   none

Opens the project catalog

cat


clearanswer

Takes:   none

Returns:   none

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

clearanswer


clearchar

Takes:   none

Returns:   none

Clears any buffered keyboard presses. See readchar, peekchar

clearchar


close

Takes:   filename (word)

Returns:   none

Closes the specified file. See open

close "file


closeall

Takes:   none

Returns:   none

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

closeall


copyfile

Takes:   source (word) | destination (word)

Returns:   Copies the specified file to the specified destination.

copyfile “myfile “myfile2


createdir

Takes:   directory

Returns:   none

Creates a new directory in the current path.

createdir "newdir


delete

Takes:   file (word)

Returns:   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

Takes:   file (word)

Returns:   none

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

dribble "mydribble.txt


editfile

Takes:   filename (word)

Returns:   none

Opens the specified file for editing in the editor.

editfile "myfile


export

Takes:   name (word)

Returns:   none

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

export "MyCode


filelen


files

Takes:   none

Returns:   [[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

Takes:   extension (word)

Returns:   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

Takes:   name (word)

Returns:   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

Takes:   axis

Returns:   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

Takes:   none

Returns:   buttons

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

show gamebuttons


import

Takes:   file (word)

Returns:   none

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

import "/myfile


input

Takes:   word | number

Returns:   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

Takes:   word

Returns:   none

Places the given list of characters into the keyboard buffer.

keys "abcde


listfiles

Takes:   none

Returns:   none

Lists the files and folders in the current working directory

listfiles


load

Takes:   projectname (word)

Returns:   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

Takes:   filename (word)

Returns:   none

Loads a database into memory. See savedatabase, newdatabase

loaddatabase "mydb


loaddictionary

Takes:   filename | dictionaryname

Returns:   none

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

loaddictionary "dictfile "mydict


loadimage

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

Returns:   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

Takes:   modelname (word) | modelfile (word)

Returns:   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

Takes:   musicname (word) | musicfile (word)

Returns:   none

Loads the specified music file into memory.

loadmusic "mymusic "music.sng


loadplot

Takes:   filename (word) | plotname (word)

Returns:   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

Takes:   sourcefile (word) | destinationfile (word)

Returns:   none

Moves the specified file to the specified destination.

movefile "myfile "newfile


mousebutton

Takes:   none

Returns:   number

Returns 0, 1 (left button), 2 (right button) or 3 (both buttons). Reading mousebutton disables camcontrol. See buttonp, mousex, mousey

show mousebutton


mouseclick

Takes:   screenposition (list) | clicktype (number)

Returns:   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

Takes:   none

Returns:   percentage (number)

Returns the current horizontal mouse position in terms of the percentage of the screen width, with 0 being the left edge. Reading mouse disables camcontrol. See mousey

show mousex


mousey

Takes:   none

Returns:   percentage (number)

Returns the current vertical mouse position in terms of the percentage of the screen height, with 0 being the top edge. Reading mousey disables camcontrol. See mousex

show mousey


nodribble

Takes:   none

Returns:   none

Ends a current dribble, if any. See dribble

nodribble


nostlbacking

Takes:   none

Returns:   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

Takes:   filename (word)

Returns:   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

Takes:   link (longword)

Returns:   none

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

openlink |https://turtlespaces.org|


paddle

Takes:   paddle (number)

Returns:   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

Takes:   none

Returns:   word

Returns the current file path.

show path


peekchar

Takes:   none

Returns:   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

Takes:   filename (word)

Returns:   none

Prints out the specified text file to the screen.

pofile "textfile


prefix

Takes:   none

Returns:   path

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

show prefix


question

Takes:   word or list

Returns:   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

Takes:   none

Returns:   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

Takes:   number

Returns:   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

Takes:   none

Returns:   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

Takes:   filename

Returns:   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

Takes:   none

Returns:   list

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

make "name readlist


readpos

Takes:   none

Returns:   number

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

show readpos


readword rw

Takes:   none

Returns:   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

Takes:   none

Returns:   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

Takes:   source | destination

Returns:   none

Renames a file.

renamefile "oldname "newname


revert

Takes:   none

Returns:   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

Takes:   none

Returns:   none

Creates a save point in the current turtleSpace project.

save


savedatabase

Takes:   database (word) | file (word)

Returns:   none

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

savedatabase "database "mydb


savedictionary

Takes:   dictionaryname | filename

Returns:   none

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

savedictionary "mydict "dictfile


savepict

Takes:   filename (word)

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

savepict “mypic.png


saveproc

Takes:   procedure (word) | filename (word)

Returns:   none

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

saveproc "myproc "myproc.to


saveplot

Takes:   filename (name) | plotname (name)

Returns:   none

Saves the specified plot to the specified file. See plot

saveplot "myplotfile "myplot


savepng

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

Returns:   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! Also, if the camera turtle and the light turtle are different, savepng will use a cruder method of image generation.

savepng [1920 1080] "mypicture.png


savestl

Takes:   modelname (word)

Returns:   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). Lines are converted to cylinders. See also savestlmono, which saves a single amalgamated STL file

savestl "mymodel


savestlmono

Takes:   modelname (word)

Returns:   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 savestl, which separates the vectors by color

savestlmono "mymodel


savewebm

Takes:   seconds

Returns:   none

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

savewebm 20


setpath

Takes:   path (word)

Returns:   none

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

setpath "/


setprefix

Takes:   path

Returns:   none

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

setprefix "/


setread

Takes:   filename (word)

Returns:   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

Takes:   bytes (number)

Returns:   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

Takes:   name (word)

Returns:   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


setwrite

Takes:   filename (word)

Returns:   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

Takes:   byte (number)

Returns:   none

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

setwritepos 60


sharevectors

Takes:   none

Returns:   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

Takes:   none

Returns:   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

Takes:   none

Returns:   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

Takes:   none

Returns:   none

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

takesnapshot


title

Takes:   none

Returns:   title (word)

Returns the title (filename) of the current turtleSpace.

show title


undo

Takes:   none

Returns:   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

Takes:   none

Returns:   bytes (number)

Returns the current write position in bytes.

show writepos


writer

Takes:   none

Returns:   filename (word)

Returns the name of the file currently open for writing.

show writer