environment


about

Takes:   none

Returns:   word

About returns the description of the current turtleSpace. See setabout

show about
This is my turtleSpace


addto

Takes:   procedurename

Returns:   none

Continues line-entry mode of an existing procedure.

addto "existingprocedure


api

Takes:   none

Returns:   none

Enables the socket-based API on port 1967. The API allows you to control turtleSpaces remotely (using telnet) and / or from another application. Multiple connections may be employed simultaneously. Instructions given over the API are executed as the ‘apiX’ worker unless specified, where X is the connection instance, in the order of connection. To output (print, type etc) to the connection, one must call setwrite “api from the API connection, which directs output to that connection. See noapi, which disables the api

api


assemble

Takes:   procedure (word)

Returns:   none

assemble turns the calling turtle’s ‘track’ (its movements and graphics) into a procedure. This is useful for turning ‘sketched out’ designs and objects into procedures for replication later. Note that the procedure created by assemble is not optimised for repetition because the track has no notion of it, so for example if you make a square using REPEAT [FD 20 RT 90], then use assemble, the assembled procedure will read FD 20 RT 90 FD 20 RT 90 etc.

assemble "mydesign


backgroundshade

Takes:   none

Returns:   number

Returns the background shade. See setbackgroundshade

show backgroundshade


backgroundcolor screencolor bg

Takes:   none

Returns:   number

Returns the current background color.

print backgroundcolor
0


blocks

Takes:   none

Returns:   none

Turns on ‘blocks’ mode (in development, mostly broken)

blocks


bury

Takes:   procedure or [procedures]

Returns:   none

Buries the provided procedures. Certain primitives such as ERALL, ERPS, POALL, POPS, POTS EXPORT and SAVE act on everything in the workspace except for procedures that are buried

bury "proc


buryall

Takes:   none

Returns:   none

Buries all of the procedures and container names in the workspace. See bury

buryall


camcontrol

Takes:   none

Returns:   none

Enables a mode whereby you can move the camera turtle in various ways using the mouse. Clicking and dragging orbits the turtle’s anchor point. Right-clicking and moving up and down or vertical scrolling up and down pulls the turtle in or out from the anchor point. Right-clicking and moving left or right or horizontal scrolling rotates the turtle left or right. See nocamcontrol

camcontrol


clearhistory

Takes:   none

Returns:   none

Clears the interactive prompt’s history.

clearhistory


clearsector

Takes:   none

Returns:   none

Clears the name / value pairs (keys) out of the current sector. See zone

clearsector


clearuser

Takes:   none

Returns:   none

Unsets the current user, sets environment to no user. See createuser

clearuser


clearzones

Takes:   none

Returns:   none

Clears (removes) all of the defined zones from the current space.

clearzones


createuser

Takes:   name (word)

Returns:   none

Creates a new user with the specified name.

createuser "Bonnie


creators

Takes:   list

Returns:   none

Creators contains an auto-generated list of the turtleSpace’s creators for use by the catalogue. It is metadata and cannot be retrieved by code. It should not be manually modified. See about

creators [Bonnie]


day

Takes:   none

Returns:   number

Returns the current day of the month.

show day
22


debug

Takes:   none

Returns:   none

Turns on debugging. Debug output is logged to the console / terminal that executes turtleSpaces, so if you need debugging you need to launch it from a console / terminal. Further, debug needs to be used as a prefix from the interactive mode prompt, eg debug myprimitive, otherwise it can be called from inside an primitive and applies to the executing thread.

debug


define

Takes:   procedurename (word) | procedure (list)

Returns:   none

define creates a new procedure of the given procedurename containing the primitives described by the provided list, in the format [[:parameter1 :parameter2] [primitive1 primitive 2 primitive3…]]

define "newprocedure [[:size] [repeat 4 [fd :size rt 90]]]


deletespace

Takes:   word

Returns:   none

Removes the space of the given name.

deletespace "myspace


displaysize

Takes:   none

Returns:   list

Returns the size of the display currently displaying the turtleSpaces window. See windowpos, windowsize, setwindowpos, setwindowsize

show displaysize


dragselect

Takes:   none

Returns:   none

Allows text to be selected and copied to the clipboard by clicking and dragging. See nodragselect

dragselect


ed

Takes:   none

Returns:   none

Opens the entire workspace in the editor. Can also be invoked with control-E. To open just one particular procedure, use edit

ed


edit

Takes:   procedure (word)

Returns:   none

Invokes the editor and opens specified procedure. To edit the entire workspace, use ed

edit "bananas


end

Takes:   none

Returns:   none

Closes a ‘to’, a procedure definition. See to

end


erall

Takes:   none

Returns:   none

Erases all procedures, variables and properties from the workspace.

erall


erase

Takes:   procedure (word)

Returns:   none

Erases the specified procedure from the calling turtle’s workspace

erase "myprocedure


erasekey

Takes:   keyname (word)

Returns:   none

Erases the provided key from the current sector, if that key exists. See zones

erasekey “key


eraseprocs erps

Takes:   none

Returns:   none

Erases all procs in the calling turtle. To erase all procs in all turtles see initialize

eraseprocs


error

Takes:   none

Returns:   sentence

Returns the text of the last error.

show error


flag

Takes:   none

Returns:   none

Executes Myrtle’s flag trigger. Same as pushing the flag button in the web interface, but can be done programmatically, which is useful in the desktop client. Re-enables all other triggers.

flag


frameinterval

Takes:   none

Returns:   milliseconds

(webLogo only) The interval between rendering cycles. This can speed up webLogo use when drawing complicated scenes. Set it with setframeinterval

show frameinterval


fullscreen [fs]

Takes:   none

Returns:   none

Sets the graphics screen ‘fullscreen’, that is, turns off the text screen. The name of this primitive is a remnant from 8-bit computers which could only show either graphics or text in a particular area of the screen at one time. See also splitscreen textscreen overlayscreen

fullscreen


help

Takes:   primitivename (word)

Returns:   none

displays the help entry for the provided primitive name. See viewhelp

help "forward


hideanchor

Takes:   none

Returns:   none

Hides the turtle’s anchor from view. See showanchor, anchor

hideanchor


hidearrow

Takes:   none

Returns:   none

Hides the turtle’s directional arrow. See showarrow

hidearrow


hidemouse

Takes:   none

Returns:   none

Hides the mouse cursor. See showmouse

hidemouse


historycount

Takes:   none

Returns:   number

Returns the number of items in the interactive history.

show historycount


historyitem

Takes:   number

Returns:   list

Returns the number-last interactive line entered, where 1 is the latest. Note that if you do ‘show historyitem 1’ from the interactive prompt, you will get ‘show historyitem 1’ as a result!

show historyitem 5


historylist

Takes:   number

Returns:   list

Returns the last number lines in the interactive prompt’s history in reverse chronological order, where the first item is the last line entered. Note that if you do ‘show historylist 5’ from the interactive prompt, the first item will be ‘show historylist 5’. Also note that duplicate entries are removed automatically by the interactive prompt’s history code and will not be visible in historylist

show historylist 5


hours

Takes:   none

Returns:   number

Returns the current hour in 24 hour time.

print hours


ignore

Takes:   input

Returns:   none

Consumes whatever is fed to it. Useful to pull things off of stacks but you don’t need them, such as message queues (listen) or containers (pop).

ignore listen


initialize

Takes:   none

Returns:   none

Re-initializes the turtleSpaces environment. Clears the workspace and resets all the turtle states. Similar to restart.

initialize


keyclick

Takes:   none

Returns:   none

Causes keypresses to make various beeping noises. See nokeyclick

keyclick


lastrem

Takes:   none

Returns:   word or list

Returns the last (executed) ‘remark’ made using rem. See rem

show lastrem


listprimitives

Takes:   none

Returns:   none

Prints a list of all built-in primitives.

listprimitives


listprocs

Takes:   none

Returns:   none

Prints the names of the procedures currently belonging to the calling turtle. Similar to show procs

listprocs


listzones

Takes:   none

Returns:   none

Prints out the currently defined zones in the Space occupied by the calling turtle.

listzones


maximize

Takes:   none

Returns:   none

Maximizes (makes full-screen) the turtleSpaces window. See restore (which restores it)

maximize


minutes

Takes:   none

Returns:   number

Returns the current minutes value of the computer’s sytem clock

print minutes
10


model

Takes:   none

Returns:   word

Returns the name of the currently selected model.

print model
myrtle

###

modelp

environment

word

boolean

Returns true if there is a model with the name of the provided word.

show modelp "turtle
true


month

Takes:   none

Returns:   month (number)

Returns the current month.

show month
8


newspace

Takes:   name (word)

Returns:   none

Creates a new space with the specified name.

newspace "myspace


newzone

Takes:   name (word) | [x y z] (list) | [x y z] (list)

Returns:   none

Creates a voxeloid ‘zone’, an invisible area of ‘sectors’ in turtleSpace that contain name / value pairs (keys) unique to those sectors. The first list provided to newzone specifies the number of sectors in the x direction, y direction and z direction, the second list specifies the size of those sectors in x, y and z. The zone is created to the up, right and under the turtle relative to its position BUT NOT its orientation, so in the positive x, positive y but negative z from the turtle’s position.

newzone "zone [50 50 50] [5 5 5]


noapi

Takes:   none

Returns:   none

Disables incoming API connectivity. See api

noapi


noblocks

Takes:   none

Returns:   none

Disables blocks mode

noblocks


nocamcontrol

Takes:   none

Returns:   none

Disables ‘camcontrol’ mode

nocamcontrol


nodebug

Takes:   none

Returns:   none

Disables debug. See debug

nodebug


nodes

Takes:   none

Returns:   7179

nodes returns 7179, the blocks of memory free at a ‘cold start’ of Apple Logo on an Apple IIe 128K computer. It exists here only for compatibility.

show nodes
7179


nodragselect

Takes:   none

Returns:   none

Disables dragselect. See dragselect

nodragselect


nokeyclick

Takes:   none

Returns:   none

Disables keyclick if enabled. See keyclick

nokeyclick


noosd

Takes:   none

Returns:   none

Disables the on-screen display. See osd

noosd


nopaging

Takes:   none

Returns:   none

Disables paging. See paging

nopaging


nopaper

Takes:   none

Returns:   none

Disables paper. See paper

nopaper


noprompt

Takes:   none

Returns:   none

Disables the console prompt. Useful for trigger-based programs that use the keyboard, as it prevents the prompt from intercepting input. See prompt, which re-enables it, as does finish, reset

noprompt


nosandbox

Takes:   none

Returns:   none

Disables sandbox mode. Must be called by another turtle without sandbox restrictions (eg myrtle:nosandbox) or nosandbox must be included in the sandbox declaration. See sandbox for more information.

nosandbox
myrtle:nosandbox


nostep

Takes:   none

Returns:   none

Cancels all steps. See step

nostep


notrace

Takes:   none

Returns:   none

Cancels all traces. See trace

notrace


notranscript

Takes:   none

Returns:   none

Disables transcript, if enabled. See transcript

notranscript


nowebtext

Takes:   none

Returns:   none

Disables the webtext pane (webLogo only). Usually followed by setwrite ” to restore output to the interactive text area. See webtext, setwrite

nowebtext setwrite "


osd

Takes:   input

Returns:   none

Displays the provided input on the ‘on-screen display’, a text overlay layer used to display system messages (typically errors). The message remains until you use noosd to turn it off. See noosd

osd [Game over!]


paging

Takes:   none

Returns:   none

pause and wait for a keypress if text output would push previous text output off of the screen generated since the last page prompt, interactive mode prompt, question, input, readchar or readlist – default is enabled. nopaging turns it off

paging


paper

Takes:   none

Returns:   none

Enables ‘paper’ (white) mode. nopaper turns it off.


po

Takes:   name or names (word or list)

Returns:   none

Prints out the specified procedure or procedures to the screen.

po "procedure
po [procedure1 procedure2]


poall

Takes:   none

Returns:   none

Prints out the definition of every procedure and the value of every container in the workspace.

poall


pops

Takes:   none

Returns:   none

Prints all of the calling turtle’s procedures to the screen.

pops


pot

Takes:   procedure name or names (word or list)

Returns:   none

Prints the ‘title(s)’ of the supplied procedure(s) stored in the calling turtle, the ‘to’ declaration that includes the procedure’s parameters.

pot "myprocedure
TO MYPROCEDURE :SIZE :SHAPE


pots

Takes:   none

Returns:   none

Prints the titles of every procedure stored in the calling turtle.

pots


primitives

Takes:   none

Returns:   list

Returns a list of all available primitives (also known as primitives).

show primitives


prompt

Takes:   none

Returns:   none

Enables the console prompt, see noprompt

prompt


putsector setsector

Takes:   name (word) | value

Returns:   none

Stores a key (name / value pair) in the current sector. A zone must be selected, and the calling turtle must be inside a sector for putsector to work. See newzone, whichsector, readsector

putsector "duck 123


randombackgroundcolor randbg rbg

Takes:   none

Returns:   none

Selects a random background color (0 – 15). See setbackgroundcolor

repeat 50 [randbg] setbg 0


randombackgroundshade randbs rbs

Takes:   none

Returns:   none

Selects a random background shade (-12 to 12). See setbackgroundshade

randbs


recycle

Takes:   none

Returns:   none

Forces the underlying Go language to run garbage collection. Garbage collection can cause a momentary pause intermittently. You can use recycle to time it better.

recycle


readsector

Takes:   key (word)

Returns:   value

Returns the value of the specified key in the sector of the selected zone currently inhabited by the calling turtle. See newzone, putsector

show readsector "key


readsectorindex

Takes:   sector (list) | container (word)

Returns:   value

Returns the value of a specified container in the sector indexed by the given list, if all of these things exist.

show readsectorindex [5 5 5] "container


readsectorpos

Takes:   position (list) | container (word)

Returns:   value

Returns the value of the specified container in the sector located at the given position, if all of these things exist.

show readsectorpos position "container


rem

Takes:   list

Returns:   none

Short for remark, rem simply takes a list of text for the purposes of commenting. However, unlike comments created with semicolons, you can follow a rem with additional instructions on the same line. You can also retrieve the last ‘executed’ rem by viewing lastrem, which makes remarks useful for debugging, and removes the need to fill the text display with debug print output. See lastrem.

rem [This is a remark]
rem {|The value of "var is| :var}


redraw

Takes:   none

Returns:   none

Forces a refresh of the graphical environment to ensure transparent objects are rendered after opaque ones. See also redrawtrack

redraw


redrawtrack

Takes:   none

Returns:   none

Forces a refresh of the calling turtle’s ‘turtle track’, to ensure transparent objects are rendered after opaque ones. See also redraw

redrawtrack


renameproc

Takes:   source | destination

Returns:   none

Renames a procedure.

renameproc "oldname "newname


render

Takes:   none

Returns:   none

Enables global (all turtles) rendering of 3D graphics. See norender, which turns it off.

render


rerandom

Takes:   none

Returns:   none

Resets the random number generator to the state ‘seeded’ at initialization (caused by restart, initialize or loading a turtleSpace). This causes a replication of the series of numbers generated by random.

rerandom


reset

Takes:   none

Returns:   none

Clears the environment (excluding frozen tracks and those created by system turtles, if reset is not called by a system turtle), erases all containers, halts all workers, returns all turtles to their home positions in all spaces. See resetspace, clearfrozen

reset


resetall

Takes:   none

Returns:   none

Same as reset, resettext, cleartext and clearallfrozen. Does not affect freezes or terrains created by system turtles unless called by a system turtle.

resetall


resetspace

Takes:   none

Returns:   none

Resets only the turtles in the current space, and space-specific parameters such as the background color.

resetspace


resettime

Takes:   none

Returns:   none

Resets the system timer to zero.

resettime


restart

Takes:   none

Returns:   none

Restarts turtleSpaces.

restart


restore

Takes:   none

Returns:   none

Restores a maximized window. See maximize

restore


sandbox

Takes:   [primitive1 primitive2…]

Returns:   none

Restricts the calling turtle to executing ONLY the listed primitives. Shortcut variants MUST ALSO be declared, if availability is desired. Can be disabled with nosandbox, which either must be included in the list, or called by another turtle with no such restrictions (eg myrtle:nosandbox). See nosandbox

sandbox [forward fd right rt left lt]


seconds

Takes:   none

Returns:   seconds (number)

Returns the current seconds value from the system clock. See hours, minutes

show seconds


sectorkeys

Takes:   none

Returns:   list

Returns the available keys in the sector currently inhabited by the calling turtle. See newzone, putsector

show sectorkeys


selectspace

Takes:   space (word)

Returns:   none

Selects and moves the calling turtle to the given space. This space must have been first created with newspace. The turtle’s track moves with the turtle to the new space.

selectspace "innerspace


selectuser

Takes:   name (word)

Returns:   none

Selects the specified user as the current operating user.

selectuser "Bonnie


selectzone

Takes:   name (word)

Returns:   none

Selects a zone to read sectors from. See zones, newzone

selectzone "zone


setabout

Takes:   word

Returns:   none

Sets the description of the current turtleSpace. This is a ‘long word’, a string bracketed by pipes |. It can also be edited in the ed editor.

setabout |This is my turtleSpace!|


setbackgroundcolor setbg sbg

Takes:   number

Returns:   none

Sets the background color to the color index referenced by the provided number. Note that you can use the color names referenced in the colors primitive description, because they are actually functions which return the corresponding index number.

setbackgroundcolor 5
setbg yellow


setbackgroundshade setbs sbs

Takes:   shade (number)

Returns:   none

Sets the shade of the pen color to be displayed when rendering subsequent lines. It can be set to a number from 0 to 15, which represents a decrease in brightness of the pen color of 6.25 times that number. So, a value of 8 decreases the brightness by 50%.

setbackgroundshade 5


setframeinterval

Takes:   milliseconds

Returns:   none

(webLogo only) Sets the interval between rendering cycles. This can speed up webLogo use when drawing complicated scenes. See frameinterval

setframeinterval 200


setsectorindex

Takes:   sector (list) | container (word) | value

Returns:   none

Sets the value of a specified container in the sector indexed by the given list, if all of these things exist.

setsectorindex [5 5 5] "container :value


setsectorpos

Takes:   position (list) | container (word) | value

Returns:   value

Sets the value of the specified container in the sector located at the given position to the given value, if all of these things exist.

setsectorpos position "container :value


setwindowpos

Takes:   [x y] (list)

Returns:   none

Positions the turtleSpaces application window given the specified x and y (top-left) co-ordinates.

setwindowpos [50 50]


setwindowsize

Takes:   size (y)

Returns:   none

Sets the turtleSpaces window’s height, and by extension its width, as the turtleSpaces window is fixed to a 16:9 ratio.

setwindowsize 20


showanchor

Takes:   none

Returns:   none

Shows the location of the turtle’s anchor with a red ball. See hideanchor, anchor

showanchor


showmouse

Takes:   none

Returns:   none

Shows the mouse cursor. See hidemouse

showmouse


shutdown

Takes:   none

Returns:   none

Shuts down turtleSpaces.

shutdown


space

Takes:   none

Returns:   word

Returns the current space.

show space


spaces

Takes:   none

Returns:   list

Returns a list of the currently defined spaces

show spaces


stack

Takes:   none

Returns:   none

STACK shows the current stack at the terminal.

TYPE stack in interactive mode and you'll get:

2020/05/10 08:44:38 Stack trace:
2020/05/10 08:44:38 0 : frog (line 2, stmt 1): [stack]
2020/05/10 08:44:38 1 : __immediate.0 (line 1, stmt 1): [frog 20]

It's really to help us debug execution of instructions.


step

Takes:   word or list

Returns:   none

When procedures marked by the step primitive start execution, turtleSpaces pauses after execution of each statement.

CR processes next command and PRINTS it to text screen.

S resumes execution until thread leaves current scope (does not print debug during that time).

I executes until thread steps in to a scope.

O executes until the thread enters another TO, then pauses.

E executes until the thread exits a TO, then pauses

Q stops execution entirely

R resumes execution without stepping

N prompts for a "name and then shows the value of that name each step eg "name "value -- typing N and then entering an already monitored name disables monitoring that name. After doing an N STEP returns to the prompt without advancing

Use unstep to unmark procedures from stepping.


text

Takes:   name (word)

Returns:   list

Returns the contents of the provided procedure name as a list. See define

to square
repeat 4 [fd 10 rt 90]
end

show text "square
[[] [repeat 4 [fd 10 rt 90]]]


textscreen ts

Takes:   none

Returns:   none

Turns off the graphics rendering and displays only fullscreen text.

textscreen


tidy

Takes:   procedure (word) | width (number)

Returns:   none

Reformats the specified procedure to the given width, separating nested commands out on to separate lines and doing other things to make your code look tidy

tidy "myproc 40


time

Takes:   none

Returns:   milliseconds

Outputs the number of milliseconds since turtleSpace was started, or resettime was called. See resettime.

print time


to

Takes:   name (:parameter1 :parameter2 …)

Returns:   none

Declares that the user wishes to enter a procedure with the specified name. Can be optionally followed by any number of parameters, each starting with a colon. Each parameter must be specified when the procedure is executed, and these parameters become local containers (or variables) with the name of the parameter specified in the to, containing the value passed to the parameter when the procedure is executed. After return is pressed, the prompt turns into a > to indicate a procedure is being entered. Once you have entered the procedure, type end and press return to finish it. See edit

to square :size
repeat 4 [forward :size right 90]
end

square 40


trace

Takes:   list

Returns:   none

The TRACE command takes a list of procedures as input and causes them to print tracing information when executed. It does not interrupt the execution of the procedure, but allows you to see the depth of the procedure in the stack. See untrace

trace [myproc]


transcript

Takes:   none

Returns:   none

Writes out a session file to disk containing text input, output and traces, in the current project folder. See notranscript

transcript


unbury

Takes:   name or list

Returns:   none

Unburies the named procedures. See bury.

unbury "myproc


unburyall

Takes:   none

Returns:   none

Unburies all procedures and containers currently buried in the workspace. See bury

unburyall


unstep

Takes:   word or list

Returns:   none

Unmarks the named procedure or procedures from stepping. See step

unstep "procedure


untrace

Takes:   list

Returns:   none

Stops tracing the specified procedures.

untrace [myproc]


user

Takes:   none

Returns:   word

Returns the name of the current user.

print user


users

Takes:   none

Returns:   list

Returns a list of the defined users.

print users


view

Takes:   word or list

Returns:   none

Opens the editor with the output provided to view.

view table "table
view workers


viewhelp

Takes:   none

Returns:   none

Opens the help file in the viewer. You can use the cursor keys to scroll through it. shift + up and down scroll through it faster!

viewhelp


viewref

Takes:   none

Returns:   none

Opens the primitive reference file in the viewer. You can use the cursor keys to scroll through it, or control-shift-W to search for a particular primitive. shift + up and down scroll through it faster! You can open the reference faster using control-shift-R. See help

viewref


webtext

Takes:   none

Returns:   none

Only works in webLogo. Causes an 80×24 character text area to appear in the editor location. nowebtext restores the editor. This can be output (print, show, setcursor etc) to by first calling setwrite “webtext — see setwrite, nowebtext

webtext setwrite "webtext


whichsector

Takes:   none

Returns:   list

Returns a list indicating the calling turtle’s currently inhabited sector, based on the selected zone. See selectzone, putsector

show whichsector


whichzones

Takes:   none

Returns:   list

Returns a list of the zones the turtle is currently inside of. See zones, newzone

show whichzones


windowpos

Takes:   none

Returns:   list

Returns the absolute screen position of the top-left corner of the turtleSpaces window. See windowsize, displaysize

show windowpos


windowsize

Takes:   none

Returns:   list

Returns the size of the turtleSpaces window in pixels. See windowpos, displaysize


year

Takes:   none

Returns:   Returns the current year.

print year

2020


zones

Takes:   none

Returns:   list

Returns a list of all zones defined in the current space.

show zones