Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Some help with my project please?
- trolley_explodes
-
100+ posts
Some help with my project please?
Here's the code I have in it so far:
In the scanner sprite:
In the scanner sprite:
(INPUTTED CODE) // For all sprites.In the stage:
(code)
(color)
(frame idx)
(starting in)
(x)
(y)
(@list COLORS:: list) // For all sprites.
(@list Code:: list) // For all sprites.
when gf clicked
Prepare:: custom blocks
say [Click when you're ready to record. Click again to stop the recording. Also, press W to import a code.]
wait until <mouse down?>
repeat (3)
say (starting in)
wait (1) seconds
change [starting in v] by (-1)
end
say []
broadcast (Ok to stop v)
repeat until <mouse down?>
Record Frame:: custom blocks
wait (0) seconds
end
when I receive [Stop v]
stop [other scripts in sprite v]
turn video (off v)
add [Your code is:] to [Code v]
add (code) to [Code v]
add [Triple click to copy.] to [Code v]
define Prepare
delete all of [COLORS v]
delete all of [Code v]
hide list [Code v]
turn video (on v)
set video transparency to (100)
set [frame idx v] to (1)
set [code v] to ()
set [starting in v] to (3)
define Record Frame
set [x v] to (-240)
set [y v] to (180)
go to x: (x) y: (y)
repeat until <not <(y) = (y position)>>
repeat until <not <(x) = (x position)>>
change [x v] by (1)
change x by (1)
Scan Color:: custom blocks
end
set [x v] to (-240)
set x to (-240)
change [y v] by (-1)
change y by (-1)
end
define Scan Color
set [color v] to (0)
repeat (32)
repeat (32)
repeat (16)
if <touching color (color)?> then
add (color) to [COLORS v]
Add to code:: custom blocks
stop [this script v]
end
change [color v] by (16)
end
change [color v] by (1792)
end
change [color v] by (458752)
end
define Add to code
if <(frame idx) = (1)> then
set [code v] to (item (frame idx) of [COLORS v])
else
if <((frame idx) mod (172800)) = (0)> then
set [code v] to (join (code) (join (-) (item (frame idx) of [COLORS v]))
else
set [code v] to (join (code) (join (:) (item (frame idx) of [COLORS v]))
end
end
change [frame idx v] by (1)
when I receive [Ok to stop v]I can't figure out the code to break down the save code and I was hoping you guys could help with that.
wait until <mouse down?>
broadcast (Stop v)
Last edited by trolley_explodes (Yesterday 22:50:36)
- minniesworld
-
100+ posts
Some help with my project please?
To parse the text into a list:
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1137726268/
https://scratch-mit-edu.ezproxyberklee.flo.org/projects/1137726268/
- deck26
-
1000+ posts
Some help with my project please?
It's much easier for you and anyone helping if you share the project rather than duplicate scripts here with limited context and possible differences from your actual code.
Scanning the whole screen pixel by pixel for every colur is very inefficient and the custom block probably won't complete fast enough to allow it to run with the ‘no screen refresh’ option. A useful trick is to initially scan the whole screen using a full-screen size costume and build a list of the colours that are actually present. You can then scan pixel by pixel for that reduced list which is much faster.
Scanning the whole screen pixel by pixel for every colur is very inefficient and the custom block probably won't complete fast enough to allow it to run with the ‘no screen refresh’ option. A useful trick is to initially scan the whole screen using a full-screen size costume and build a list of the colours that are actually present. You can then scan pixel by pixel for that reduced list which is much faster.
- minniesworld
-
100+ posts
Some help with my project please?
Ooh, smart! I will probably use that myself! It's much easier for you and anyone helping if you share the project rather than duplicate scripts here with limited context and possible differences from your actual code.
Scanning the whole screen pixel by pixel for every colur is very inefficient and the custom block probably won't complete fast enough to allow it to run with the ‘no screen refresh’ option. A useful trick is to initially scan the whole screen using a full-screen size costume and build a list of the colours that are actually present. You can then scan pixel by pixel for that reduced list which is much faster.
Last edited by minniesworld (Today 18:25:29)
- Discussion Forums
- » Help with Scripts
-
» Some help with my project please?