Discuss Scratch

herohamp
Scratcher
1000+ posts

Web Blox

I am working on recreating web blox in scratch 2 editor! https://scratch.mit.edu/projects/106921621/#editor
It is so slow to add in all the blocks so wait

THIS IS NOT A MOD!

Last edited by herohamp (April 25, 2016 22:11:39)

Jonathan50
Scratcher
1000+ posts

Web Blox

Interesting idea. Sort of like Snap!'s codification, but different.

Not yet a Knight of the Mu Calculus.
Jonathan50
Scratcher
1000+ posts

Web Blox

herohamp wrote:

It is so slow to add in all the blocks so wait
Maybe base all of the other blocks on CustomHTML so there is less boilerplate?
define CustomHTML (Code)
set [code v] to (join (code) (Code))

define title (title) /title
CustomHTML (join [<title>] (join (title) [</title>])

define body
CustomHTML [<body>]

define /body
CustomHTML [</body>]

...

Last edited by Jonathan50 (April 25, 2016 22:29:59)


Not yet a Knight of the Mu Calculus.
herohamp
Scratcher
1000+ posts

Web Blox

Hmm nice idea. I will do.

Updated to that!

Last edited by herohamp (April 25, 2016 22:35:32)

jokebookservice1
Scratcher
1000+ posts

Web Blox

Sort of a necropost (by a month), but it I am improving it, so I'd say that it is an OK bump.

You can escape things like html tags inside of <P> tags by replacing
< with &lt;
> with &gt;
& with &amp;

This could be done like so:
define outputVar = escape string (str)
set [i v] to [1 ]
set [outputVar v] to []
repeat (length of (str))
if <(letter (i) of (str)) = [&]> then

set [outputVar v] to (join (outputVar) [&amp;])
else
if <(letter (i) of (str)) = [<]> then
set [outputVar v] to (join (outputVar) [&lt;])
else
if <(letter (i) of (str)) = [>]> then
set [outputVar v] to (join (outputVar) [&gt;])
else
set [outputVar v] to (join (outputVar) (letter (i) of (str)))
end
end
end

end

Last edited by jokebookservice1 (May 21, 2016 13:17:15)

Powered by DjangoBB