Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Blocks
- jams41
- Scratcher
14 posts
Blocks
What is the purpose of making blocks? I don't see why I can just use what I would use to define the block in the script without making a block. (If that even made sense)
SIGNATURE NOT FOUND
- AonymousGuy
- Scratcher
1000+ posts
Blocks
2 reasons:
1) You don't want to have to keep re-scripting repetitive tasks, for example:
1) You don't want to have to keep re-scripting repetitive tasks, for example:
define parse (string) (find) (replace)You wouldn't want to re-script this function every time you needed it.
set [i v] to [1]
repeat until <(i) > (length of (string))>
if <(letter (i) of (string)) = (find)>
add (replace) to [chars v]
else
add (letter (i) of (string)) to [chars v]
end
change [i v] by (1)
end
set [return v] to (chars)
when gf clicked2) Checking “run without screen refresh” allows the script to run single-frame, which is basically “a lot faster”.
forever
ask [hello] and wait
parse (answer) [ ] [;] :: custom
parse (return) [,] [_] :: custom
parse (return) [:] [<] :: custom
end
Last edited by AonymousGuy (Dec. 31, 2014 22:35:49)
- jams41
- Scratcher
14 posts
Blocks
Oh. Well that that helped a lot because in my next platformer I thought i was just going to have to keep duplicating the script, because of the portal cut-scene-thingy i was going to make.
SIGNATURE NOT FOUND
- Discussion Forums
- » Questions about Scratch
- » Blocks