Real Warp block with no screen refresh at all

i use the warp bloc and when the process is too long, the screen is refresh in the middle of my process... can i avoid that ?

I don't think so. The reason it does that is if the process runs indefinitely, you can still interact with the GUI.

I understand but it would be useful to be able to define our own maximum time frame. For example 5 seconds maximum ...

Then it would have to pause execution of the block every once in a while to check if 5 seconds have passed. Otherwise it wouldn't work, proven by the fact this code still runs indefinitely:

var loop = true;

setTimeout(() => {
   loop = false;
}, 3000);

var i = 0;
while (loop) {
  i++;
}

console.log("Done");

But I guess checking that would not require as much computations as redrawing the screen.

I think the warp block is meant to be completed in under the screen refresh time, and the forced screen refresh every half a second or so is a failsafe against, say, someone new to snap.

Does turbo mode not achieve what you are trying to do? :face_with_monocle: (sorry I just really wanted to use that emoji)

I made an example: it take 2 (or sometimes 3) cycle of refresh to draw, i would like to draw all borders before a refresh...

https://snap.berkeley.edu/snap/snap.html#present:Username=loucheman&ProjectName=forum%20help%20-%20warp&editMode&noRun

uh, there's (undefined) blocks in the project which throw an error, so it doesn't run the whole script. You should make sure to put in all the custom blocks it uses into the project.

Your procedure, in the DesignEngine sprite, took ~500ms.
So if your goal is not to write the slowest procedure, with this block ~30ms
forum help - warp script pic

Sorry for that: I forgot to delete the sprite in error after the importation... the correct sprite was the second one...

Thank's,

i correct the problem... I delete the first one...

wow, that's drastic !

I discovered the "All of" block in this project, I won't use it anymore ...

At first I thought it was a great discovery, but it is very slow !

Thank's

But a warp block shouldn't be a wrap block?

How much time i can spend in a wrap block without a screen refresh ?

Infinite loop: 5 seconds or 10 seconds is not an infinite freeze...

faster :slight_smile:

I like it ! i will test the speed tomorrow. Thank's

edit : i don't find this combine block (with the lightning bolt)
the block that I found:image

i try with this block but the function is not working...
this is my fonction
image
image

right click on the combine block and select "compile".

Parameters "preds" of the "all of" are defined as "Boolean (unevaluated)", so you really need...
forum help - warp script pic (3)
Or just change to plain "Boolean (T/F)".

Oh !!! When i compile the block the function work! (it is a bug? because if i uncompile the block, the function always return false if i had more than one parameters(bools))

with compile block
image
without compile block (decompile) :doesn't work
image

Is it normal ?

why does this work?


note: bools is unevaluated boolean.

if you're going to evaluate every input, just use t/f boolean

If you find a bool that evaluates to false, the result can't be true, so it should short-circuit to false. The 2-arg primitive and short-circuits.