Discuss Scratch

DadOfMrLog
Scratcher
1000+ posts

Wait inside atomic (non-refresh) block

Thought I'd flag up an issue that I predict will cause numerous scratchers several headaches in the coming months…

A block with screen-refresh switched off stops everything else from running while it does. This means putting any kind of wait for something else to happen inside it will obviously bring things to a crashing halt. For example, “broadcast and wait”, “wait until”.

I've seen this happen to several scratchers (including myself and MrLog), and it's pretty obvious once you understand, but I can imagine it's going to pop up again and again from numerous scratchers (just replied to exactly that problem from someone else in the glitches forum).

Not sure the best solution, but one possibility that comes to mind is that such statements should be clear-cut for the interpreter (you know when you get to a wait-until or broadcast-and-wait), and the refresh status of the block is clear-cut. Would it be possible, then, to switch off the ‘non-refresh’ status on encountering such statements? (And set back on again once that statement completes?)

I think this would give the behaviour that scratchers would ‘expect’ (which is an important consideration in such decisions). I can see a potential problem with having a block that allows refresh run from within a non-refresh block (in which case it runs the refresh-allow block without refresh), but I'm assuming there's some kind of status flag so the interpreter knows it's currently in non-refresh mode? So that'd still be easy to sort out, right?

The only other way I can think of is not allowing such statements in non-refresh blocks (but not sure how you could really do that, since it's easy to switch on non-refresh once such a ‘bad’ block is already in place, and it's not gonna be able to deal with the above problem of running a refresh-allowed block from within a non-refresh block).

Not sure how else to deal with it, but I think it'd be a good idea to try before lots of scratchers get caught by it…


Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

Rub0Gameton
Scratcher
100+ posts

Wait inside atomic (non-refresh) block

Many Scratchers, including me, wanted “start” and “stop screen refresh” blocks, bur I believe the ST made it the way it is now for ease of use to the new Scratchers. My guess is that such blocks would be really helpful in a situation like this, and they aren't that hard to use once you know what they do. What do you think?

Powered by DjangoBB