Spis poleceń › Elements — poleceń: 32


clearallobjects

elements

Wejście: none
Wyjście: none

Clears all objects in all spacers.

clearallobjects

clearobjects

elements

Wejście: class (word)
Wyjście: none

Clears all objects of the given class.

clearobjects "class

deleteobject

elements

Wejście: name (word) | class (word)
Wyjście: none

deleteobject (erases) the specified object. See newobject, object

deleteobject "name "class

dropobject

elements

Wejście: name (word) OR [name class] (list) | model (word) OR [model1 msdelay…] (list) OR [[ico 5]] (list of lists)
Wyjście: none

A shorthand to create an object at the current turtle's position with the current turtle's vectors. If unspecified the object's class is the name of the calling turtle, and the data portion of the object is left blank. See newobject.

dropobject "object "model

hideallobjects

elements

Wejście: none
Wyjście: none

Hides all objects. See newobject, object, showallobjects

hideallobjects

hideobject

elements

Wejście: name (word) | class (word)
Wyjście: none

Hide the specified object. See newobject, object, hideobjects

hideobject "object "class

hideobjects

elements

Wejście: class (word)
Wyjście: none

Hide objects of the specified class. See newobject, object, hideobject

hideobjects "class

listobjectclasses

elements

Wejście: none
Wyjście: none

Prints the currently defined object classes to the screen. See listobjects, newobject

listobjectclasses

listobjects

elements

Wejście: class (word)
Wyjście: none

Prints the currently defined objects belonging to the specified class to the screen. See listobjectclasses

listobjects

missile

elements

Wejście: id (word)
Wyjście: list

Returns a list containing the missile's position, direction, speed and remaining time / distance. See newmissile

show missile "missileid

missiles

elements

Wejście: class (word)
Wyjście: list

Returns a list of currently active missiles belonging to the specified missile class. See newmissile

show missiles "trident

missilescale

elements

Wejście: none
Wyjście: number

Returns the current missile scale (size). See setmissilescale, newmissile

show missilescale

nearmissiles

elements

Wejście: distance or [distance class] or [distance class [position]]
Wyjście: list

Returns a list of lists containing the id and class of any missiles within the given distance of the calling turtle, or a list of missile ids if the distance and class are provided as a list. If a third list position parameter is provided nearmissiles returns the missiles near that position.

show nearmissiles 20
show nearmissiles [20 missiles]
show nearmissiles [20 missiles [100 100 0]]

nearobjects

elements

Wejście: class (word) | distance (number) OR [distance position] (list)
Wyjście: names (list)

Returns a list of objects of the given class within the specified distance of the calling turtle, unless an optional position is specified. Note that hidden objects are not listed by nearobjects. See nearobjectp, newobjects, objects

show nearobjects "balloons 20

newmissile

elements

Wejście: class (word) OR [class physics…] | model (word) OR [model1 msdelay model2 msdelay model3…] OR [[ico 5]] | heading OR [vector] | speed (number) OR [speed [location]] | expiry (milliseconds) or [expiry] (turtle-units)
Wyjście: none

Creates a new 'missile' with the specified parameters, 'fired' from the position of the calling turtle. The first parameter defines the class, or group of missiles, the second defines the turtle model or models used by the missile, the heading (relative to the turtle's direction) or absolute vector is the direction the missile is 'fired' in, the speed is the number of turtle-units the missile travels in one second (this parameter can also be provided as a list with the first value being the speed and the second value being the location), and the final parameter defines if the missile expires after a certain number of milliseconds (number) or after it travels a certain distance [number as single list item] – 0 for this value causes it to travel forever.

A missile may use the physics engine if instead of a class word, the class is given in a list, with the additional physics parameters: physical, mechanical, elastic (except to other missiles) elasticmissile (also with missiles); window (default), wrap or bounce; nogravity (default) or gravity; noreorient (default) or reorient; notorque (default) or torque – only the first parameter is required, but to activate other parameters all intervening parameters are required.

Note that missiles inherit physical parameters from the calling turtle (mass, elasticity and friction) and so these must be set appropriately before calling newmissile. A trick would be to use a hatchling to set the parameters and launch the missile. Also, if two physical missiles of different classes collide, they both expire.

See newmissileid, on, nearmissilep, missile, missilep and stopmissile.
newmissile "missile "turtle forwarddir 20 2000

newmissileid

elements

Wejście: class (word) | model (word) OR [model1 msdelay model2 msdelay model3…] | [vector] | speed (number) OR [speed [location]] | expiry (milliseconds) or [expiry] (turtle-units)
Wyjście: id (word)

Creates a new 'missile' with the specified parameters and returns the name of the missile. See newmissile for complete syntax

show newmissileid "missile "turtle forwarddir 20 2000

newobject

elements

Wejście: name (word) | class (word) | position (list) | heading OR vectors (list) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list)
Wyjście: none

Creates a new object. Objects are static elements such as powerups that can be detected by using nearobjectp and nearobjects.

Note that objects inherit physical parameters from the calling turtle (mass, elasticity and friction) and so these must be set appropriately before calling newobject.

An object may use the physics engine if instead of a class word, the class is given in a list, with the additional physics parameters: physical, mechanical or elastic; window (default), wrap or bounce; nogravity (default) or gravity; noreorient (default) or reorient; notorque (default) or torque – only the first parameter is required, but to activate other parameters all intervening parameters are required.

See newobjects, which can create many objects at once, also object, hideobject, showobject, deleteobject, dropobject, updateobject
newobject "name "class position vectors "model [optional data may be left empty]

newobjects

elements

Wejście: nameprefix (word) | class (word) | [positions] (list of lists) | vectors (list) OR [vectors] (list of lists) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list) OR [[data1][data2]] (list of lists)
Wyjście: none

Creates multiple new objects of the same class. There must be a unique position specified for all new objects (as a list of lists). The number of provided positions dictates the number of objects created. They may share a common list of vectors, or each have unique vectors. They generally all share the same model, although a dynamically generated model (by providing model code) may be used to vary model presentation. A common data element may be provided (which can be empty) or unique data may be provided for each new object. See newobject for more information on objects.

newobjects "nameprefix "class [positions] vectors "model [optional data may be left empty]

object

elements

Wejście: name (word) | class (word)
Wyjście: [position vectors model data] (list)

Returns the object's status. See newobject, objects, objectclasses, listobjects, listobjectclasses

show object "name "class

objectclasses

elements

Wejście: none
Wyjście: list

Returns a list of all the object classes with currently defined objects. See clearobjects, listobjectclasses

show objectclasses

objects

elements

Wejście: class (word)
Wyjście: names (list)

Returns the names of all the objects belonging to the specified class. See object, newobject

show objects "class

removeobject

elements

Wejście: name (word) | class (word)
Wyjście: none

Removes (erases) the specified object. See newobject, object

removeobject "name "class

setmissilescale

elements

Wejście: number
Wyjście: none

Sets the scale (size) of subsequently instantiated missile models. See newmissile, missilescale

setmissilescale 2

showallobjects

elements

Wejście: none
Wyjście: none

Shows all objects. See hideallobjects

showallobjects

showobject

elements

Wejście: name (word) | class (word)
Wyjście: none

Shows the object of the given name and class. See hideobject

showobject "name "class

showobjects

elements

Wejście: class (word)
Wyjście: none

Shows the objects of the given class. See hideobjects

showobjects "class

stillobject

elements

Wejście: "name | "class OR [name1 name2…] | "class OR "name | [class1 class2…]
Wyjście: none

Zeroes velocity and angular velocity of the specified object. If name is a list, stills all listed objects of the given class. If class is a list, ignores name and stills all objects in the listed classes. See newobject, object, hideobject, showobject, deleteobject

stillobject "myobject "enemies
stillobject [obj1 obj2 obj3] "powerups
stillobject "ignored [enemies powerups]

stopmissile

elements

Wejście: id (word) or [id model1 msdelay model2 msdelay…]
Wyjście: none

Stops the missile of the given id, displaying the optional animation before de-existing. The animation is created using the thread that calls stopmissile, so to prevent it from blocking, it needs to be executed by a newworker eg newworker [stopmissile [id anim1 100 anim2 100]]

stopmissile "id
stopmissile [id anim1 100 anim2 100 anim3 100]

stopmissiles

elements

Wejście: class (word) or [class OR [id1 id2 id3…] model1 msdelay model2 msdelay…]
Wyjście: none

Stops the missiles of the given class or list of missile ids, displaying the optional animation before de-existing them.

stopmissiles "class
stopmissiles [class anim1 100 anim2 100 anim3 100]
stopmissiles [[id1 id2 id3]]
stopmissiles [[id1 id2 id3] anim1 100 anim2 100]

stopnearmissiles

elements

Wejście: distance OR [distance class] OR [distance class position] OR [distance [class model1 msdelay…] (position)]
Wyjście: none

Stops missiles near the calling turtle or near the given position (if specified) within the given distance. See newmissle, stopmissiles

stopnearmissiles 10
stopnearmissiles [10 missile]

updateobject

elements

Wejście: name (word) | class (word) | position (list) | vectors (list) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list)
Wyjście: none

Updates an existing object. See newobject

updateobject "name "class position vectors "model [optional data may be left empty]

updateobjects

elements

Wejście: nameprefix (word) | class (word) | [positions] (list of lists) | vectors (list) OR [vectors] (list of lists) | model (word) OR [model1 msdelay model2…] OR [[setfc 15 ico 5]] | data (word) OR data (list) OR [[data1][data2]] (list of lists)
Wyjście: none

Updates multiple objects of the same class. See newobjects

updateobjects "nameprefix "class [positions] vectors "model [optional data may be left empty]