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

#7676 2013-04-04 12:14:39

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

Here's my (rough) plan for executable Snap! extension servers.

That's all fine, but the key point is that you have to be able to inject the corresponding .xml into Snap! itself.  And this has to work even if the user is running two or more extensions at once.  So, your program has to be a web server itself, like the extensions, and when you click its "Start Snap!" button, it has to send to the user's browser the URL

http://snap.berkeley.edu/snapsource/snap.html#open:http://localhost:3986?extendme

where 3986 is the assigned port for your program itself, and "extendme" is interpreted by your server to mean "concatenate the XML files for all the chosen extension modules" (probably not quite literally concatenate; you have to have just one XML wrapper for the whole thing).

It would be even better if this could be done from within Snap!, so that an extension module could be added easily to an already-running Snap! instance, but Jens questions whether we should have that degree of smooth connection because the user should know that s/he is doing something that breaks the Javascript sandbox.  He's probably right.  In fact your program's menu should say in red up at the top "External Snap! extensions do not have the same assurance of safety as Snap! itself.  Use extension modules only from sources you trust."


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7677 2013-04-04 12:17:00

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

By the way, are there any plans for cloud data in Snap!?

Sure, eventually.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7678 2013-04-04 12:24:27

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

So, for example, I can convert a Snap! variable to a Scratch list if you use list blocks on the variable. This won't work for all cases, but I think I can raise warnings for most of them.

You mean, "if you use only list blocks on" it.  But consider the situation in which a variable is assigned a value that's reported by a custom block, and that custom block reports a list.  And the variable itself is merely passed as input to other custom blocks, so it's never used with a list primitive.

PS I hate when I wake up in the morning and there are a zillion posts and when I answer the first one my answer starts a new page, and I have to keep switching back and forth!  (But I do like waking up to a zillion posts!)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7679 2013-04-04 12:26:19

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

consider the situation in which a variable is assigned a value that's reported by a custom block, and that custom block reports a list.  And the variable itself is merely passed as input to other custom blocks, so it's never used with a list primitive.

Scratch 2.0 doesn't have reporter blocks, so that's already a failure  tongue


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7680 2013-04-04 12:41:08

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Scratch 2.0 doesn't have reporter blocks, so that's already a failure  tongue

Oh yeah huh.  That's the other problem about finding a zillion posts when I wake up!  hmm

But you have to plan ahead for 2.1 or whatever they call the version that does.  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7681 2013-04-04 12:53:33

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

The project ID is the number at the end of the URL to the file.

For help, type "python snapin8r.py -help".

Remember to cd into the snapin8r directory!

I keep getting an invalid syntax error. I typed "python snapin8r.py number", "python snapin8r.py -number", and "python snapin8r.pynumber" and none of them work.

Offline

 

#7682 2013-04-04 13:40:24

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Zygorithm wrote:

I keep getting an invalid syntax error.

Did you install Python 2.7?


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7683 2013-04-04 14:11:46

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

concatenate the XML

Or, Snap! could get the ability to import multiple modules. (i.e. #open:this&that&other)

bharvey wrote:

smooth connection

I was wondering about that myself. It's probably better that users have to intentionally run extensions.

bharvey wrote:

your program should say in red

Of course.  smile

I've had to learn how to multi-quote just because of this thread.  tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#7684 2013-04-04 15:10:29

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

I've had to learn how to multi-quote just because of this thread.  tongue

You know that you can just say [quote] rather than [quote=foo] after the first time, right?

About open=this&that, we'll see what Jens thinks, but there's so much else going on in Snap! itself right now that if you can have an entirely self-sufficient program it'd be up for users much sooner.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7685 2013-04-04 15:53:19

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

Re: BYOB 3 - Discussion Thread

technoboy10 wrote:

bharvey wrote:

concatenate the XML

Or, Snap! could get the ability to import multiple modules. (i.e. #open:this&that&other)

Or a JSON format, e.g., #{language:'en-US',modules:[],project:''}


nXIII

Offline

 

#7686 2013-04-04 22:06:09

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Zygorithm wrote:

The project ID is the number at the end of the URL to the file.

For help, type "python snapin8r.py -help".

Remember to cd into the snapin8r directory!

I keep getting an invalid syntax error. I typed "python snapin8r.py number", "python snapin8r.py -number", and "python snapin8r.pynumber" and none of them work.

That's strange… can you paste the entire output?

EDIT: It shouldn't be just number, it should be:

Code:

python /path/to/snapin8r.py -p number -f /full/path/to/desired/output/file.xml -open

Use -f and -open are optional flags (-open automatically opens Snap! with the converted project). -p is required.

You should have gotten:

Code:

The -p flag is mandatory. Run './snapin8r.py -help' for help on flags.

if you didn't add the -p flag…  hmm

Last edited by Hardmath123 (2013-04-04 23:44:42)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#7687 2013-04-05 14:24:02

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

Code:

python /path/to/snapin8r.py -p number -f /full/path/to/desired....

I still get an invalid syntax error. Here's what I did.
https://dl.dropbox.com/u/45677595/SyntaxError.png

Offline

 

#7688 2013-04-05 14:27:26

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Zygorithm wrote:

Code:

python /path/to/snapin8r.py -p number -f /full/path/to/desired....

I still get an invalid syntax error. Here's what I did.
https://dl.dropbox.com/u/45677595/SyntaxError.png

It's because you're using Python version 3.3. You'll need to download Python 2.7 instead.  smile


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#7689 2013-04-05 14:34:23

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

Is my syntax otherwise correct?

Also: I notice Snap! doesn't have a permanent list block. How do I store my permanent databases such as stats, bag items, party list, save states, etc?

Offline

 

#7690 2013-04-05 15:24:18

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Zygorithm wrote:

I notice Snap! doesn't have a permanent list block. How do I store my permanent databases such as stats, bag items, party list, save states, etc?

Make a variable, assign it a list value.

The big idea:  Binding a name to a value is a single capability, regardless of the type of value.  A special make-a-list button is no more necessary than a make-an-integer button.

(Yes, I know, in principle this argument applies just as well to the make-a-block button.  But blocks have all these special properties -- shape, color, inputs, all that -- and have to appear in the palette.  I've always wanted the variable blocks to turn into command, reporter, or predicate shape when the variable is given a procedure as its value, but the trouble, as Jens keeps reminding me, is that the variable assignment doesn't happen until too late to put that block in a script.)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7691 2013-04-05 22:57:57

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Zygorithm wrote:

Code:

python /path/to/snapin8r.py -p number -f /full/path/to/desired....

I still get an invalid syntax error. Here's what I did.
https://dl.dropbox.com/u/45677595/SyntaxError.png

It's because you're using Python version 3.3. You'll need to download Python 2.7 instead.  smile

I can try to use 2to3…


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#7692 2013-04-05 23:42:34

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

Ok now I'm getting a new error during run time.
KeyError: u'startScene'
https://dl.dropbox.com/u/45677595/SyntaxError.png

Offline

 

#7693 2013-04-06 01:06:21

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Here's a converted version that should work on your computer: https://docs.google.com/file/d/0B1UC0dD … sp=sharing (2to3 converted).

As for the startScene error, Snap! doesn't support the Scene blocks so you can't convert projects that use those. Sorry.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#7694 2013-04-06 01:19:00

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

As for the startScene error, Snap! doesn't support the Scene blocks so you can't convert projects that use those. Sorry.

Sounds like your error messages need work!  smile


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7695 2013-04-06 20:29:41

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Announcing (finally!) the first prototype Snap Tutorial.  (The link is a .mov.zip file.)  The plan is to number the tutorials to match sections of the Reference Manual, and I started at building a block, so this is Tutorial IIIA1, the first tutorial on section III.A of the manual.  Comments welcome on format, fidelity, whatever.  It'd be better if I could figure out how to do anything in the new "improved" iMovie.  sad


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7696 2013-04-06 21:37:21

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Wow, nice video! I really think you did a nice job with it.  smile  I like that you included a few "try doing this yourself" moments and you explained everything at a good pace.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#7697 2013-04-07 00:23:21

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

40MB?! How long is it?  hmm


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#7698 2013-04-07 00:24:39

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Thanks.  The scary part is, at 10 min/video I'm going to have to do 20-30 more like it, to cover everything in the manual.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7699 2013-04-07 00:28:34

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

40MB?! How long is it?  hmm

10 minutes of 1080p.  (It has to be HD because, last I checked, YouTube compresses non-HD video with some algorithm that's fine for actual movies but really messes up sharp edges, whereas their HD looks okay.)

But if you know how I should have made it smaller, by all means teach me!

The screen capture was in Snapz Pro X using the Apple Animation codec, and then I did a small amount of editing in iMovie.  Before the iMovie step it was 217Mb.

PS  If you think downloading it is bad, imagine uploading it over asymmetrical DSL!

Last edited by bharvey (2013-04-07 00:31:11)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#7700 2013-04-07 01:37:12

Zygorithm
New Scratcher
Registered: 2012-08-17
Posts: 34

Re: BYOB 3 - Discussion Thread

As for the startScene error, Snap! doesn't support the Scene blocks so you can't convert projects that use those. Sorry.

My project does not use any Scene blocks. It was converted from Scratch 1.4 and I did not use any Scratch 2.0 features like Scene, clone, cloud variables, etc.

Offline

 

Board footer