What does the
warp{ }::grey
block do?
What does the
warp{ }::grey
block do?
The warp block runs faster than normal, as it doesn't take intermediate steps. This is useful for complex/slow projects. Just make sure to right-click on blocks and select help to see what they do.
when the warp block is being ran, it stops all running code until it's finished, so instead of
warp { forever { ... } :: control cap } :: grey
do
forever { warp { ... } :: grey } :: control cap
Expanding on what @ego-lay_atman-bay said:
warp { forever { ... :: grey } :: control } :: grey
warp
stops other scripts until its inside script is finished (and makes the stage update the graphics less often); because there is a forever
loop, it will never finish, so other scripts cannot run.
forever { warp { ... :: grey } :: grey } :: control
when the forever
loop gets to the warp
, the other scripts stop; when the warp
finishes, the other scripts can run for a little bit until the forever
goes back to the warp
.
It is a turbo mode simulator thing. If you put a script inside it, the script will run like it's turbo mode.
This is only partly true. Turbo mode gives scripts higher priority, relative to redisplay, but it still updates the display sometimes. WARP does even less display updating, and of course it absolutely freezes all scripts other than this one. So, for example, although people mainly use WARP for processing speed, it can also be used to make a critical section atomic, to avoid concurrency bugs.