Mathematical Commands, Camera and Movie Commands,
List Commands, Plotting Commands,
Turtle and Patch Commands, Observer Commands,
Looping Commands, Breed Commands, Control Structure Commands,
Import/Export Commands, File Commands,
Miscellaneous Commands
All of these operators take two inputs, and all act as "infix operators" (going between the
two inputs, as in standard mathematical use).
Note: ^ (exponentiation) is currently implemented only for the observer.
_____________________________________________________________
abs number
Reports the absolute value of number.
Example:
fd abs -7
(Turtles move forward 7 steps.)
_____________________________________________________________
boolean1 and boolean2
Reports true if both boolean1 and boolean2 are true. Note that and
is "infix": it comes between its two inputs.
Example:
if (ycor > 0) and (xcor > 0) [setpc blue]
(The upper-right quadrant of patches turn blue.)
_____________________________________________________________
atan y x
(Both x and y must be numbers)
Reports the arctangent, in degrees (from 0 to 360), of y divided by x. (Note: atan
is accurate to only one or two decimal places.)
Example:
show atan 1 -1
(Prints 135.0 to the command center.)
show atan -1 1
(Prints 315.0 to the command center.)
_____________________________________________________________
bitand number1 number2
bitor number1 number2
bitneg number
bitxor number1 number2
bitand reports the bitwise and of its two inputs. bitor reports the
bitwise or of its two inputs. bitneg reports the bitwise negation of
its input. bitxor takes the bitwise xor of two numbers as inputs.
(For best results, inputs should be limited to 16-bit integers.)
_____________________________________________________________
cos angle
Reports the cosine of angle. Assumes angle is given in degrees.
Example:
show cos 180
(Prints -1.0 in the command center.)
_____________________________________________________________
e
2.718
_____________________________________________________________
exp number
Reports the value of e raised to the number power.
_____________________________________________________________
int number
Reports the largest integer less than or equal to number.
_____________________________________________________________
ln number
Reports the natural logarithm of number.
_____________________________________________________________
max number1 number2
Returns the maximum of the two numbers.
_____________________________________________________________
maxint
32,767
_____________________________________________________________
maxnum
32767.99998 (or 32767 65535/65536)
_____________________________________________________________
min number1 number2
Returns the minimum of the two numbers.
_____________________________________________________________
minint
-32,768
_____________________________________________________________
minnum
-32768.0
_____________________________________________________________
number1 mod number2
Reports number1 modulo number2: that is, the remainder when number1
is divided by number2. Note that mod is "infix": it comes between its two inputs.
Example:
show 62 mod 5
(Prints 2 to the command center.)
_____________________________________________________________
not boolean
Reports true if boolean evaluates to false. Reports false
if boolean evaluates to true.
Example:
if not color = blue [fd 10]
(All non-blue turtles move forward 10 steps.)
_____________________________________________________________
boolean1 or boolean2
Reports true if either boolean1 or boolean2 evaluates to true.
Note that or is "infix": it comes between its two inputs.
Example:
if (xcor > 0) or (ycor > 0) [setpc red]
(All patches turn red, except those in the lower-left quadrant.)
_____________________________________________________________
pi
3.14159
_____________________________________________________________
random number
Reports an integer between 0 and number, including 0 but not number.
_____________________________________________________________
round number
Reports the integer nearest to number.
_____________________________________________________________
sin angle
Reports the sine of angle. Assumes angle is given in degrees.
_____________________________________________________________
sqrt number
Reports the square root of number.
_____________________________________________________________
tan angle
Reports the tangent of angle. Assumes angle is given in degrees.
_____________________________________________________________
xor boolean1 boolean2
Reports the value of boolean1 xor boolean2.
========================================================================
Reports a number between 0 and 100, indicating the brightness of the camera used
with the click command.
_____________________________________________________________
camera-init
Initializes QuickTime-compatible camera plugged into computer. (Camera can be
used to import images into StarLogo patches. See click.)
_____________________________________________________________
camera-click patch-variable
Grabs an image from QuickTime-compatible camera and puts a gray-scale version
of the image in given patch-variable. If image is larger than the screen size,
takes the middle of the image. (You must initialize the camera with camera-init.)
_____________________________________________________________
camera-set-brightness number
Sets the brightness of the camera used with the click command. The input number
must be between 0 and 100.
_____________________________________________________________
close-movie
Stops recording a StarLogo movie and saves it. The movie is created in PICS format.
_____________________________________________________________
movie-snapshot
Captures another frame in the current movie. See setup-movie.
_____________________________________________________________
open-movie file-name
Sets up for StarLogo to create a new movie called file-name. The movie is created
in PICS format.
Example:
setup-movie "ants
(Sets up a movie called ants.)
=============================================================
Reports the value of list with its first element removed.
_____________________________________________________________
butlast, bl list
Reports the value of list with its last element removed.
_____________________________________________________________
empty? list
Reports true if list is the empty list; false otherwise.
_____________________________________________________________
first list
Reports the first element of list.
_____________________________________________________________
fput item list
(first put)
Reports the value of list with item inserted as its first element.
_____________________________________________________________
item item-number list
Reports item item-number of list. Note that numbering of list items starts at 0, not 1.
_____________________________________________________________
last list
Reports the last item of list.
_____________________________________________________________
length list
Reports the length of list.
_____________________________________________________________
list item1 item2
Reports a new list with item1 as its first element, item2 as its second element.
_____________________________________________________________
list? thing
Reports true if thing is a list; false otherwise.
_____________________________________________________________
lput item list
(last put)
Reports the value of list with item inserted as its last element.
_____________________________________________________________
member? item list
Reports true if item is an element of list; false otherwise.
_____________________________________________________________
position item list
Reports the first position of item in the list; if item is not in
the list, reports false.
_____________________________________________________________
sentence, se list1 list2
Reports a new list composed of elements of list1 and the elements of list2.
========================================================================
Clears everything drawn by all plot pens, and resets all pens.
_____________________________________________________________
plot y-value
Plots a point at y-value, then increments the x-value of the plot pen. The pen does
nothing if it is already located at the right edge of the graph.
_____________________________________________________________
plot-point x-value y-value
Plots a point at (x-value, y-value). plot-point is useful for creating
state-space plots.
_____________________________________________________________
plot-xmin
plot-xmax
plot-ymin
plot-ymax
Report the minimum and maximum values of the axes on the plot. These values
can be set with
the commands setplot-xrange and setplot-yrange.
_____________________________________________________________
plot-pen1, pp1
Also: pp2, plot-pen2, ..., pp6, plot-pen6
Selects plot pen number 1. Subsequent plotting commands are executed by plot pen 1.
Similarly, the commands pp2 through pp6 select the other plot pens.
_____________________________________________________________
plot-pencolor, ppc
Reports the color of the plot pen. See section 3 for discussion of StarLogo colors.
_____________________________________________________________
plot-pendown, ppd
Puts down the plot pen, so that it draws connected graphs.
_____________________________________________________________
ppinterval
Reports the x-interval distance that the plot pen moves after a plot command. You
can make the plot pen move less than a pixel, or jump many pixels.
_____________________________________________________________
plot-penup, ppu
Lifts up the plot pen, so that it plots points individually (not connected).
_____________________________________________________________
plot-penreset, ppreset
Clears everything plot pen has drawn and resets its x-coordinate to 0.
_____________________________________________________________
ppxcor
Reports the x-coordinate of the plot pen.
_____________________________________________________________
ppycor
Reports the y-coordinate of the plot pen.
_____________________________________________________________
setplot-pencolor, setppc color
Sets the color of the plot pen to color. See section 3 for discussion of StarLogo
colors.
_____________________________________________________________
setppinterval number
Tells the plot pen to move number distance in the x-direction after each plot
command.
_____________________________________________________________
setplot-xrange min max
setplot-yrange min max
Sets the minimum and maximum values of the axes of the plot.
_____________________________________________________________
setplot-xlabel title
setplot-ylabel title
Sets title as the label along the axes of the plot.
setup-movie file-name
Sets up for StarLogo to create a new movie called file-name. The movie is created
in PICS format.
Example:
setup-movie "ants
(Sets up a movie called ants.)
========================================================================
alive? reports true if the turtle is alive. alive?-of reports true if turtle with the
given ID-number is alive.
_____________________________________________________________
bk number
Moves turtles backward by number steps.
_____________________________________________________________
breed
breed-of id-number
breed-at xcor ycor img src="../images/observer.gif">
Reports the breed of the turtle.
_____________________________________________________________
die
Tells turtles to die.
Example:
if pc = red [die]
(All turtles on red patches die.)
_____________________________________________________________
distance x-coordinate y-coordinate
distance-nowrap x-coordinate y-coordinate
Reports the distance to the point (x-coordinate, y-coordinate)
With distance, turtles and patches use the "wrapped distance" (around the edges of the
screen) if that distance is shorter than the "onscreen distance." With distance-nowrap,
turtles and patches always use the onscreen distance.
Example:
if (distance 0 0) > 10 [setc green]
(All turtles more than 10 units from the center of the screen turn green.)
_____________________________________________________________
dx
dy
dx reports the x-increment if the turtle were to take one step forward. dy reports
the y-increment if the turtle were to take one step forward. These primitives are useful
for "testing" the patch ahead of the turtle before moving.
_____________________________________________________________
forward, fd number
Moves turtles forward by number steps.
_____________________________________________________________
hatch procedure-list
Each turtle creates a new turtle, identical to itself, and tells the new turtle to
execute procedure-list.
Example:
hatch [lt 45] hatch [rt 45]
(Each turtle creates two new turtles, one angled to the left, one angled to the right.)
_____________________________________________________________
heading
heading-of ID-number
heading reports the heading of the turtle. Heading 0 is due north, 90 is east, as so on.
heading-of reports the heading of the turtle with the given ID-number.
_____________________________________________________________
home
Moves the turtle to the middle of the screen, at coordinates (0, 0).
_____________________________________________________________
hideturtle, ht
Hides the turtle, so that it is invisible.
_____________________________________________________________
jump number
Moves turtles forward by number units in one "big step" (in one unit of time).
This command is useful for synchronizing turtle movements. The command fd 15 takes
15 times longer to execute than fd 1, but jump 15 executes in the same time
as jump 1 or fd 1.
_____________________________________________________________
left, lt number
Turns turtles left by number degrees.
_____________________________________________________________
patchcolor, pc
pc-at dx dy
pc reports the color number of a patch.
pc-at reports the color of the patch (dx, dy) units away.
Example:
if pc = white [fd 20]
(All turtles on top of white patches move forward 20 steps.)
if pc = red [setpc blue]
(All red patches turn blue.)
_____________________________________________________________
pendown, pd
Puts down the turtle's pen, so that the turtle draws (leaves a trail) when it moves.
The turtle draws by changing the color of the patches underneath it to its own color.
To change the color of the turtle¹s pen (and the color of the turtle itself), use setc.
_____________________________________________________________
pen-down?
Reports if the pen is down.
_____________________________________________________________
psetbreed
psetbreed-at
psetbreed-of
_____________________________________________________________
pstamp color
pstamp-at dx dy color
pstamp sets the color of all turtles in the patch to color.
pstamp-at is used by a patch to set the color of turtles in the patch (dx, dy)
units away.
_____________________________________________________________
penup, pu
Lifts up the turtle's pen, so that the turtle doesn't draw when it moves. To put down
the turtle's pen, use pd (for pen down).
_____________________________________________________________
psetshape number
Patch sets the shape of one of the turtles on top of it to number.
_____________________________________________________________
psetshape-of turtle# number
Patch sets the shape of turtle turtle# to number.
_____________________________________________________________
psetshape-at dx dy number
Patch sets the shape of all turtles on the patch dx dy away from it to number.
_____________________________________________________________
right rt number
Turns turtles right by number degrees.
_____________________________________________________________
scale-color color variable min max
scale-pc color variable min max
(scale patch color)
Sets the color (for each turtle for scale-color, for each patch for scale-pc)
to a shade of color proportional to its value of variable. The larger the
variable, the lighter the shade of color. If variable is greater than max,
color is close to white. If variable is less than min, the color is black.
Examples:
scale-color red age 0 50
(Colors each turtle a shade of red proportional to its value for the variable age.)
scale-color green chemical 0 50
(Colors each patch a shade of green proportional to its value for the variable chemical.)
_____________________________________________________________
setcolor, setc color
setc-of ID-number color
setc-at dx dy color
setc sets turtle's color to the given color. See section 3 for discussion
of StarLogo colors.
setc-of sets the color of the turtle with the given ID-number.
setc-at is used by a turtle to set the color of turtles in the patch (dx, dy)
units away.
Example:
setc red
(Each turtle turns red.)
_____________________________________________________________
seth-of turtle# heading
Turtle sets the heading of turtle turtle#.
_____________________________________________________________
setheading, seth number
(set heading)
Sets the heading of turtles to number. Heading 0 is due north, 90 is east, and so on.
_____________________________________________________________
setpatchcolor, setpc color
setpc-at dx dy color
setpc sets patch's color to the given color. See section 3 for discussion
of StarLogo colors.
setpc-at is used by a patch to set the color of the patch (dx, dy) units away.
Example:
setpc green
(Each patch turns green.)
_____________________________________________________________
setxcor, setx number
Sets the x-coordinate of turtles to number.
_____________________________________________________________
setxy number1 number2
Sets the x-coordinate of turtles to number1 and the y-coordinate of turtles to
number2.
Example:
setxy 0 0
(All turtles move to the center of the screen.)
_____________________________________________________________
setycor, sety number
Sets the y-coordinate of turtles to number.
_____________________________________________________________
setxy-of turtle# xcor ycor
Turtle sets the xcor and ycor of turtle turtle#.
_____________________________________________________________
setx-of turtle# xcor
Turtle sets the xcor of turtle turtle#.
_____________________________________________________________
sety-of turtle# ycor
Turtle sets the ycor of turtle turtle#.
_____________________________________________________________
shape
shape-at
shape-of
Reports the shape of the turtle.
_____________________________________________________________
showturtle, st
Makes the turtle visible. (Turtle can be hidden with the command ht.)
_____________________________________________________________
sprout list
Patch creates a turtle which runs list.
_____________________________________________________________
stamp color
stamp-at dx dy color
stamp sets the color of the patch under the turtle to the given color.
See section 3 for discussion of StarLogo colors.
stamp-at is used by a turtle to set the color of the patch (dx, dy) units away.
_____________________________________________________________
towards x-coordinate y-coordinate
towards-nowrap x-coordinate y-coordinate
Reports the direction from the turtle towards the point (x-coordinate, y-coordinate).
If the "wrapped distance" (around the edges of the screen) is shorter than the "onscreen
distance," towards will report the direction of the wrapped path, while
towards-nowrap will report the direction of the onscreen path.
_____________________________________________________________
turtle-at x-offset y-offset
better to use: one-of-turtles-at
Reports the ID-number of another turtle in the patch that is x-offset away in the
x-direction and y-offset away in the y-direction. If there are several turtles in
the patch, an arbitrary (other) turtle is picked.
If used by a patch, and there are no turtles in the indicated patch, reports -1. If used by
a turtle, and there are no other turtles in the indicated patch, reports -1.
_____________________________________________________________
turtle-here
better to use: one-of-turtles-here
Reports the ID-number of another turtle in the same patch. If there are several turtles in
the patch, an arbitrary (other) turtle is picked.
If used by a patch, and there are no turtles in the patch, reports -1. If used by a turtle,
and there are no other turtles in the patch, reports -1.
_____________________________________________________________
turtles-at x-offset y-offset
better to use: count-turtles-at
Reports the number of turtles in the patch that is x-offset away in the x-direction
and y-offset away in the y-direction.
_____________________________________________________________
turtles-here
better to use: count-turtles-here
Reports the number of turtles in the patch.
_____________________________________________________________
who
Reports the ID-number of the turtle.
Example:
if who < 50 [setc blue]
(Makes 50 of the turtles blue.)
_____________________________________________________________
xcor
xcor-of ID-number
xcor reports the x-coordinate of a turtle or a patch.
xcor-of reports the x-coordinate of the turtle with the given ID-number.
Example:
sety xcor
(Sets turtles¹ y-coordinate to equal x-coordinate, so that all turtles move to the line y=x.)
_____________________________________________________________
ycor
ycor-of ID-number
ycor reports the y-coordinate of a turtle or a patch.
ycor-of reports the y-coordinate of the turtle with the given ID-number.
Example:
setpc ycor
(Displays the StarLogo color table as horizontal bands.)
=============================================================
Kills all turtles, sets the color of all patches to black, and clears the Plot Window.
_____________________________________________________________
cc
(clear commands)
Deletes all text in the command center.
_____________________________________________________________
cleargraphics, cg
(clear graphics)
Sets the color of all patches to black.
_____________________________________________________________
create-turtles, crt number
Creates number new turtles. New turtles start at position (0, 0). [Explain initial color and headings.]
_____________________________________________________________
diffuse variable number
Tells each patch to share a portion (number) of the value of variable with its eight
neighboring patches. number should be between 0 and 1.
Example:
diffuse chemical 0.5
(Each patch diffuses 0.5 of its variable chemical to its neighboring 8 patches.)
_____________________________________________________________
hidden?-of
Returns true if turtle is hidden.
_____________________________________________________________
nsum variable1 variable2
(neighbor sum)
nsum4 variable1 variable2
(neighbor sum 4)
For each patch, sums the values of variable1 in the surrounding patches and puts
the resulting sum in variable2. nsum4 uses four neighboring patches (north,
east, west, south), while nsum uses eight neighboring patches (including diagonals).
Example:
nsum chemical temp
(Each patch sums the values of chemical in the eight neighboring patches and puts
the resulting sum in the variable temp.)
_____________________________________________________________
inspect turtle#
Pops up a turtle monitor for the numbered turtle. If the turtle is dead
it returns an error.
_____________________________________________________________
osetbreed-of turtle# number
Observer sets the breed of turtle# to number. If the turtle is dead, it
returns an error.
_____________________________________________________________
osetbreed-at xcor ycor number
Observer sets the breed of all turtles at xcor, ycor to number.
_____________________________________________________________
osetc-of turtle# number
Observer sets the color of turtle# to number. If the turtle is dead, it
returns an error.
_____________________________________________________________
oseth-of turtle# number
Observer sets the heading of turtle# to number. if the turtle is dead, it
returns an error.
_____________________________________________________________
osetpc-at xcor ycor number
Observer sets the pc of patch at xcor ycor to number.
_____________________________________________________________
osetshape-of turtle# number
Observer sets the shape of turtle# to number. If the turtle is dead, it
returns an error.
_____________________________________________________________
osetshape-at xcor ycor number
Observer sets the shape of all turtles at xcor, ycor to number.
_____________________________________________________________
hidden?-of turtle#
Reports the hidden status of turtle turtle#. If the turtle is dead, it
returns an error.
_____________________________________________________________
osetx-of turtle# xcor
Observer sets the xcor of turtle turtle#. If the turtle is dead, it returns
an error.
_____________________________________________________________
osety-of turtle# ycor
Observer sets the ycor of turtle turtle#. If the turtle is dead, it returns
an error.
_____________________________________________________________
osetxy-of turtle# xcor ycor
Observer sets the xcor and ycor of turtle turtle#. If the turtle is dead,
it returns an error.
=============================================================
Reports the number of turtles with the color number. Names of colors can be used
(since they evaluate to corresponding color numbers).
Example:
show color-count red
(Prints the number of red turtles.)
_____________________________________________________________
count-color-range color1 color2
or: count-turtles-with[color >= color1 and color <= color2]
Counts how many turtles have a color between color1 and color2.
_____________________________________________________________
count-pc-range color1 color2
Counts how many patches have a color between color1 and color2.
_____________________________________________________________
count-turtles
count-turtles-with list
count-turtles-at
count-turtles-here
Reports the number of turtles.
count-turtles-with counts the number of turtles with list where
list is true.
_____________________________________________________________
max-of-turtles[var], max-of-patches[var] variable
Reports the maximum value of variable (over all turtles or patches).
variable can be either a patch variable or a turtle variable.
Example:
show max-of-turtle[age]
(Prints the maximum value for the variable age over all turtles.)
_____________________________________________________________
max-of-turtles list
max-of-frogs list
max-of-patches list
Returns the max value of turtles of proc list.
If there are no frogs/turtles/patches, returns minnum.
_____________________________________________________________
max-of-turtles-with list1 list2
max-of-frogs-with list1 list2
max-of-patches-with list1 list2
Returns max of turtles/frogs/patches with list1 true of list2.
If nothing satisfies list1 returns minnum.
_____________________________________________________________
min-of-turtles[var], min-of-patches[var] variable
Reports the minimum value of variable (over all turtles or patches).
variable can be either a patch variable or a turtle variable.
Example:
show min-of-turtle[age]
(Prints the minimum value for the variable age over all turtles.)
_____________________________________________________________
min-of-turtles-with ilist1 ilist2
Reports the minimum value of ilist2 over all turtles who satisfy ilist1.
_____________________________________________________________
min-of-patches-with ilist1 ilist2
Reports the minimum value of ilist2 over all patches who satisfy ilist1.
_____________________________________________________________
myself
Reports who of turtle running the max-of-turtle command.
_____________________________________________________________
one-of-turtles
one-of-turtles-at xcor ycor
one-of-turtles-here
one-of-turtles-with list
Picks a random turtle that satisfies one of the four conditions.
_____________________________________________________________
count-pc color
(patch color count)
better to use: count-patches-with[color=number]
Example:
show pc-count green
(Prints the number of green patches.)
_____________________________________________________________
sum-of-turtles[var], sum-of-patches[var]variable
Reports the sum of the values of variable over all turtles (or over all patches,
if variable is a patch variable).
Example:
show sum-of-turtles[age]
(Prints the sum of all of the turtles' ages.)
_____________________________________________________________
turtle-total
Reports the total number of turtles.
_____________________________________________________________
who-max-of-turtles list
who-max-of-turtles-with list1 list2
Reports who of turtle with max value of list. If none, it reports -1.
=============================================================
Ask all the turtles whose breed is frog to do list.
or: if breed = frogs list
_____________________________________________________________
breed
breed-of id-number
breed-at xcor ycor
Reports the breed of the turtle.
_____________________________________________________________
count-frogs
count-frogs-with list
count-frogs-at
count-frogs-here
Reports the number of frogs.
count-frogs-with counts the number of frogs with list where
list is true.
_____________________________________________________________
create-frogs number
Creates number new frogs.
_____________________________________________________________
one-of-frogs
Returns a random frog turtle#.
_____________________________________________________________
one-of-frogs-here
Returns a random frog on your spot.
_____________________________________________________________
one-of-frogs-at xcor ycor
Reports the turtle# of a frog at xcor, ycor. If no turtle, returns -1.
_____________________________________________________________
one-of-frogs-at dx dy
Reports the turtle# of a frog at dx,dy. if no turtle, returns -1.
_____________________________________________________________
one-of-frogs-with ilist
Returns a frog turtle# where ilist is true. If no turtle, returns -1.
_____________________________________________________________
who-max-of-frogs list
who-max-of-frogs-with list1 list2
Reports who of frogs with max value of list. If none, it reports -1.
_____________________________________________________________
who-min-of-frogs ilist
Reports the turtle# who has the minimum value of ilist over all frogs.
=============================================================
Executes procedure-list every number seconds. Can be used only inside of
a "forever button."
_____________________________________________________________
if predicate procedure-list
If predicate evaluates to true, then execute procedure-list.
Example:
if xcor > 0 [setc blue]
(Turtles on the right half of the screen turn blue.)
_____________________________________________________________
ifelse predicate proc-list1 proc-list2
If predicate evaluates to true, then execute proc-list1. If
predicate evaluates to false, then execute proc-list2.
Predicate may have different values for different objects, so some objects may
execute consequent-procedure while others execute alternate-procedure.
Example:
ifelse xcor > 0 [setpc blue] [setpc red]
(The left half of the screen turns red and the right half turns blue.)
_____________________________________________________________
ifelse-report boolean ilist1 ilist2
If boolean is true, executes ilist1 and returns its value.
If boolean is false, executes ilsit2 and returns its value.
_____________________________________________________________
output thing
Does a non-local exit from the current procedure and returns anything to the
caller.
You cannot call this from the command center.
_____________________________________________________________
repeat number procedure-list
Executes procedure-list number times.
Example:
pd repeat 36 [fd 1 rt 10]
(Each turtle draws a circle.)
_____________________________________________________________
stop
Exits immediately from the current procedure.
_____________________________________________________________
wait number
Waits for number seconds.
=============================================================
Deletes all text in the output window.
_____________________________________________________________
save-output
better to use: export-output
Saves the output window to a file.
_____________________________________________________________
set-output-filename
Sets the file to which the StarLogo output window is saved (when you execute the
save-output command). set-output-filename does not take any inputs;
it pops up a dialog box from which you select the file.
=============================================================
Reports the current directory that the starlogo application is in.
_____________________________________________________________
project-directory
Reports the directory that the current project is in. If there is no
named project then it returns false.
_____________________________________________________________
project-name
Reports the current project file name. (without the pathname).
If there is no named project, then it returns false.
_____________________________________________________________
save-project
Saves the current project to the file. Equivalent to doing command-s or
hitting the save project menu item.
_____________________________________________________________
choose-directory-dialog
Pops up a dialog and lets the user pick a directory. It returns
the directory that the user picked, or false if he hit the cancel button.
_____________________________________________________________
choose-file-dialog
Pops up a dialog and lets the user pick a file. It returns
the file (full pathname) that the user picked, or false if he hit the
cancel button.
_____________________________________________________________
choose-new-file-dialog
Pops up a dialog and lets the user create a new file name. It returns
the filename (full pathname) that the user picked, or false if he hit the
cancel button.
_____________________________________________________________
;;current-filename
_____________________________________________________________
export-turtles filename
Saves the turtles to a file.
_____________________________________________________________
export-patches filename
Saves the patches to a file.
_____________________________________________________________
export-turtles-and-patches filename
Saves the turtles and the patches to a file.
_____________________________________________________________
import-turtles
Loads turtles from a file. Lets the user pick the file from a file dialog.
_____________________________________________________________
import-patches
Loads patches from a file. Lets the user pick the file from a file dialog.
_____________________________________________________________
import-turtles-and-patches
Loads turtles and patches from a file. Lets the user pick the file from a
file dialog.
=============================================================
color reports the color of a turtle.
If used by a patch, color reports the color of the turtle on the patch. If there are
several turtles on the patch, it arbitrarily chooses one of them. If there are no turtles
on the patch, it reports the patch¹s color.
color-of reports the color of the turtle with the given ID-number.
color-at reports the color of a turtle in the patch (dx, dy) units away. If
there are several turtles on the patch, it arbitrarily chooses one. If there are no turtles
on the patch, it reports the patch¹s color.
Example:
if color = white [fd 20]
(Moves all white turtles forward 20 steps.)
_____________________________________________________________
display
Turns on the StarLogo graphics display. (It is sometimes useful to turn off the
display to improve performance.)
_____________________________________________________________
no-display
Turns off the StarLogo graphics display. (It is sometimes useful to turn off the display
to improve performance.)
_____________________________________________________________
load-pict filename patch-variable
Takes a graphic image (in PICT format) from the given filename and loads a
gray-scale version of the image into the given patch-variable. Resizes the image
to fit in the StarLogo graphics window. (filename is from the directory from which
StarLogo was launched.)
_____________________________________________________________
mouse-down?
Reports if the mouse button is down. (If the mouse is outside of the StarLogo graphics
window, always reports false.)
_____________________________________________________________
mouse-xcor
mouse-ycor
mouse-xcor reports the StarLogo x-coordinate of the mouse. mouse-ycor
reports the StarLogo y-coordinate of the mouse. (If the mouse is outside of the StarLogo
graphics window, these procedures report values on the border of the window.)
_____________________________________________________________
print thing
Prints thing in the output window (with a carriage return). See also: type
If you want to print a string with special characters (like a space), enclose the string
in vertical bars (e.g. print "|New York|).
_____________________________________________________________
reset-timer, resett
Resets global clock to zero.
_____________________________________________________________
screen-edge
Reports the maximum x-coordinate (and maximum y-coordinate). This is the "half width"
of the StarLogo world. (The full width is actually (2 * screen-edge) + 1.)
_____________________________________________________________
screen-size
Reports the width (or height) of the StarLogo world. (In the current version, the StarLogo
world is always a square, so the width and height are always the same.) You can change the
size by changing the starlogo.patch file (see section 1.4).
_____________________________________________________________
show thing
Prints thing in the command center.
_____________________________________________________________
timer
Prints current value of the global clock in seconds.
_____________________________________________________________
type thing
Prints thing in the output window (without a carriage return). See also: print
If you want to print a string with special characters (like a space), enclose the string in
vertical bars.
Example:
type "|Number of turtles: | type turtle-total
(Prints something like Number of turtles: 247 in the output window)
_____________________________________________________________
word thing, thing
Concatenates the two inputs together and returns the result (as a symbol).
Example:
word "a "b
=> "ab
load-pict (word starlogo-directory "traffic.pict) foo
loads the picture traffic.pict (which is in the starlogo application
director) into patch variable foo.
=============================================================