Megjegyzés

A megjegyzések a Scratch-ben méretezhető szövegdobozok, amelyek blokkokhoz csatolhatóak, de ez nem kötelező. A megjegyzést tartalmazó dobozok mind függőlegesen, mind vízszintesen méretezhetőek, és szabadon áthelyezhetőek a Szkript területen, illetve törölhetőek. Egy a Scratch Team által vezetett felmérésben, amely célja az volt, hogy megállapítsák, melyek a Scratcherek álal leginkább használt szkriptek, a megjegyzés-blokk (amelyet technikai okokból csak véletlenül fedezett fel a felmérést végző motor) a 10. helyen rangsorolta. Ez akkor a weboldalon lévő szkriptek 0,68%-át jelentette. Ez meglepte, egyúttal felbátorította a Scratch Teamet.[1]

Történet

Fájl:The old comment block.png
The old comment block from the Scratch 1.2 beta. It can still be found in old Scratch projects that used the block.
Fájl:Comment.png
The new comment from 2.0
Az Scratch 1.2-es beta verziója vezette be a vezérlőelemként a megjegyzés-blokkot, amely egy szkripten belül that could be placed inside a script as one of its blocks. It made no change to the script, as it only held text Sablon:- however, newer users grew confused about it, causing it to be removed in the official Scratch 1.2 release.

The offline player will treat the comment block as an obsolete block, and as such, stop the script that contains the comment. This can be a problem for old projects that contain the comment block.

Both the Scratch Team and the Scratch community wanted the ability to add comments to scripts in order to improve their readability. Scratch 1.3 introduced the modern comments that are still used today. Since Scratch 1.4, comments can be stuck to a block so that comments remain attached when a script is dragged around. The font used with the comment block, also used in drop-down menus, was changed to Verdana with Scratch 1.3.

Use

A main use for comments is to explain how a script is working. An example is below:

when flag clicked
switch costume to [costume1 v]//Preparing the project...
set [variable v] to [0]
go to x: (0) y: (0)
forever
if <touching color [#372080]?> then//Gameplay.
change [variable v] by (1)
end
if <touching color [#00bb03]?> then
change [variable v] by (-1)
end
end

Sablon:Note

Another purpose of the comment feature is to provide some hidden info the user wishes to not share in the Notes and Credits.[2]

Shapes

Fájl:The two comment types.png
The two comment types. The top one is a mini comment and the bottom one is a full comment.
Comments can be shaped into two ways Sablon:- a full comment or a mini comment. The type can be changed by clicking the gray triangle at the upper-left of a comment.

In 2.0, comments are created by right clicking. If you right-click on a block, the comment will be connected by a (very) thin line to that block. You can edit or delete a comment by right clicking on it.

Mini comments are one line long and hold the amount of characters that will fit on one width of the comment. Change from Mini to Full by clicking the triangle at the top left of the comment. Full comments display all text entered into it, which can extend infinitely.

The width (size) of comments can be altered by clicking (the parallel lines at) the bottom right-hand corner of the comment, and dragging to the desired width (size). This can also be extended infinitely, and is particularly useful if the mini comment is too narrow to display a sufficient amount of characters.

Blocks Plugin

To use comments in the blocks plugin, simply add "//" after the block to be commented, and add the annotation after that. This syntax is derived from comments in most high-level languages. Comments in the Block Plugin look like:

move (10) steps // This is a comment attached to a block.
move (10) steps // This is a comment attached to a block.
//Stray comment
//Stray comment

References

  1. http://blog.scratch.mit.edu/2011/08/what-42-million-scratch-scripts-look.html
  2. https://scratch.mit.edu/projects/26693568/
  • A lap utolsó módosítása: 2016. november 30., 17:02