I've made a spring simulator and GoL simulator. Yay, right? Works awesomely in the old flash player - But only the old. In the new flash player/2.0 player, the parts of the spring and the cells always flash as they're repeatedly cleared and redrawn. Any ideas on how to stop then from flashing?
(Can't unroll the script)
Offline
Bump. (EDIT: 5 times, inc this one)
Last edited by Hyperbola (2013-04-15 17:53:27)
Offline
I can't exactly delete the bumps...
I'm not one to share my in progress projects, so try this script instead:
when gf clicked delete (all v) of [X v]
when key [space v] pressed add (pick random (-240) to (240)) to [X v] set [# v] to [1] clear repeat (length of [X v]) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) endIn the old flash player, it can get up to 400 before flashing. But in the new player, it only gets to 100. In the offline version, it goes to at least 200, but I can't test any further.
Offline
Bump.
Offline
Bump.
Offline
Bump.
Offline
You could try repeating the script in the repeat length of x section so that in each section of the repeat it does it multiple times. You'd need to do edit the repeat code a bit and do a repeat mod of length of x / # afterwards but it might help.
Example:
when gf clicked delete (all v) of [X v] set [Multiples v] to [3]
when key [space v] pressed add (pick random (-240) to (240)) to [X v] set [# v] to [1] clear if <(length of [X v]) < (Multiples)> repeat (length of [X v]) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end else repeat <<(length of [X v]) / (Multiples)> - <<(length of [X v]) / (Multiples)> mod (Multiples)>> replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end repeat <<(length of [X v]) / (Multiples)> mod (Multiples)> replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end endSadly although this can speed it up I suspect there would still be a lot of flashing. The higher the Multiples variable is set the better the result though.
Last edited by Smozzick (2013-04-18 12:34:38)
Offline
Smozzick wrote:
You could try repeating the script in the repeat length of x section so that in each section of the repeat it does it multiple times. You'd need to do edit the repeat code a bit and do a repeat mod of length of x / # afterwards but it might help.
Example:when gf clicked delete (all v) of [X v] set [Multiples v] to [3]when key [space v] pressed add (pick random (-240) to (240)) to [X v] set [# v] to [1] clear if <(length of [X v]) < (Multiples)> repeat (length of [X v]) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end else repeat <<(length of [X v]) / (Multiples)> - <<(length of [X v]) / (Multiples)> mod (Multiples)>> replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end repeat <<(length of [X v]) / (Multiples)> mod (Multiples)> replace item (#) of [X v] with ((item (#) of [X v]) + (1)) set x to (item (#) of [X v]) stamp change [# v] by (1) end endSadly although this can speed it up I suspect there would still be a lot of flashing. The higher the Multiples variable is set the better the result though.
Hyperbola wrote:
(Can't unroll the script)
Offline
Bump.
Offline
Liamadams wrote:
7734f wrote:
Liamadams wrote:
how to do the length of?
(length of [ ])It's a list block
(length of [list v])its a list block and an operators block. how foolish you are!
Try using scratchblocks to show length of [my name is v], as in my name is the letter v, in a string.
Offline
Bump.
Offline
Smozzick wrote:
Read the can't unroll the script bit already, just thought you couldn't do it because of variable length.
Why? Too long and freezes or?
Well, for one it's not really elegant, and also, it will make attempts to edit it difficult, laggy, and/or tedious.
Offline
Hyperbola wrote:
Smozzick wrote:
Read the can't unroll the script bit already, just thought you couldn't do it because of variable length.
Why? Too long and freezes or?Well, for one it's not really elegant, and also, it will make attempts to edit it difficult, laggy, and/or tedious.
True; but you won't find many elegant methods to speed up execution of a script like this in scratch - that's why the unrolling method exists.
As for editing...fair enough. Keep looking for other solutions in the meantime but if unrolling it in that way does speed it up then you might want to use it once you've finished making the rest of the program.
---
I was going to suggest trying to put the item # of X in a variable to reduce processing when its retrieving the number from the list but from a quick test it doesn't seem to help. Maybe worth a try anyway?
---
Other than that I'll keep thinking but nothing really strikes me. Good luck with it though.
Offline
Smozzick wrote:
Hyperbola wrote:
Smozzick wrote:
Read the can't unroll the script bit already, just thought you couldn't do it because of variable length.
Why? Too long and freezes or?Well, for one it's not really elegant, and also, it will make attempts to edit it difficult, laggy, and/or tedious.
True; but you won't find many elegant methods to speed up execution of a script like this in scratch - that's why the unrolling method exists.
As for editing...fair enough. Keep looking for other solutions in the meantime but if unrolling it in that way does speed it up then you might want to use it once you've finished making the rest of the program.
---
I was going to suggest trying to put the item # of X in a variable to reduce processing when its retrieving the number from the list but from a quick test it doesn't seem to help. Maybe worth a try anyway?
---
Other than that I'll keep thinking but nothing really strikes me. Good luck with it though.
Thanks I'm working on a new project right now though that doesn't have this problem.
Offline