Clock: Difference between revisions
No edit summary |
(duplicate file already uploaded) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
<translate> | |||
<!--T:1--> | |||
<section begin=image/> | <section begin=image/> | ||
[[File:Clock.png|alt=Clock|thumb]] | [[File:Clock.png|alt=Clock|thumb]] | ||
<section end=image/> | <section end=image/><p id="tooltip">Returns the value of the clock, measured in “ticks”. This value increments by 1 during each iteration of the code, which is 5x per second at normal speed.</p> | ||
<!--T:9--> | |||
The speed that the clock increments is determined by the value of the engine speed slider. A slider value of n makes the clock tick n times per second. The clock starts at zero when the program is initiated. | |||
<!--T:8--> | |||
<section begin="name" />'''<code>clock</code>'''<section end="name" /> is a [[code block]] part of the [[Environment]] drawer. | <section begin="name" />'''<code>clock</code>'''<section end="name" /> is a [[code block]] part of the [[Environment]] drawer. | ||
== Usage== | <!--T:2--> | ||
==Usage== | |||
<code>clock</code> refers to the value of the clock, measured in “ticks”. This value increments by 1 after each iteration of the code. The speed that the clock increments is determined by the value of the engine speed slider. A slider value of n makes the clock tick n times per second. The clock starts at zero when the program is initiated. | |||
==Syntax== <!--T:3--> | |||
<!--T:4--> | |||
<code>[Textbox Insert] clock</code> | <code>[Textbox Insert] clock</code> | ||
<!--T:5--> | |||
==Common Uses== | ==Common Uses== | ||
Mainly used to simulate the passing of time in simulations, and to prompt certain actions to take place during certain points in time. | Mainly used to simulate the passing of time in simulations, and to prompt certain actions to take place during certain points in time. | ||
==Nuances== | ==Example== <!--T:10--> | ||
<!--T:11--> | |||
[[File:set_clock_to_example.gif|alt=Clock example gif|thumb]] | |||
[[File:clock_example.png|alt=Clock example code|thumb]] | |||
<!--T:12--> | |||
The model above depicts flowers growing with the rainfall over time. The clock is used to determine when thunderstorms start and stop: it will rain between 50 and 100, after which the clock will be reset to 0. In all, there are 50 ticks of rain followed by 50 ticks of no rain. | |||
==Nuances== <!--T:6--> | |||
<!--T:7--> | |||
==Related Blocks== | ==Related Blocks== | ||
*<code>[[Set Clock To|set clock to [_]]]</code> | *<code>[[Set Clock To|set clock to [_]]]</code> | ||
[[Category:Environment]] | [[Category:Environment]] | ||
[[Category:Code Block]] | [[Category:Code Block]] | ||
</translate> |
Latest revision as of 15:41, 16 August 2023
Returns the value of the clock, measured in “ticks”. This value increments by 1 during each iteration of the code, which is 5x per second at normal speed.
The speed that the clock increments is determined by the value of the engine speed slider. A slider value of n makes the clock tick n times per second. The clock starts at zero when the program is initiated.
clock
is a code block part of the Environment drawer.
Usage
clock
refers to the value of the clock, measured in “ticks”. This value increments by 1 after each iteration of the code. The speed that the clock increments is determined by the value of the engine speed slider. A slider value of n makes the clock tick n times per second. The clock starts at zero when the program is initiated.
Syntax
[Textbox Insert] clock
Common Uses
Mainly used to simulate the passing of time in simulations, and to prompt certain actions to take place during certain points in time.
Example
The model above depicts flowers growing with the rainfall over time. The clock is used to determine when thunderstorms start and stop: it will rain between 50 and 100, after which the clock will be reset to 0. In all, there are 50 ticks of rain followed by 50 ticks of no rain.