Create: Difference between revisions

From StarLogo Nova Wiki
No edit summary
(Marked this version for translation)
 
(55 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category: Blocks Glossary]]
<languages/>
Creates specified number of agents.
<translate>


== Summary ==
<!--T:11-->
[[Category:Agents]]
<section begin=image/>[[File:Create Block.png|alt=The create block|thumb]]<section end=image/><p id="tooltip">Creates the specified number of agents of the selected breed.</p> The created agents have the default shape, color, and size specified in their breed’s ‘Show Traits’ area. They are created in the middle of the terrain, on the ground (x = 0, y = 0, z = 0), with their headings evenly distributed, starting at 0 degrees (e.g. if 4 are created, one will start out facing toward each of the 4 sides of spaceland.)


text
<!--T:22-->
{{#vardefine:create|<code>create [_] [▼](s)</code>}}<section begin=name/>'''<code>create [_] [▼](s)</code>'''<section end=name/> is a [[Special:MyLanguage/Code Block|code block]] part of the [[Special:MyLanguage/Agent|agents]] drawer.


== Usage ==
==Usage== <!--T:12-->


text
<!--T:13-->
<code>create [_] [▼](s)</code> is used to populate [[Special:MyLanguage/Spaceland|Spaceland]] with [[Special:MyLanguage/Agent|agent]]s.
 
==Syntax== <!--T:14-->
 
<!--T:15-->
[[File:Create Nums Es.png|right|alt=The Create Each Do Block|thumb]]
<!-- <code> create [Textbox: Number] [Dropdown: Type of Agent](s) </code> -->
Inputs in this block:
#a number in the socket
#a breed from the dropdown menu
 
==Example== <!--T:23-->
 
<!--T:24-->
[[File:delete_everyone_example.gif|right|alt=Create Example gif|thumb]]
[[File:create_example.png|right|alt=Create Example code|thumb]]
 
<!--T:25-->
When the setup button is pushed, The World first deletes all the agents, then uses the create block to to create 100 Turtles. Because the Turtles’ defaults have not been changed, they appear as white cubes of size 1. The Turtles also have the default location of (x= 0, y = 0, z = 0) when created, but then The World uses the scatter everyone block, which scatters the Turtles that now exist.
 
==Nuances== <!--T:16-->
 
<!--T:17-->
An important difference between {{#var:create}} and {{#vardefineecho:cedol|<code>[[Special:MyLanguage/Create Each Do|create [_] [▼](s) each do</code>]]}} is that {{#vardefineecho:cedo|<code>create [_] [▼](s) each do</code>}} allows a section of code to run individually for each [[Special:MyLanguage/Agent|agent]] that is created. {{#var:create}} only creates agents with the default [[Special:MyLanguage/Traits|trait]]s in the center of [[Special:MyLanguage/Spaceland|Spaceland]].
 
<!--T:18-->
{{#var:cedol}} can be useful for [[Special:MyLanguage/Random|randomizing traits]] and [[Special:MyLanguage/Scatter|scattering agents without effecting others]].
 
<!--T:19-->
==Related Blocks==
*{{#var:cedol}}
 
==Relevant Video Resources== <!--T:20-->
 
<!--T:21-->
==Relevant Activities==
[[Category:Code Block]]
 
</translate>

Latest revision as of 15:30, 16 August 2023

Other languages:
The create block

Creates the specified number of agents of the selected breed.

The created agents have the default shape, color, and size specified in their breed’s ‘Show Traits’ area. They are created in the middle of the terrain, on the ground (x = 0, y = 0, z = 0), with their headings evenly distributed, starting at 0 degrees (e.g. if 4 are created, one will start out facing toward each of the 4 sides of spaceland.)

create [_] [▼](s) is a code block part of the agents drawer.

Usage

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

Syntax

The Create Each Do Block

Inputs in this block:

  1. a number in the socket
  2. a breed from the dropdown menu

Example

Create Example gif
Create Example code

When the setup button is pushed, The World first deletes all the agents, then uses the create block to to create 100 Turtles. Because the Turtles’ defaults have not been changed, they appear as white cubes of size 1. The Turtles also have the default location of (x= 0, y = 0, z = 0) when created, but then The World uses the scatter everyone block, which scatters the Turtles that now exist.

Nuances

An important difference between create [_] [▼](s) and create [_] [▼](s) each do is that create [_] [▼](s) each do allows a section of code to run individually for each agent that is created. create [_] [▼](s) only creates agents with the default traits in the center of Spaceland.

create [_] [▼](s) each do can be useful for randomizing traits and scattering agents without effecting others.

Related Blocks

Relevant Video Resources

Relevant Activities