This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#176 2010-09-28 22:06:04

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Lets make a new Scratch viewer!

Okay! I'll sign up.


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#177 2010-09-29 03:19:03

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

I will leave the forum thing ATM as I only use this one!
And yes midnightleopard you can join if you commit to what you say.


You can now reach me on Twitter @johnnydean1_

Offline

 

#178 2010-09-29 06:49:53

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

Okay! jonneydean1, Daffy22 and MidnightLeopard are now moderators! (let me know if I forgot to add permissions to the moderator group)


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#179 2010-09-29 15:40:24

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Ok lets get started on the .sb decoding. Lets do this in any language to start off with, then convert it to JScript HTML and PHP


You can now reach me on Twitter @johnnydean1_

Offline

 

#180 2010-09-29 16:50:20

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

Ok lets get started on the .sb decoding. Lets do this in any language to start off with, then convert it to JScript HTML and PHP

Well, It's done in one language already...


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#181 2010-09-29 16:54:27

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Lets make a new Scratch viewer!

Alright! So, how are we going to approach this? we should start one step at a time. Let's start with decoding a sprite. I am not sure what you mean. So open a .sb file in notepad? is that what we're decoding?
if so, we should start by making a project with absolutely nothing in it. No sprites, costumes, blocks, sounds, or notes. Then we should add a single pixel dot sprite and see the difference in the code. Then we should keep doing that until we can decode how sprites are coded in the file. We could then do the same thing but with a sound, then a block, then a script.
Better ideas anyone?


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#182 2010-09-29 16:58:06

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

midnightleopard wrote:

Alright! So, how are we going to approach this? we should start one step at a time. Let's start with decoding a sprite. I am not sure what you mean. So open a .sb file in notepad? is that what we're decoding?
if so, we should start by making a project with absolutely nothing in it. No sprites, costumes, blocks, sounds, or notes. Then we should add a single pixel dot sprite and see the difference in the code. Then we should keep doing that until we can decode how sprites are coded in the file. We could then do the same thing but with a sound, then a block, then a script.
Better ideas anyone?

The problem is, .sb files are binary, so they're not readable in notepad.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#183 2010-09-29 17:25:24

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

ScratchReallyROCKS wrote:

midnightleopard wrote:

Alright! So, how are we going to approach this? we should start one step at a time. Let's start with decoding a sprite. I am not sure what you mean. So open a .sb file in notepad? is that what we're decoding?
if so, we should start by making a project with absolutely nothing in it. No sprites, costumes, blocks, sounds, or notes. Then we should add a single pixel dot sprite and see the difference in the code. Then we should keep doing that until we can decode how sprites are coded in the file. We could then do the same thing but with a sound, then a block, then a script.
Better ideas anyone?

The problem is, .sb files are binary, so they're not readable in notepad.

I'd recommend notepad++, a free, open-source text editor with syntax highlighting and lots of other amazing stuff!  big_smile


nXIII

Offline

 

#184 2010-09-29 17:48:58

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

nXIII wrote:

ScratchReallyROCKS wrote:

midnightleopard wrote:

Alright! So, how are we going to approach this? we should start one step at a time. Let's start with decoding a sprite. I am not sure what you mean. So open a .sb file in notepad? is that what we're decoding?
if so, we should start by making a project with absolutely nothing in it. No sprites, costumes, blocks, sounds, or notes. Then we should add a single pixel dot sprite and see the difference in the code. Then we should keep doing that until we can decode how sprites are coded in the file. We could then do the same thing but with a sound, then a block, then a script.
Better ideas anyone?

The problem is, .sb files are binary, so they're not readable in notepad.

I'd recommend notepad++, a free, open-source text editor with syntax highlighting and lots of other amazing stuff!  big_smile

Actually, you see the scripts when you scroll down to the bottom of a scratch project in notepad!


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#185 2010-09-29 19:22:48

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

ScratchReallyROCKS wrote:

nXIII wrote:

ScratchReallyROCKS wrote:

The problem is, .sb files are binary, so they're not readable in notepad.

I'd recommend notepad++, a free, open-source text editor with syntax highlighting and lots of other amazing stuff!  big_smile

Actually, you see the scripts when you scroll down to the bottom of a scratch project in notepad!

I still recommend it!  tongue
I'm now converting a 500-line Java file to JavaScript. Not as easy as it might sound.

EDIT: I was doing that, now I'm going back to converting it to PHP.

Last edited by nXIII (2010-09-29 19:23:17)


nXIII

Offline

 

#186 2010-09-29 19:27:50

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

nXIII wrote:

ScratchReallyROCKS wrote:

nXIII wrote:


I'd recommend notepad++, a free, open-source text editor with syntax highlighting and lots of other amazing stuff!  big_smile

Actually, you see the scripts when you scroll down to the bottom of a scratch project in notepad!

I still recommend it!  tongue

I know. I got the Mac version.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#187 2010-09-29 21:26:09

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Lets make a new Scratch viewer!

cool, but my notepad opens .sb files. It's all crazy wierd unicode characters. nXIII, are you on the team?


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#188 2010-09-29 21:27:40

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Lets make a new Scratch viewer!

So scripts are at the bottom? Lemme ask some questions. What are we doing? what .sb file are we decoding? I've been opening it with notepad. Should I be doing something else?


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#189 2010-09-29 21:38:03

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Lets make a new Scratch viewer!

midnightleopard wrote:

So scripts are at the bottom? Lemme ask some questions. What are we doing? what .sb file are we decoding? I've been opening it with notepad. Should I be doing something else?

Notepad won't work. Try nXIII's suggestion.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#190 2010-09-30 02:22:59

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

true, notepad++ will decode it so we can understand it however HTML or JS or PHP can't do what notepad++ does. I'll do some research.  wink


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#191 2010-09-30 14:32:11

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Ill have a look at whats saved.


You can now reach me on Twitter @johnnydean1_

Offline

 

#192 2010-09-30 14:37:15

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

true, notepad++ will decode it so we can understand it however HTML or JS or PHP can't do what notepad++ does. I'll do some research.  wink

Actually, I had a lot of success with a PHP file_get_contents() call.


nXIII

Offline

 

#193 2010-09-30 14:37:58

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Lets make a new Scratch viewer!

If notepad++ is open source, look at its source code and find out what it does.


/* No comment */

Offline

 

#194 2010-09-30 15:43:48

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

TheSuccessor wrote:

If notepad++ is open source, look at its source code and find out what it does.

mmm it's written in C++ or VBS or something else not HTML or PHP  sad


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#195 2010-09-30 15:44:34

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Here:

Bottom of Scratch File wrote:

Hat Block
¯¯¯¯¯¯¯¯¯
EventHatMorph        Scratch-StartClicked    = Flag
KeyEventHatMorph    space            = Key 'space' Hat
MouseClickEventHatMorph    Scratch-MouseClickEvent    = When ### clicked
EventHatMorph        {input}            = When {input} recieved

C Blocks
¯¯¯¯¯¯¯¯
doForever                    = forever
doRepeat                    = repeat
doForeverIf                    = forever if
doIf                        = if
doUntil                        = repeat until

Branch Blocks
¯¯¯¯¯¯¯¯¯¯¯¯¯
doIfElse                    = if else


< blocks >
¯¯¯¯¯¯¯¯¯
=    {input1}    {input2}        = <{input1}={input2}>
<    {input1}    {input2}        = <{input1}<{input2}>
>    {input1}    {input2}        = <{input1}>{input2}>

list:contains:    {input2}            = <list ## contains {input2}>
mousePressed                    = <mouse pressed>
keyPressed:        {input1}        = <key {input1} pressed>
isLoud                        = < loud? >
sensorPressed:        {input1}        = <sensor {input1}?>

< < > blocks < > >
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
&    blocktype1 {input1}{input2} (if not blocktype2 = blocktype1 then blocktype2) {input3}{input4} = < < > and < > >
|    blocktype1 {input1}{input2} (if not blocktype2 = blocktype1 then blocktype2) {input3}{input4} = < < > or < > >
not    blocktype1 {input1}{input2}                                      = < not <> >

( blocks )
¯¯¯¯¯¯¯¯¯
+                        = ( + )
-                        = ( - )
*                        = ( * )
/                        = ( / )
\\                        = ( mod )

randomFrom:to:                    = (pick random ## to ##)
concatenate:with:    {input1} {input2}    = (join {input1} with {input2})
letter:of:        {input2}        = (letter ## of {input2})
stringLength:        {input1}        = (length of {input1})
volume                        = (volume)
tempo                        = (tempo)

timer                        = (timer)
soundLevel                    = (loudness)
sensor:            {input1}        = ( {input1} sensor value)
answer                        = (answer)

mouseX                        = (mouse X)
mouseY                        = (mouse Y)

backgroundIndex                    = (background no.)

readVariable                    = (read var ##)
contentsOfList:                    = (read list ##)
getLine:ofList:                    = (read line ## of list ##)
lineCountOfList:                = (no. lines of list ##)

[ blocks ]
¯¯¯¯¯¯¯¯¯
wait:elapsed:from:                = wait block
broadcast:    {input1}            = broadcast {input1}
doBroadcastAndWait    {input1}        = broadcast and wait {input1}
doWaitUntil    (and same rule as & block)    = wait until
doReturn                    = stop script
stopAll                        = stop all

doAsk    {input1}                = ask {input1} and wait
timerReset                    = reset timer
showBackground:                    = change background to
nextBackground                    = next background
changeGraphicEffect:by:    {name to change}    = change effect {name to change} by ##
setGraphicEffect:to: {name to change}        = set effect {name to change} to ##
filterReset                    = clear effects

playSound:                    = play sound ##
doPlaySoundAndWait                = play sound ## and wait
stopAllSounds                    = stop all sounds
drum:duration:elapsed:from:            = play drum ## for ##
rest:elapsed:from:                = rest ## beats
noteOn:duration:elapsed:from:            = play note ## for ##
midiInstrument:                    = set instrument to ##
changeVolumeBy:                    = change volume by ##
setVolumeTo:                    = set volume to ##
changeTempoBy:                    = change tempo by ##
setTempoTo:                    = set tempo to ##

clearPenTrails                    = clear

setVar:to: {input2}                = set var ## to {input2}
changeVar:by:                    = change var ## by ##
showVariable:                    = show var ##
hideVariable:                    = hide var ##

append:toList: {input1}                = add {input1} to list ##
deleteLine:ofList:                = delete line ## of list ##
insert:at:ofList:    {input1}        = insert {input1} at ## of list ##
setLine:ofList:to:    {input3}        = replace line ## of list ## with {input3}

Last edited by johnnydean1 (2010-09-30 17:05:19)


You can now reach me on Twitter @johnnydean1_

Offline

 

#196 2010-09-30 16:11:28

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

nXIII wrote:

ScratchReallyROCKS wrote:

nXIII wrote:

I'd recommend notepad++, a free, open-source text editor with syntax highlighting and lots of other amazing stuff!  big_smile

Actually, you see the scripts when you scroll down to the bottom of a scratch project in notepad!

I still recommend it!  tongue
I'm now converting a 500-line Java file to JavaScript. Not as easy as it might sound.

EDIT: I was doing that, now I'm going back to converting it to PHP.

So what stage are you at?


You can now reach me on Twitter @johnnydean1_

Offline

 

#197 2010-09-30 16:39:02

Daffy22
Scratcher
Registered: 2008-12-15
Posts: 500+

Re: Lets make a new Scratch viewer!

johnnydean1 wrote:

Here:

Bottom of Scratch File wrote:

Hat Block
¯¯¯¯¯¯¯¯¯
EventHatMorph        Scratch-StartClicked    = Flag
KeyEventHatMorph    space            = Key 'space' Hat
MouseClickEventHatMorph    Scratch-MouseClickEvent    = When ### clicked
EventHatMorph        {input}            = When {input} recieved

C Blocks
¯¯¯¯¯¯¯¯
doForever                    = forever
doRepeat                    = repeat
doForeverIf                    = forever if
doIf                        = if
doUntil                        = repeat until

Branch Blocks
¯¯¯¯¯¯¯¯¯¯¯¯¯
doIfElse                    = if else


< blocks >
¯¯¯¯¯¯¯¯¯
=    {input1}    {input2}        = <{input1}={input2}>
<    {input1}    {input2}        = <{input1}<{input2}>
>    {input1}    {input2}        = <{input1}>{input2}>

list:contains:    {input2}            = <list ## contains {input2}>
mousePressed                    = <mouse pressed>
keyPressed:        {input1}        = <key {input1} pressed>
isLoud                        = <loud?>
sensorPressed:        {input1}        = <sensor {input1}?>

< < > blocks < > >
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
&    blocktype1 {input1}{input2} (if not blocktype2 = blocktype1 then blocktype2) {input3}{input4} = < < > and < > >
|    blocktype1 {input1}{input2} (if not blocktype2 = blocktype1 then blocktype2) {input3}{input4} = < < > or < > >
not    blocktype1 {input1}{input2}                                      = < not <> >

( blocks )
¯¯¯¯¯¯¯¯¯
+                        = ( + )
-                        = ( - )
*                        = ( * )
/                        = ( / )
\\                        = ( mod )

randomFrom:to:                    = (pick random ## to ##)
concatenate:with:    {input1} {input2}    = (join {input1} with {input2})
letter:of:        {input2}        = (letter ## of {input2})
stringLength:        {input1}        = (length of {input1})
volume                        = (volume)
tempo                        = (tempo)

timer                        = (timer)
soundLevel                    = (loudness)
sensor:            {input1}        = ( {input1} sensor value)
answer                        = (answer)

mouseX                        = (mouse X)
mouseY                        = (mouse Y)

backgroundIndex                    = (background no.)

readVariable                    = (read var ##)
contentsOfList:                    = (read list ##)
getLine:ofList:                    = (read line ## of list ##)
lineCountOfList:                = (no. lines of list ##)

[ blocks ]
¯¯¯¯¯¯¯¯¯
wait:elapsed:from:                = wait block
broadcast:    {input1}            = broadcast {input1}
doBroadcastAndWait    {input1}        = broadcast and wait {input1}
doWaitUntil    (and same rule as & block)    = wait until
doReturn                    = stop script
stopAll                        = stop all

doAsk    {input1}                = ask {input1} and wait
timerReset                    = reset timer
showBackground:                    = change background to
nextBackground                    = next background
changeGraphicEffect:by:    {name to change}    = change effect {name to change} by ##
setGraphicEffect:to: {name to change}        = set effect {name to change} to ##
filterReset                    = clear effects

playSound:                    = play sound ##
doPlaySoundAndWait                = play sound ## and wait
stopAllSounds                    = stop all sounds
drum:duration:elapsed:from:            = play drum ## for ##
rest:elapsed:from:                = rest ## beats
noteOn:duration:elapsed:from:            = play note ## for ##
midiInstrument:                    = set instrument to ##
changeVolumeBy:                    = change volume by ##
setVolumeTo:                    = set volume to ##
changeTempoBy:                    = change tempo by ##
setTempoTo:                    = set tempo to ##

clearPenTrails                    = clear

setVar:to: {input2}                = set var ## to {input2}
changeVar:by:                    = change var ## by ##
showVariable:                    = show var ##
hideVariable:                    = hide var ##

append:toList: {input1}                = add {input1} to list ##
deleteLine:ofList:                = delete line ## of list ##
insert:at:ofList:    {input1}        = insert {input1} at ## of list ##
setLine:ofList:to:    {input3}        = replace line ## of list ## with {input3}

whats this then?  smile


http://img201.imageshack.us/img201/1784/logosmalle.png
"Spectacular - 5 Star" -  CNET.com Editor.

Offline

 

#198 2010-09-30 16:51:11

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Lets make a new Scratch viewer!

Daffy22 wrote:

whats this then?  smile

Yeah what is that code? it's all the blocks in scratch not just scripts.


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#199 2010-09-30 17:01:11

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

midnightleopard wrote:

Daffy22 wrote:

whats this then?  smile

Yeah what is that code? it's all the blocks in scratch not just scripts.

Well if you open a scratch project in Notepad and scroll down to the bottom you see all your blocks. This is a conversion chart that I made that can turn that into normal blocks.

Last edited by johnnydean1 (2010-09-30 17:02:26)


You can now reach me on Twitter @johnnydean1_

Offline

 

#200 2010-09-30 17:03:56

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Lets make a new Scratch viewer!

Ok using my file can someone make a HTML/PHP/JScript (Manily JScript/HTML) version of this. So it can get that info, then store it in 2 arrays. The first being the stuff before the '=' and the second being the stuff after the '=' in each line.


You can now reach me on Twitter @johnnydean1_

Offline

 

Board footer