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

#7051 2013-02-22 10:10:51

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Great! Congratulations, Hardmath123.


Jens Mönig

Offline

 

#7052 2013-02-22 10:34:51

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@Hardmath123
" If you have Windows, you will need to run it from the command line like this:
Code:
python /path/to/snapin8r/folder/snpain8r.pyc <args>"
I presume that you need first to install Python ? How ?

Offline

 

#7053 2013-02-22 10:50:24

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@Jens & bharvey
While playing wit Clones, I have found out that you can store any initial value or "property" (xposition, costume ", clone item counter etc) inside a Script Variables. This value is attached to each individual clone, and can be retrieved later on by any mean.
Of course you can as well store a "method" (an executable script) inside a Script variable, and run it when an adequate event is triggered in relation with this specific clone. I've made an Invader demo project...but it can't be loaded on Scratch 2.0 forum as  Scratch do not have the Snap! Script Variable feature !
It rises again the ceiling !

Offline

 

#7054 2013-02-22 11:05:55

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

Re: BYOB 3 - Discussion Thread

xly wrote:

@Hardmath123
" If you have Windows, you will need to run it from the command line like this:
Code:
python /path/to/snapin8r/folder/snpain8r.pyc <args>"
I presume that you need first to install Python ? How ?

Visit this site and download the 2.7.3 installer (my tool won't work with Python 3).


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

Offline

 

#7055 2013-02-22 11:07:09

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

Great! Congratulations, Hardmath123.

Thanks! How's it going? Any issues so far?  big_smile


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

Offline

 

#7056 2013-02-22 12:41:29

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

technoboy10 wrote:

This thread is the most fun to read.  tongue

Okay, so, the evil king hates computer science, and he rounds up the 100 greatest computer scientists in the kingdom to put them to death.  But, strangely, but as is customary in this sort of problem, he gives them a sporting chance to save their lives.  He tells them that he will line them up along the side of a mountain, facing downslope, so that each of them can see the heads of the people below them, but not those above them, nor, of course, their own head.  He will then place either a white hat or a black hat on each computer scientist's head, choosing by coin toss (i.e., randomly).  Starting at the top of the mountain, each computer scientist has to guess his/her own hat color.  Those who guess correctly will be spared.  Having explained all this, he leaves them to plan their strategy.  What should they do to guarantee the most lives spared, and how many can they save?

EDIT:  A lower bound to inspire you:  The odd-numbered people say the color of the hat just below them, and then the even-numbered people say the same color and are saved.

http://brainden.com/forum/index.php/top … #entry8938

Substitute RED for WHITE in that solution.
Saves all but one, no matter how many there are. The first has a 50/50 chance.


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#7057 2013-02-22 13:00:55

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

Re: BYOB 3 - Discussion Thread

Some errors for you to play with:  big_smile

Code:

shiny:snapin8r tim$ ./snapin8r -p 10039516 -f blocklist.xml
Downloading project data...
Converting...
Traceback (most recent call last):
  File "snapin8r.py", line 362, in <module>
  File "snapin8r.py", line 116, in convert
  File "snapin8r.py", line 314, in XMLWithScratchObject
  File "snapin8r.py", line 259, in XMLWithScratchObject
  File "snapin8r.py", line 129, in XMLWithScript
  File "snapin8r.py", line 158, in XMLWithBlock
KeyError: u'setRotationStyle'
shiny:snapin8r tim$ ./snapin8r -p 2041731 -f roads_v4.xml
Downloading project data...
Converting...
Traceback (most recent call last):
  File "snapin8r.py", line 362, in <module>
  File "snapin8r.py", line 116, in convert
  File "snapin8r.py", line 314, in XMLWithScratchObject
  File "snapin8r.py", line 259, in XMLWithScratchObject
  File "snapin8r.py", line 129, in XMLWithScript
  File "snapin8r.py", line 203, in XMLWithBlock
  File "snapin8r.py", line 203, in XMLWithBlock
  File "snapin8r.py", line 198, in XMLWithBlock
  File "snapin8r.py", line 158, in XMLWithBlock
KeyError: u'undefined'

Edit: whoops, sorry, you said raster images aren't supported yet. Ignore me...

Last edited by blob8108 (2013-02-22 16:19:40)


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

Offline

 

#7058 2013-02-22 15:42:04

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

How's it going? Any issues so far?  big_smile

Yeah, could you rewrite it in Javascript?  Then we could just add it to
Snap! itself instead of needing a separate process.

The second time's always easier...  smile


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

Offline

 

#7059 2013-02-22 15:43:18

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

Re: BYOB 3 - Discussion Thread

Aw, no fair googling it!


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

Offline

 

#7060 2013-02-22 16:01:47

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

How's it going? Any issues so far?  big_smile

Yeah, could you rewrite it in Javascript?

That's meaaan...  tongue

Anyway, wouldn't you get all those CORS problems?


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

Offline

 

#7061 2013-02-22 16:41:57

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Anyway, wouldn't you get all those CORS problems?

Oh, I hadn't thought about where the project comes from.  Can't you download it from the 2.0 site and then import it from your desktop?

PS I didn't mean to be mean; it's just that I asked Jens if we're putting it in Snap! and he said it.d be easier to integrate that way.

Last edited by bharvey (2013-02-22 16:44:24)


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

Offline

 

#7062 2013-02-22 17:20:34

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

blob8108 wrote:

Anyway, wouldn't you get all those CORS problems?

Oh, I hadn't thought about where the project comes from.  Can't you download it from the 2.0 site and then import it from your desktop?

Hardmath was thinking of running the script on a web server through a web.py/bottle/etc frontend, right? From the point of view of a user (*cough* like n), it's much easier to just go to the snapin8r page, point it at your project, and have it download the project to the server and convert it for you. We should have a snapin8! bookmarklet that extracts the project id from the current URL, and posts it straight to the snapin8r page!  smile

Then again, having it as part of Snap! does make sense, I guess — and then can't you just get the ST to add one of those Allow-Origin headers for you?

I didn't mean to be mean

It just sounded funny, that's all  tongue


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

Offline

 

#7063 2013-02-22 20:11:40

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

Some errors for you to play with:  big_smile

Code:

shiny:snapin8r tim$ ./snapin8r -p 10039516 -f blocklist.xml
Downloading project data...
Converting...
Traceback (most recent call last):
  File "snapin8r.py", line 362, in <module>
  File "snapin8r.py", line 116, in convert
  File "snapin8r.py", line 314, in XMLWithScratchObject
  File "snapin8r.py", line 259, in XMLWithScratchObject
  File "snapin8r.py", line 129, in XMLWithScript
  File "snapin8r.py", line 158, in XMLWithBlock
KeyError: u'setRotationStyle'
shiny:snapin8r tim$ ./snapin8r -p 2041731 -f roads_v4.xml
Downloading project data...
Converting...
Traceback (most recent call last):
  File "snapin8r.py", line 362, in <module>
  File "snapin8r.py", line 116, in convert
  File "snapin8r.py", line 314, in XMLWithScratchObject
  File "snapin8r.py", line 259, in XMLWithScratchObject
  File "snapin8r.py", line 129, in XMLWithScript
  File "snapin8r.py", line 203, in XMLWithBlock
  File "snapin8r.py", line 203, in XMLWithBlock
  File "snapin8r.py", line 198, in XMLWithBlock
  File "snapin8r.py", line 158, in XMLWithBlock
KeyError: u'undefined'

Edit: whoops, sorry, you said raster images aren't supported yet. Ignore me...

For the record, the first one meant your project used the "set rotation style" block which is unsupported in Snap! (Jens…)


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

Offline

 

#7064 2013-02-22 20:29:28

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Yeah, could you rewrite it in Javascript?  Then we could just add it to
Snap! itself instead of needing a separate process.

Erm… before I try, can we try using this or this? They both sound reasonable, especially the latter.

bharvey wrote:

Oh, I hadn't thought about where the project comes from.  Can't you download it from the 2.0 site and then import it from your desktop?

I don't think that will work. Unless I pester the ST to CORSify their APIs (which will probably not happen), I don't see how to grab the data without a server running.  hmm

blob8108 wrote:

From the point of view of a user (*cough* like n), it's much easier to […] We should have a snapin8! bookmarklet

I completely agree. Compare these:
- Open project
- Download project as a zip
- Drag project into webpage
- Wait for a slow JS task to finish
- Hope for no crashes

- Open project
- Click "Snapin8!" on bookmarks bar
- Wait for a quick Python script; no fear of crashing because it's on the server


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

Offline

 

#7065 2013-02-22 21:17:57

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

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

Erm… before I try, can we try using this or this?

OK, I'm going to stop being the middleman and leave that for Jens to answer.  smile

- Open project
- Click "Snapin8!" on bookmarks bar
- Wait for a quick Python script; no fear of crashing because it's on the server

So, "open project" means "go to the Scratch 2.0 site and open project," right?  If that's what works best then I guess that's what people should do.  But it ruins the beautiful simplicity of "just drag your Scratch or BYOB project into Snap! and everything simply works."  Oh well.

Also, won't people be confused about having to go to the Snap! site to get this bookmarklet that they actually use on the Scratch site?  Where "people" means users (not like n  smile ).


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

Offline

 

#7066 2013-02-22 22:13:02

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

Re: BYOB 3 - Discussion Thread

blob8108 wrote:

it's much easier to just go to the snapin8r page, point it at your project, and have it download the project to the server and convert it for you.

Wait, if the snapin8r page can access a Scratch 2.0 project, why can't the Snap! page (i.e., why can't Snap!)?  So next to the Import... option we'd have "Import from Scratch 2.0..." which would pipe the project through snapin8r and then load the result into Snap!.


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

Offline

 

#7067 2013-02-23 03:22:23

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

Re: BYOB 3 - Discussion Thread

bharvey wrote:

blob8108 wrote:

it's much easier to just go to the snapin8r page, point it at your project, and have it download the project to the server and convert it for you.

Wait, if the snapin8r page can access a Scratch 2.0 project, why can't the Snap! page (i.e., why can't Snap!)?  So next to the Import... option we'd have "Import from Scratch 2.0..." which would pipe the project through snapin8r and then load the result into Snap!.

You could do that, too (use the server just to fetch the project) -- but then I guess since you have a server anyway, you might as well have it run Hardmath's script, too  tongue

Does JS support ZIP files, anyway?


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

Offline

 

#7068 2013-02-23 05:43:03

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

Re: BYOB 3 - Discussion Thread

A simple Google reveals…

What's your server coded in? PHP or Python? If it's Python, then I see no reason to have a client-side decoder, but it's PHP we'll have to set up a separate Python server via App Engine or whatever (ew…).  hmm


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

Offline

 

#7069 2013-02-23 06:07:42

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Our server is coded in Smalltalk. But apart from this question I vote for client-side conversion using JavaScript and for integrating it into Snap in the same way that nXIII's aweseome YPR conversion tool it integrated. I think it's okay to first export a Scratch program into a local file, and then to drag that file into Snap! or to open it using the import option. See, that way it would also work for those kids who only use Scratch and Snap offline (there will be an offline version of Scratch).

You know, that doesn't prevent you from hosting your own online-conversion separately (or hosting it on our servers). The online version could offer more powerful features, like batch-conversion of a user's whole project stash.


Jens Mönig

Offline

 

#7070 2013-02-23 06:38:24

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

Re: BYOB 3 - Discussion Thread

How about this? I rewrite the file I/O of my converter so that instead of accepting a URL, it can also accept the url-encoded data of a ZIP file? I can read the data and get the data within my tool. So you just need to code a wrapper around my server script which takes a POST request and returns the XML data for you to play with. That lets you drag in a .sb2, but also have a bookmarklet feature.


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

Offline

 

#7071 2013-02-23 07:11:10

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Yeah, but that still wouldn't work in offline-world, right?


Jens Mönig

Offline

 

#7072 2013-02-23 07:49:14

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

Re: BYOB 3 - Discussion Thread

Well, I suppose you could package a makeshift simple server, but that's admittedly ugly.

Hold on, if you need to download a project from the website, you already have internet access, so making it offline-compatible wouldn't really be necessary, right?


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

Offline

 

#7073 2013-02-23 07:54:05

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Well, a lot of people are waiting for the promised offline version of Scratch. Also, you can use Snap! offline, too. That's a big argument for people in areas (countries) with poor or expensive internet access and / or low bandwith. But, I agree, it's not the highest priority. It would be totally, amazingly, unspeakably, mind-blowingly awesome, of course...  smile


Jens Mönig

Offline

 

#7074 2013-02-23 08:33:43

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

Re: BYOB 3 - Discussion Thread

Jens wrote:

Well, a lot of people are waiting for the promised offline version of Scratch. Also, you can use Snap! offline, too. That's a big argument for people in areas (countries) with poor or expensive internet access and / or low bandwith. But, I agree, it's not the highest priority.

Oh, yeah, that's a good point. But temporarily, can we get the current server-side converter integrated? Once we get this version working, I'll add some of the less important features (comments, anyone?).


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

Offline

 

#7075 2013-02-23 08:40:18

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

Jens wrote:

Well, a lot of people are waiting for the promised offline version of Scratch. Also, you can use Snap! offline, too. That's a big argument for people in areas (countries) with poor or expensive internet access and / or low bandwith. But, I agree, it's not the highest priority. It would be totally, amazingly, unspeakably, mind-blowingly awesome, of course...  smile

I understand the theoretical interest of such a discussion. But seen from the layman viewpoint, Byob (offline) converts directly Scratch *.sb projects into Byob *.ypr projects. And *.ypr can be simply loaded into Snap! by drag-and-dropping. This double conversion already works. The only issue is related to Scratch features not yet implemented into Snap! like SET color TO. For example Jens Scratch project Colour Me! is loaded into Snap! but does not work due to the missing graphic instructions.

Offline

 

Board footer