This is a fairly common issue to run into for less experienced Scratchers – e.g. using 'broadcast and wait' inside a non-refresh script – and it's easy for even more experienced Scratchers to forget and fall into it. (As seen in https://github.com/LLK/scratch-flash/issues/1339.)
Of course, it's largely through misunderstanding exactly what 'non-refresh' means (i.e. that it's really 'atomic'), but that doesn't seem obvious from the term 'non-refresh'.
A list of blocks that could temporarily switch on yield within non-refresh:
• broadcast and wait
• switch backdrop and wait
• ask and wait
• wait until...
• wait N secs
• glide...
• play sound until done
• play note/drum for N beats
AFAICS, on encountering such a block, a non-refresh thread could simply nullify warpThread (i.e. just call clearWarpBlock?), and set a new Thread public var ("wasWarp"?) that tells the interpreter it needs switching back into 'warp speed' when the wait has ended (i.e. when the next block is not a wait block).
Is that all that's needed, or am I missing something?
This is a fairly common issue to run into for less experienced Scratchers – e.g. using 'broadcast and wait' inside a non-refresh script – and it's easy for even more experienced Scratchers to forget and fall into it. (As seen in https://github.com/LLK/scratch-flash/issues/1339.)
Of course, it's largely through misunderstanding exactly what 'non-refresh' means (i.e. that it's really 'atomic'), but that doesn't seem obvious from the term 'non-refresh'.
A list of blocks that could temporarily switch on yield within non-refresh: • broadcast and wait • switch backdrop and wait • ask and wait • wait until... • wait N secs • glide... • play sound until done • play note/drum for N beats
AFAICS, on encountering such a block, a non-refresh thread could simply nullify warpThread (i.e. just call clearWarpBlock?), and set a new Thread public var ("wasWarp"?) that tells the interpreter it needs switching back into 'warp speed' when the wait has ended (i.e. when the next block is not a wait block). Is that all that's needed, or am I missing something?