@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
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).
Offline
Jens wrote:
Great! Congratulations, Hardmath123.
Thanks! How's it going? Any issues so far?
Offline
bharvey wrote:
technoboy10 wrote:
This thread is the most fun to read.
![]()
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.
Offline
Some errors for you to play with:
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)
Offline
Hardmath123 wrote:
How's it going? Any issues so far?
![]()
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...
Offline
joefarebrother wrote:
Aw, no fair googling it!
Offline
bharvey wrote:
Hardmath123 wrote:
How's it going? Any issues so far?
![]()
Yeah, could you rewrite it in Javascript?
That's meaaan...
Anyway, wouldn't you get all those CORS problems?
Offline
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)
Offline
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!
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
Offline
blob8108 wrote:
Some errors for you to play with:
![]()
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…)
Offline
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.
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
Offline
OK, I'm going to stop being the middleman and leave that for Jens to answer.
- 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 ).
Offline
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!.
Offline
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
Does JS support ZIP files, anyway?
Offline
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…).
Offline
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.
Offline
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.
Offline
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?
Offline
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...
Offline
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?).
Offline
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...
![]()
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