(Redirected from Arguments)
- This article is about the part of a block. For a conflict between Scratchers, see Flame War.
- "Insert" redirects here. For the Data block with "Insert" in its name, see Insert () at () of () (block). For a tutorial about how to insert a character into a string, see Inserting a Character into a String.
The following are types of arguments in Scratch:
A numeric input is an input that only accepts numerals, such as "10", "3.2", or "10e5" (in scientific notation). These inputs are rounded in shape to show their difference from other types of inserts.
A string input is an input that accepts any text as input, including words, numerals, and sentences. String inputs also accept Boolean blocks, converting true into the string "true" and converting false into the string "false". These inserts are also round.
A drop-down input is an input that contains a string value that cannot be changed except by clicking the downwards arrow to the right. When the arrow is clicked, a menu of available options appears for the user to choose from. To choose an option, click the option you need. Sometimes, menus will be so long that they don't fit into the maximum space a drop-down takes, in which case a down arrow appears at the bottom and an up arrow appears at the top of the menu. When one hovers their mouse below or above these arrows, respectively, the menu scrolls down or up to show all the options. These inputs are rectangular and take a similar background color to that of the block they are contained in.
Drop-down arrows can also be added to string or numeric inputs, to give easy access to common values in those inputs or to give access to values that cannot be there normally, such as the value "last" in the numeric input in the Item () of () or the various values in the numeric input in the Point in Direction ().
A Boolean input is an input that accepts only Boolean blocks. Blocks that accept Boolean inputs (such as If () Then (block)) will do conditional actions based on the value reported. These inputs are in the shape of elongated hexagons, to correspond with the shape of boolean blocks. If left empty, the value of a Boolean input is always false.
A color input is an input that allows the user to select a color. When a user clicks on the insert, the mouse changes into the "eyedropper" pointer and remains that way until the user clicks again in the editor. The color in the insert will correspond with the color that the mouse is touching when the mouse is clicked. These inputs are square in shape and are empty save their background, which is the color that the user chooses, i.e. the background color is the chosen color for the input. A reporter block may also be dropped into a color input; in this case the value of the reporter should be a number representing the color in ARGB format. See Computer Colors.
|This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.|
The following are the types of arguments with their Squeak code:
- AttributeArgMorph — The first drop-down in the () of () sensing block
- BooleanArgMorph — To insert a Boolean block
- ChoiceArgMorph — A drop-down menu that does not allow reporter blocks to be dropped in
- ChoiceOrExpressionArgMorph — A drop-down menu that allows reporter blocks to be dropped in
- ColorArgMorph — A color argument
- EventTitleMorph — A broadcast
- ExpressionArgMorph — Either a number or string argument
- ExpressionArgMorphWithMenu — Either a number or string argument that has a dropdown menu; differs from ChoiceOrExpressionArgMorph in the fact that it can have something typed in
- SpriteArgMorph — A sprite drop-down menu
The other classes in Scratch-Blocks are block types.
Use in block specs (Scratch 1.4)
- See also: Squeak Tutorial#Block arguments
Argument names are case-sensitive, and each is a letter. In a block spec, they are preceded by a percent sign to distinguish them from the block label.
- a — Attributes in the () of () sensing block
- b — A Boolean argument
- c — A color menu that shows the palette
- C — A color menu that does not show the palette
- d — The direction menu in Point in Direction ()
- D — The drum menu in Play Drum () for () Beats
- e — The broadcast list
- f — The functions in the () of () operators block
- g — The graphic effect list
- H — The drop-down in () Sensor Value
- h — The drop-down in Sensor ()?
- I — The drop-down in Set Instrument to ()
- i — The first drop-down in Item () of ()
- k — The drop-down in When () Key Pressed and Key () Pressed?
- L — The list drop-down menu
- l — The costume or background list
- m — A sprite list; also used for other things
- n — A number argument
- N — The keyboard argument in Play Note () for () Beats
- s — A string argument
- S — The sound list
- v — The variable drop-down menu
- W — The drop-down in Motor Direction ()
- y — The first drop-down in Delete () of ()
Use in block specs (Scratch 2.0)
- b — A Boolean input
- c — A color menu that does not show the palette
- d.direction — The direction menu in Point in Direction ()
- d.drum — The drum menu in Play Drum () for () Beats
- d.instrument — The drop-down in Set Instrument to ()
- d.listDeleteItem — The first drop-down in Delete () of ()
- d.listItem — The first drop-down in Item () of ()
- d.note — The input in Play Note () for () Beats
- m.attribute — Attributes in the () of () sensing block
- m.booleanSensor — The drop-down in Sensor ()?
- m.broadcast — The broadcast list
- m.costume — The costume list
- m.effect — The graphic effect list
- m.key — The drop-down in When () Key Pressed and Key () Pressed?
- m.list — The list drop-down menu
- m.mathOp — The functions in the () of () operators block
- m.motor — The drop-down in Motor Direction ()
- m.sound — The sound list
- m.spriteOnly — A sprite list; also used for other things
- m.triggerSensor — The drop-down in () Sensor Value
- m.var — The variable drop-down menu
- n — A number input
- s — A string input