Innen: Hungarian Scratch-Wiki

(Kezdőlöket megadása)
(fordítás)
1. sor: 1. sor:
{{fordítás|5}}
{{fordítás|5}}
{{Keretes Blokk|blokkok=<sb>(variable::variables)</sb>|felirat=A '''változó''' adatközlő blokkja <br> a Scratch 3.0-ban.}}[[File:Make a var.png|thumb|175px|right|The "Make a Variable" button]]A '''variable''' is a changeable value recorded in [[Scratch]]'s memory. Variables can only hold one value at a time, unlike [[list]]s. These values can be either numbers or [[string]]s {{-}} any text. Clicking on an isolated variable in the [[Scripts Area|scripts area]] displays a small bubble [[Reporter Block|reporting]] the value of the variable. Unlike many other programming languages, Scratch does not allow variables to be created by a script as it runs. Instead, variables are created with the "Make a Variable" button in the [[Block Palette]]. [[List]]s allow multiple values to be stored, acting like a group of variables.
{{Keretes Blokk|blokkok=<sb>(variable::variables)</sb>|felirat=A '''változó''' adatközlő blokkja <br> a Scratch 3.0-ban.}}
[[File:Make a var.png|thumb|175px|right|A "Változó létrehozása" gomb (angolul).]]
A '''változók''' változtatható<ref group=megj.>Innen az elnevezés</ref> értéktárolók a [[Scratch]]ben. A beállított érték eltárolódik a Scratch memóriájában, és bármikor megváltoztatható Scratch blokkok segítségével. A változók egyszerre csak egy értéket tárolhatnak magukban a [[listák]]kal ellentétben. Ezek az értékek vagy számok, vagy [[karakterlánc]]ok (vagyis bármilyen szöveg) lehetnek. Egy elkülönített változóblokkra kattintva a Scratch [[Szkriptterület]]én, vagy [[Blokkpaletta|blokkpalettáján]] előhoz egy kis szövegbuborékot [[Értékblokkok|jelentve] ezzel a felhasználó számára a változó aktuális értékét. Más programozási nyelvekkel ellentétben a Scratch nem teszi lehetővé, hogy szkripten (blokkokon) keresztül lehessen létrehozni változókat (a program futása alatt). Ehelyett a változók a blokkpalettában található {{Idéz|Változó létrehozása}} gombon keresztül alkothatóak meg, amik a program lefutásának befejezésétől és újraindításától függetlenül megmaradnak egészen addig, míg a felhasználó által manuálisan törlésre nem kerülnek.<ref group=megj.>Jobb kattintás a változóhoz tartozó bármilyen blokkra ([[Változó#A változókhoz tartozó blokkok|lásd]]), majd a megjelenő helyi menüből a {{Idéz|Változó törlése}}-t kell kiválasztani ehhez.</ref> A [[listák]] több (meghatározatlan és változtatható számú) értéket is el tudnak tárolni, így úgy viselkednek, mintha egy-egy csoportja lennének egymáshoz kapcsolt változóknak.


== Variables Blocks ==
== A változókhoz tartozó blokkok ==
There are five different [[Variables Blocks|blocks relating to variables]]:
Öt különböző [[Változó blokkok|blokk létezik, amik a változókhoz kapcsolódnak]]:


{{note|Click on a block to find out more.}}
{{Jegyzet|Kattints egy blokkra, hogy többet megtudhass róla.}}


* [[() (Variables block)|<sb>(variable) // This is the block that reports the value of a variable</sb>]]
* [[() (Variables block)|<sb>(változó) // Ez az a blokk, ami a visszaadja a változó aktuális értékét.</sb>]]
* [[Set () to () (block)|<sb>set [variable v] to (0) // This sets a chosen variable to a specified value</sb>]]
* [[Set () to () (block)|<sb>[változó v] legyen (0) // Ez beállítja a változót egy kívánt értékre.</sb>]]
* [[Change () by () (block)|<sb>change [variable v] by (1) // This changes the value of a chosen variable by a specified amount</sb>]]
* [[Change () by () (block)|<sb>[változó v] változzon (1) // Ez megváltoztatja a változó értékét egy kívánt számmennyiséggel. </sb>]]
* [[Show Variable () (block)|<sb>show variable [variable v] // This shows the specified variable in the project player</sb>]]
* [[Show Variable () (block)|<sb>[változó v] változó jelenjen meg // Ez megjeleníti a kiválasztott változó értékét a [[Színpad]]on</sb>]]
* [[Hide Variable () (block)|<sb>hide variable [variable v] // This reverses the 'show variable' block</sb>]]
* [[Hide Variable () (block)|<sb>[változó v] változó tűnjön el // Ez pedig visszacsinálja az előző blokkot (elrejti az értéket). </sb>]]


== Types ==
== Típusai ==
There are three types of variables. All variables are stored in RAM, and default to the values in the file the project originates from ([[Scratch File Format|project.json]]). Variable changes are saved with the project and do not reset on green flag.
Három típusa van a változóknak. All variables are stored in RAM, and default to the values in the file the project originates from ([[Scratch File Format|project.json]]). Variable changes are saved with the project and do not reset on green flag.


=== Global Variables ===
=== Globális Változók ===
By default, when a variable is created, it is a '''global variable'''. Global variables can be read and changed by any [[sprite]], including the [[Stage]].  Opening the [[Scratch File Format|project.json]] file in the SB3 shows that global variables are stored by the stage.
By default, when a variable is created, it is a '''global variable'''. Global variables can be read and changed by any [[sprite]], including the [[Stage]].  Opening the [[Scratch File Format|project.json]] file in the SB3 shows that global variables are stored by the stage.


=== Local Variables ===
=== Helyi Változók ===
'''Local''', (or '''private/personal''') variables are created the same way as global, but another option is selected in the variable creation dialog, "For this sprite only". Local variables are stored independently by each sprite or clone can only be changed by their owner, but can be read by other sprites using the [[() of () (Sensing block)|() of ()]] [[Blocks|block]]. The Stage cannot have local variables.
'''Local''', (or '''private/personal''') variables are created the same way as global, but another option is selected in the variable creation dialog, "For this sprite only". Local variables are stored independently by each sprite or clone can only be changed by their owner, but can be read by other sprites using the [[() of () (Sensing block)|() of ()]] [[Blocks|block]]. The Stage cannot have local variables.


Local variables are extremely useful when a template sprite that needs to be duplicated and edited is wanted. For example, in a game where one must pop bubbles, a "bubble" sprite should be made which has personal variables like "speed" and should be programmed independently. Then it should be duplicated until there are enough bubbles. Since each bubble has an individual "speed" variable, they will not interfere with each other unlike if "speed" was a global variable.
Local variables are extremely useful when a template sprite that needs to be duplicated and edited is wanted. For example, in a game where one must pop bubbles, a "bubble" sprite should be made which has personal variables like "speed" and should be programmed independently. Then it should be duplicated until there are enough bubbles. Since each bubble has an individual "speed" variable, they will not interfere with each other unlike if "speed" was a global variable.
{{note|Clones inherit local variables into their properties, meaning that each clone has a separate number for the local variable. The clone will still keep the value of the variable, but it can change it. This is also useful in the same way.}}
{{Jegyzet|Clones inherit local variables into their properties, meaning that each clone has a separate number for the local variable. The clone will still keep the value of the variable, but it can change it. This is also useful in the same way.}}


=== Cloud Variables ===
=== Megosztott változók ===
{{main|Cloud Data}}
{{|Megosztott változók}}
'''Cloud''' variables are variables that are stored on Scratch's server. When a cloud variable updates, it does so across all instances of the project open, and it also gets saved for the next time the project is opened. Cloud variables have a small cloud icon next to their names. In Scratch 3.0, cloud variables only support numerical data and all are limited to 256 digits, one project can only hold maximum of 10 cloud variables, after that the cloud variable checkbox is greyed out. While it is possible to make chat rooms with cloud variables, it isn't allowed because it would be too hard to moderate.{{cn|date=March 2022}}
'''Cloud''' variables are variables that are stored on Scratch's server. When a cloud variable updates, it does so across all instances of the project open, and it also gets saved for the next time the project is opened. Cloud variables have a small cloud icon next to their names. In Scratch 3.0, cloud variables only support numerical data and all are limited to 256 digits, one project can only hold maximum of 10 cloud variables, after that the cloud variable checkbox is greyed out. While it is possible to make chat rooms with cloud variables, it isn't allowed because it would be too hard to moderate.{{cn|date=March 2022}}
{{note|If a cloud variable has been changed, the user must wait 0.1 seconds before it can be changed again.}}
{{note|If a cloud variable has been changed, the user must wait 0.1 seconds before it can be changed again.}}


== Uses ==
== Használat ==
{{main|What can I use variables for?}}
{{|Változók használata}}
[[File:Slider Min And Max.PNG|150px|thumb|left|Setting the slider min and max.]]
[[File:Slider Min And Max.PNG|150px|thumb|left|Setting the slider min and max.]]
[[File:Checkbox to show or hide variable.png|frame|right|The checkbox to show/hide a variable in 3.0.]]Variables are used whenever a value must be stored {{-}} e.g., if a [[project]] required the user to input a name and then remember that name, the name would be stored in a variable. With this, the name can be retrieved at any time; all the project has to do is check the value (which is the name).
[[File:Checkbox to show or hide variable.png|frame|right|The checkbox to show/hide a variable in 3.0.]]Variables are used whenever a value must be stored {{-}} e.g., if a [[project]] required the user to input a name and then remember that name, the name would be stored in a variable. With this, the name can be retrieved at any time; all the project has to do is check the value (which is the name).
41. sor: 43. sor:
It can be chosen whether to hide or show a variable on the stage by clicking the tick box in the variable panel.
It can be chosen whether to hide or show a variable on the stage by clicking the tick box in the variable panel.


===Length Limit===
=== Hosszúsági korlát ===
In the past, trying to join a string to a variable could only make the variable up to 10,240 characters {{cite post|myhf|5/5/2015|A variable can hold up to 10240 unicode characters.|[[post:993624]]}}. It is a common misconception that there is still the limit, but there is no limit in scratch 3.0.<ref>[[projects:678806251]]</ref>
In the past, trying to join a string to a variable could only make the variable up to 10,240 characters {{cite post|myhf|5/5/2015|A variable can hold up to 10240 unicode characters.|[[post:993624]]}}. It is a common misconception that there is still the limit, but there is no limit in scratch 3.0.<ref>[[projects:678806251]]</ref>


== Glitch Variables ==
== Hibás változók ==
{{obsolete feature|cat=no}}
{{Elavult}}
[[File:Variableglitch1.png|frame|left|thumb|Some examples of the glitch variables]]
[[File:Variableglitch1.png|frame|left|thumb|Some examples of the glitch variables]]
[[File:VariableGlitch2.png|frame|right|thumb|Green flag/stop sign glitch variables]]
[[File:VariableGlitch2.png|frame|right|thumb|Green flag/stop sign glitch variables]]
53. sor: 55. sor:
{{----}}
{{----}}


== Lists ==
== Listák ==
{{main|List}}
{{|Listák}}
A list is made of [[item]]s {{-}} each item like a variable. Lists can be useful when many variables are needed or when the amount of memory that needs to be stored can not be determined by the programmer before the project is run. However, lists can only store 200,000 items and not more.<ref>https://github.com/LLK/scratch-vm/wiki/Compatibility</ref>
A list is made of [[item]]s {{-}} each item like a variable. Lists can be useful when many variables are needed or when the amount of memory that needs to be stored can not be determined by the programmer before the project is run. However, lists can only store 200,000 items and not more.<ref>https://github.com/LLK/scratch-vm/wiki/Compatibility</ref>


===Cloud Lists===
=== Megosztott listák ===
Cloud lists do not exist in Scratch [[3.0]]. It has been suggested many times and is rejected by the [[Scratch Team]].<ref>Za Chary. (19/3/2019). "...the Scratch Team will not be adding an easy official way to make cloud lists." [[topic:343602]]</ref> Cloud lists, if they existed, would be accessible by all Scratchers via the cloud server.
Cloud lists do not exist in Scratch [[3.0]]. It has been suggested many times and is rejected by the [[Scratch Team]].<ref>Za Chary. (19/3/2019). "...the Scratch Team will not be adding an easy official way to make cloud lists." [[topic:343602]]</ref> Cloud lists, if they existed, would be accessible by all Scratchers via the cloud server.


Some [[Scratch Modifications]] contain cloud lists. Some projects also contain cloud lists, although they are very hard to make and most of them usually break in new versions of Scratch. The only way to make one is to encode and decode lists into and from cloud variables, but this is very limited because variables are restricted to 256 digits.
Some [[Scratch Modifications]] contain cloud lists. Some projects also contain cloud lists, although they are very hard to make and most of them usually break in new versions of Scratch. The only way to make one is to encode and decode lists into and from cloud variables, but this is very limited because variables are restricted to 256 digits.


== Types of Readouts ==
== Megjelenítés formái ==
{{main|Variable Monitor}}
{{main|Variable Monitor}}
[[File:Updated variable readouts.png|169px|thumb|The three different variable displays in Scratch 3.0.]]
[[File:Updated variable readouts.png|169px|thumb|The three different variable displays in Scratch 3.0.]]
If a variable stage monitor is right-clicked, a menu shows up with three options: normal readout, large readout, and slider. In [[Scratch 2.0]] and before, there was also a show/hide option. In [[Scratch 1.4]], the selected option had two asterisks (*) around it.
If a variable stage monitor is right-clicked, a menu shows up with three options: normal readout, large readout, and slider. In [[Scratch 2.0]] and before, there was also a show/hide option. In [[Scratch 1.4]], the selected option had two asterisks (*) around it.


== Examples ==
== Példák ==
Variables are used in numerous projects to keep score, show health, connect with players, or list some friends. Here are some projects that use variables:
Variables are used in numerous projects to keep score, show health, connect with players, or list some friends. Here are some projects that use variables:


79. sor: 81. sor:
== Lásd még ==
== Lásd még ==
* [[Megosztott változók]]
* [[Megosztott változók]]
* [[Adatok blkkjai Blocks]]
* [[Adatok Blokkok]]
* [[List]]ák
* [[Adatblokk|Adatközlő blokkok]]
* [[Stage Monitor]]
* [[Listák]]
* [[Színpadi Megjelenítő]]


== External Links ==
== Külső hivatkozások ==
* {{wp|Változó|Változó}} a Wikipédián
* {{wp|Változó|Változó}} a Wikipédián
* [http://docs.google.com/spreadsheet/ccc?key=0Ai13BQTlMxCzdG5lelZDczFnc241S2FmWVNhcEkwMEE#gid=0 Input Type Specifiers] ({{l|en}})
* [http://docs.google.com/spreadsheet/ccc?key=0Ai13BQTlMxCzdG5lelZDczFnc241S2FmWVNhcEkwMEE#gid=0 Input Type Specifiers] ({{l|en}})


== References ==
== Megjegyzések ==
<references group="megj"/>
 
== Hivatkozások ==
<references/>
<references/>



A lap 2024. január 3., 11:49-kori változata

Icon translate.png Ez a szócikk még erősen fordítás alatt áll. Akadhatnak benne más nyelvű szövegek is.


(variable::variables)
A változó adatközlő blokkja
a Scratch 3.0-ban.
A "Változó létrehozása" gomb (angolul).

A változók változtatható[megj. 1] értéktárolók a Scratchben. A beállított érték eltárolódik a Scratch memóriájában, és bármikor megváltoztatható Scratch blokkok segítségével. A változók egyszerre csak egy értéket tárolhatnak magukban a listákkal ellentétben. Ezek az értékek vagy számok, vagy karakterláncok (vagyis bármilyen szöveg) lehetnek. Egy elkülönített változóblokkra kattintva a Scratch Szkriptterületén, vagy blokkpalettáján előhoz egy kis szövegbuborékot [[Értékblokkok|jelentve] ezzel a felhasználó számára a változó aktuális értékét. Más programozási nyelvekkel ellentétben a Scratch nem teszi lehetővé, hogy szkripten (blokkokon) keresztül lehessen létrehozni változókat (a program futása alatt). Ehelyett a változók a blokkpalettában található „Változó létrehozása” gombon keresztül alkothatóak meg, amik a program lefutásának befejezésétől és újraindításától függetlenül megmaradnak egészen addig, míg a felhasználó által manuálisan törlésre nem kerülnek.[megj. 2] A listák több (meghatározatlan és változtatható számú) értéket is el tudnak tárolni, így úgy viselkednek, mintha egy-egy csoportja lennének egymáshoz kapcsolt változóknak.

A változókhoz tartozó blokkok

Öt különböző blokk létezik, amik a változókhoz kapcsolódnak:

Megjegyzés Megjegyzés: Kattints egy blokkra, hogy többet megtudhass róla.

Típusai

Három típusa van a változóknak. All variables are stored in RAM, and default to the values in the file the project originates from (project.json). Variable changes are saved with the project and do not reset on green flag.

Globális Változók

By default, when a variable is created, it is a global variable. Global variables can be read and changed by any sprite, including the Stage. Opening the project.json file in the SB3 shows that global variables are stored by the stage.

Helyi Változók

Local, (or private/personal) variables are created the same way as global, but another option is selected in the variable creation dialog, "For this sprite only". Local variables are stored independently by each sprite or clone can only be changed by their owner, but can be read by other sprites using the () of () block. The Stage cannot have local variables.

Local variables are extremely useful when a template sprite that needs to be duplicated and edited is wanted. For example, in a game where one must pop bubbles, a "bubble" sprite should be made which has personal variables like "speed" and should be programmed independently. Then it should be duplicated until there are enough bubbles. Since each bubble has an individual "speed" variable, they will not interfere with each other unlike if "speed" was a global variable.

Megjegyzés Megjegyzés: Clones inherit local variables into their properties, meaning that each clone has a separate number for the local variable. The clone will still keep the value of the variable, but it can change it. This is also useful in the same way.

Megosztott változók

Főcikk: Megosztott változók

Cloud variables are variables that are stored on Scratch's server. When a cloud variable updates, it does so across all instances of the project open, and it also gets saved for the next time the project is opened. Cloud variables have a small cloud icon next to their names. In Scratch 3.0, cloud variables only support numerical data and all are limited to 256 digits, one project can only hold maximum of 10 cloud variables, after that the cloud variable checkbox is greyed out. While it is possible to make chat rooms with cloud variables, it isn't allowed because it would be too hard to moderate.Sablon:Cn Sablon:Note

Használat

Főcikk: Változók használata
Setting the slider min and max.
The checkbox to show/hide a variable in 3.0.

Variables are used whenever a value must be stored – e.g., if a project required the user to input a name and then remember that name, the name would be stored in a variable. With this, the name can be retrieved at any time; all the project has to do is check the value (which is the name).

The look of the variable monitor can be changed into three forms: The normal readout, the large readout, and the slider. The form of the variable can be changed by double-clicking or right-clicking it and selecting the option that is wanted.

The normal readout contains the title and the value, the large readout only contains a value, and the slider is similar to the normal readout, but has a slider on it. If the slider is chosen, there will be another option once right-clicked called "Change slider range." Choosing it will allow the user to set the range of the slider.

It can be chosen whether to hide or show a variable on the stage by clicking the tick box in the variable panel.

Hosszúsági korlát

In the past, trying to join a string to a variable could only make the variable up to 10,240 characters Sablon:Cite post. It is a common misconception that there is still the limit, but there is no limit in scratch 3.0.[1]

Hibás változók

Archive.png Ezen oldal tárgya jelentősen megváltozott, így a lap frissítésre szorul. Néhány információ vagy kép elavult lehet a Scratch vagy a weboldal, esetleg a cikk más tárgyának jelenlegi verziójához mérten.


Some examples of the glitch variables
Green flag/stop sign glitch variables

Glitch variables could be made by naming them with names including %d (direction drop down/number insert), %s (text input), %m (variable drop down), %b (boolean), %n (number input), or %c (color input), which will look like those at the left. This is because Scratch reads the percent sign followed by certain letters as an argument. By naming a variable @greenFlag or @stop it will display a green flag or a stop sign, respectively, as seen at the right. Also, the codes @turnRight and @turnLeft create a rotate sign, right or left.

This bug was patched in v423 of Scratch 2.0 and no longer works. Sablon:----

Listák

Főcikk: Listák

A list is made of items – each item like a variable. Lists can be useful when many variables are needed or when the amount of memory that needs to be stored can not be determined by the programmer before the project is run. However, lists can only store 200,000 items and not more.[2]

Megosztott listák

Cloud lists do not exist in Scratch 3.0. It has been suggested many times and is rejected by the Scratch Team.[3] Cloud lists, if they existed, would be accessible by all Scratchers via the cloud server.

Some Scratch Modifications contain cloud lists. Some projects also contain cloud lists, although they are very hard to make and most of them usually break in new versions of Scratch. The only way to make one is to encode and decode lists into and from cloud variables, but this is very limited because variables are restricted to 256 digits.

Megjelenítés formái

Sablon:Main

The three different variable displays in Scratch 3.0.

If a variable stage monitor is right-clicked, a menu shows up with three options: normal readout, large readout, and slider. In Scratch 2.0 and before, there was also a show/hide option. In Scratch 1.4, the selected option had two asterisks (*) around it.

Példák

Variables are used in numerous projects to keep score, show health, connect with players, or list some friends. Here are some projects that use variables:

Those were only a few examples of variables used in programs; variables are used widely in different projects around Scratch, and most more advanced projects use them.

Lásd még

Külső hivatkozások

Megjegyzések


Hivatkozások

  1. projects:678806251
  2. https://github.com/LLK/scratch-vm/wiki/Compatibility
  3. Za Chary. (19/3/2019). "...the Scratch Team will not be adding an easy official way to make cloud lists." topic:343602


Forráshivatkozás-hiba: <ref> címkék léteznek a(z) „megj.” csoporthoz, de nincs hozzá <references group="megj."/>

Cookies help us deliver our services. By using our services, you agree to our use of cookies.