Block Glossary

From StarLogo Nova Wiki
This page contains changes which are not marked for translation.


Agents

Block Name Usage Image
Create Each Do create [_] [▼](s) each do

create [_] [▼](s) each do is used to populate Spaceland with agents and then run a stack of code individually for each agent. This can be useful for making many agents and setting different traits for each.

The Create Each Do Block
Delete delete

Deletes the agent executing the stack of code.

The Delete Block
Delete Everyone delete everyone

delete everyone is used to delete all agents from Spaceland.

The Delete Everyone Block
Delete Agent delete agent [_]

delete agent [_] is used to delete a specific agent from Spaceland.

The delete agent block
Scatter scatter

scatter is used to scatter an agent to a random location in SpaceLand.

Scatter.png
Scatter Everyone scatter everyone

scatter everyone is used to scatter all agents in SpaceLand to random locations.

Note: if this block is used in an breed tab where more than one agent of that breed exists, each individual agent of this breed will scatter everyone once. For example, if there are five agents of the breed, everyone will be scattered 5 times as each individual agent runs the code.

Scatter Everyone.png
Take Camera take camera

take camera changes the camera perspective to be from the point of view of the agent executing the code.

can be useful for implementing interactive games from the first-person perspective.
take camera block
Me me

me is used to refer to the agent executing the code. This block is often used as a socket in other blocks, such as delete agent [_].

The Delete Everyone Block
My Parent my parent

my parent refers to the agent that created the agent that is currently executing the code.

take camera block
Create create [_] [▼](s)

create [_] [▼](s) is used to populate Spaceland with agents.

The create block

Detection

Block Name Usage Image
Collidee collidee

collidee is used to refer to the agent that has been collided with when used inside a on collision with [▼] do stack of code. This block is used as a socket in other blocks, such as delete agent [_].

The collidee block
Count Within Steps count [▼] within [_] steps

count [▼] within [_] steps is used to provide the number of agents of a selected breed that exist within a given step limit in Spaceland.

The count within steps
Count Within Steps With = count [▼] within [_] steps with [▼] = [_]

count [▼] within [_] steps with [▼] = [_] is used to provide the number of agents of a selected breed AND specific trait that exist within a given step limit in Spaceland.

Count within steps with equal
Nearest Within Steps nearest [▼] within [_] steps

nearest [▼] within [_] steps is used to refer to the nearest agent of a selected breed that exists within a given step limit in Spaceland.

Nearest within steps
Nearest Within Steps With = nearest [▼] within [_] steps with [▼] = [_]

nearest [▼] within [_] steps with [▼] = [_] is used to refer to the nearest agent of a selected breed AND trait that exists within a given step limit in Spaceland.

Nearest within steps with =
On Collision With Do on collision with [▼] do

on collision with [▼] do begins the execution of a stack of code when a collision is detected with a specific type of agent denoted in the drop down selector. The agent collided with is known as the "collidee". This agent can be referenced using the collidee block.

The on collision with do block

Environment

Block Name Usage Image
Clear Terrain clear terrain

clear terrain is used to clear the Spaceland of all drawings.

The clear terrain block
Set World To set world [▼] to [_]

set world [▼] to [_] is used to set traits of the world in a similar way to agents.

The set world to block
Stamp stamp [_]

stamp [_] causes the agent to draw a circle on the terrain in the agent's current position, with size corresponding to the size of the agent.

stamp
Stamp Grid stamp grid [_]

stamp grid [_] causes the agent to color one grid square on the terrain in the agent's current color on the agent's current position.

Stamp grid
Pen pen [▼]

pen [▼](s) adjusts the pen tool. If the pen is down, the agent stamps the terrain at each position as it moves. If the pen is up, the agent does not stamp the terrain.

pen
Terrain Color terrain color

terrain color refers to the color of the terrain that the agent is currently on.

Terrain color
Clock clock

clock refers to the value of the clock, measured in “ticks”. This value increments by 1 after each iteration of the code. The speed that the clock increments is determined by the value of the engine speed slider. A slider value of n makes the clock tick n times per second. The clock starts at zero when the program is initiated.

Clock
Set Clock To set clock to [_]

set clock to [_] sets the value of clock to some number. Typically, when you reset the clock, you want to start it at 0.

Set clock to
World Trait world trait: [▼]

world trait: [▼] refers to the value of a selected world trait. World traits can be created by adding a new trait to The World breed in the breed manager (go to The World tab and click on the show traits button. Then, select “add custom trait”). This can be thought of as a “global variable."

World trait
The World The World

The World refers to an agent that represents The World. Can be used as a location to mean the center of SpaceLand, which is (0,0).

The world
Reset Terrain Heights
Terrain Height
Get Patch
Dig
Build
Set Patch To
Interpolate
World Glow Amount
Yank Wide
Stomp Wide
Yank Grid
Stomp Grid
Set Directional Light Intensity
Set Directional Light Color
Set Directional Light
Set World Glow To

Interface

Block Name Usage Image
When Pushed when [▼] pushed

when [▼] pushed begins a single execution of a stack of code (from top to bottom) when the pushed button widget is pushed. Widgets can be created using the Edit Widgets feature.

Note: It is useful to use the ‘when pushed’ with a push button widget when you want to execute a code segment once.

The when pushed block
While Toggled while [▼] toggled

while [▼] toggled executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the Edit Widgets feature.

Note: It is useful to use the ‘while toggled’ block with the toggle button widget if you want the code to execute multiple times until the widget is toggled off.

While toggled
Hide hide [▼]

hide [▼] hides a selected widget. Once hidden, you need to use “show” to make it visible again.

hide
Show show [▼]

show [▼] shows a selected widget. By default, all widgets are displayed to the user.

Show
Set Data Box To set [▼] data box to [_]

set [▼] data box to [_] assigns a value to a selected data box.

Set data box to
Data Box [▼] data box

[▼] data box refers to the value of a selected data box.

Note: You should use data boxes for numerical values and labels for textual values. One advantage of using a data box is that you can title it.

Data box
Set Label To set [▼] label to [_]

set [▼] label to [_] assigns a value to a selected label. Unlike data boxes, labels do not have a heading and may be assigned text values.

Set label to
Label [▼] label

[▼] label refers to the value of a selected label.

label
Slider Value [▼] slider value

[▼] slider value refers to the value of a selected slider.

Slider value
Add Data To Line Graph Add data to line graph [▼] for [▼] x-axis: [_] y-axis: [_]

Add data to line graph [▼] for [▼] x-axis: [_] y-axis: [_] adds data to a selected series of a selected graph that’s made up of pairs of x-coordinates and y-coordinates. First create a line graph widget using the Widget Editor, and add one or more series as needed.

Add data to line graph
Clear Line Graph clear line graph [▼]

clear line graph [▼] removes all existing data on the selected line graph.

clear line graph
Engine Tick Rate
Toggle To For
The Toggle To For Block

Keyboard

Block Name Usage Image
Key Held? [▼] key held?

[▼] key held? is a type of logic block that returns a boolean. A true is returned if a specific key denoted in the drop down is held down in the current tick.

Key Held Block
Key typed? [▼] key typed?

[▼] key typed? is a type of logic block that returns a boolean. A true is returned if a specific key denoted in the drop down is typed in the current tick.

key typed code block

Lists

Block Name Usage Image
Insert Into List At Index
Splice List Into List At Index
Remove Item Number From
Item Number In
Index Of In
Contains
Length Of
List

Logic

Block Name Usage Image
If if [_]

if [_] takes in comparative statements from the Logic drawer to test for a condition. The agent will only follow commands attached to the hook if the statement is true.

The if block
If Else
The If Else Block
While
The While Block
With % Chance
The With % Chance Block
Repeat Times
The Repeat Times Block
Yield
The Yield Block
Equals
The Equals Block
Not

Negates the input. So, if the expression evaluates to true, then returns false. If the expression evaluates to false, then returns true.

The Not Block
Not Equals

Determines whether the two inputs are unequal and returns true or false.

The Not Equals Block
Less Than

Determines if the first input is less than the second input and returns true or false.

The Less Than Block
Greater Than

Determines if the first input is greater than the second input and returns true or false

The Greater Than Block
Less Than Or Equal To

Determines if the first input is less than or equal to the second input and returns true or false.

The Less Than Or Equal To Block
Greater Than Or Equal To

Determines if the first input is greater than or equal to the second input and returns true or false.

The Greater Than Or Equal To Block
And

Determines if both the first and second inputs are true. If both are true, then returns true; if one or both of the statements are false, this block returns as false.

The And Block
Or

Determines if either the first or second input are true. If at least one is true then returns true; else returns false.

The Or Block
True

Returns as true.

The True Block
False

Returns as false.

The False Block

Math

Block Name Usage Image
Random To random [_] to [_]

random [_] to [_] defines the upper and lower bounds of a range from which a random number is generated. The number is generated between and including the set limits.

The random to block
Pi

Returns the numerical value of pi (3.14159...).

The Pi Block
Random Decimal

A random decimal between 0 and 1.

The Random Decimal Block
Sum

Returns the sum of two inputs.

The Sum Block
Difference

Returns the difference of two inputs.

The Difference Block
Product

Returns the product of two inputs.

The Product Block
Quotient

Returns the quotient of two inputs.

The Quotient Block
Remainder Of

Returns the remainder of the first input divided by the second input.

The Remainder Of Block
Sin Cos Tan

Compute the mathematical operations of sine, cosine, or tangent and takes as input a value in degrees.

The Sin Cos Tan Block
Arcsin Arccos Arctan

Computes the mathematical operations of arcsine, arccosine, or arctangent and returns a value in degrees.

The Arcsin Arccos Arctan Block
Sqrt

Returns the square root of the input.

The Square Root Block
Log

Returns the log (base 10) of the input.

The Log Block
Ln

Returns the natural log of the input.

The Natural Log Block
Power

Returns the value of the first input raised to the power of the second input.

The Power Block
Larger Of And

Returns the larger or smaller value of the two inputs.

The Larger Of And Block
Round To Decimal Place(s)

Returns the rounded value of the first input with a specified number of decimal points.

The Round To Decimal Place(s) Block
Abs

Returns the absolute value of the input.

The Absolute Value Block

Movement

Block Name Usage Image
Forward forward [_]

forward [_] moves the agent in Spaceland in the heading it is facing. The renderer tweens the movement such that it appears the agent changes location smoothly instead of instantaneous.

The forward block
Backwards backwards [_]

backwards [_] moves the agent in Spaceland in the heading opposite that which it is facing. The renderer tweens the movement such that it appears the agent changes location smoothly instead of instantaneous.

The backwards block
Left By Degs left by [_] degs

left by [_] degs orientates the agent in Spaceland to the left of its original heading by the inputted number of degrees during each Starlogo clock tick.

The left by degs block
Right By Degs

right by [_] degs orientates the agent in Spaceland to the right of its original heading by the inputted number of degrees during each Starlogo clock tick.

The Right By Degrees Block
Up

Will move any agent upwards in the “z” direction by the number of steps specified.

The Up Block
Down

Will move any agent downwards in the “z” direction by the number of steps specified.

The Down Block
Face Towards

Turns to face the agent specified.

The Face Towards Block
Teleport To

Instantly moves to the specified coordinate.

The Teleport To Block

Procedures

Block Name Usage Image
Procedure

Defines a grouping of commands to do a particular function. Select “name” and type over it to rename the procedure.

The Procedure Block
Call

Agent calls a defined procedure to follow from the drop down menu.

The Call Block
Parameter

Returns the value of a selected parameter that has been added in the procedure definition.

The Parameter Block
Return-Early

Used in a procedure definition to end a procedure early with the option of returning a value.

The Return-Early Block
Call (returns)

Calls a procedure that returns a value.

The Call (returns) Block
Block Glossary Category

Sound

Block Name Usage Image
Play Sound

Plays the specified sound.

The Play Sound Block
Sound

Returns the selected sound. You can upload or record your own sounds, or select one from a library of pre-loaded sounds.

The Sound Block

Traits

Block Name Usage Image
My

Returns the value of an agent's trait.

The My Block
Set My To

Sets the selected trait of an agent to the value of the input.

The Set My To Block
Of

Returns the value of a trait belonging to another agent (such as collidee or my parent).

The Of Block
Set Of To
Color

Returns a particular color or a color at random chosen from the drop down menu.

The Color Block
Color RGB

This block will create a color with an amount of red, green, and blue in it as specified by the input values.

The Color RGB Block
Built-In Shape

Returns a particular built-in shape chosen from the drop down menu.

The Built-In Shape Block
Uploaded Shape

Clicking on the dropdown menu will open a page in which you can select an uploaded shape you have used previously or choose to upload a new one.

The Uploaded Shape Block
Glow With Intensity
Stop Glowing

Variables

Block Name Usage Image
Value Of

Returns the value of a selected variable.

The Value Of Block
Set to

Sets the value of a previously existing variable selected from the dropdown menu to the value of the input.

The Set To Block
Var is

Creates a variable (a place to store data) in the agent's context with a specified name. You can rename the variable by selecting the “name” text and typing over it. You can also specify what type of variable using the drop down menu. The variable only exists in the stack of code where it is created.

The Var Is Block

Debugger

Block Name Usage Image
Trait
Assert
Breakpoint
Assert Type of is
Type of is
Breed has trait
Print to JS (value)
The Print to JS (value) Block
Print to JS (condition)
The Print to JS (condition) Block