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

#101 2012-04-23 10:25:10

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

You send the post data (containing the block name, username, password, block info and anything else needed to recreate the block file and credit it at the other end) to a .php page on the block library site. A PHP script can then read this data and store the information in a database, verify the username and password, create a block file etc.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#102 2012-04-23 10:58:27

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

You send the post data (containing the block name, username, password, block info and anything else needed to recreate the block file and credit it at the other end) to a .php page on the block library site. A PHP script can then read this data and store the information in a database, verify the username and password, create a block file etc.

You were worried about the password not being encrypted? There is a block in the block library like this: 'password for %s is %s?'. I could use that method, and then the block importer just sends the account name if the password is correct, I'll make the security in the source code so that one can't modify the uploading code. So it just posts the block name, username, comment, and the file. I'll need a little help knowing how the request should be formatted and sent.

Offline

 

#103 2012-04-23 11:08:22

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

You can certainly use the password block from the library, but the password isn't encrypted when it's sent through that either!

The encryption isn't too important though, since the password is never stored and the scratchblocks site is pretty secure.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#104 2012-04-23 11:26:41

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

You can certainly use the password block from the library, but the password isn't encrypted when it's sent through that either!

The encryption isn't too important though, since the password is never stored and the scratchblocks site is pretty secure.

Ok, what we don't want is impersonation. Without the password, anybody could just post a block under someone else's name with say, a bad word or something.
Do you know anyone else who could help me with the upload a block feature?
Oh, and about the args, (%s = $String$, %n = $Number$), do you know where the methods for the arg parsing are located in panther? It would be cool to use this, as it is more efficient.

Offline

 

#105 2012-04-23 11:30:56

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

I agree that a username and password should be needed to share a block for exactly the reasons you put above.

I'm afraid I don't know where the method is, but I DO have a list of all Panther arguments if it's any help. I wrote a squeak tutorial a long time ago on the Scratch Wiki:

Arguments list


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#106 2012-04-23 12:18:34

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

I agree that a username and password should be needed to share a block for exactly the reasons you put above.

I'm afraid I don't know where the method is, but I DO have a list of all Panther arguments if it's any help. I wrote a squeak tutorial a long time ago on the Scratch Wiki:

Arguments list

With the argument words added, and the share a block, I think the patch would be perfect. Have you tried it?

Offline

 

#107 2012-04-23 12:43:56

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

I found the code for the word args.  smile  I'm going to update the block importer now.

Offline

 

#108 2012-04-23 12:52:21

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Erm, how will using word args work in Scratch? Would your patch effectively replace all existing args with word args? That could seriously confuse new dabblers...

I haven't tried it yet, I can't get it to work! I copied the contents of the text argument, opened a workspace, pasted it in, accepted it and filed it in but nothing happened, no new menus or anything!

I should point out that BYOB and Panther support is something you can develop if you wish, but not something the library would use. We already have block files for Panther and sprite files containing custom blocks for BYOB (though now I come to think of it, a patch for Panther to import blocks by number from the library would be pretty neat).


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#109 2012-04-23 13:32:24

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

Erm, how will using word args work in Scratch? Would your patch effectively replace all existing args with word args? That could seriously confuse new dabblers...

I haven't tried it yet, I can't get it to work! I copied the contents of the text argument, opened a workspace, pasted it in, accepted it and filed it in but nothing happened, no new menus or anything!

I should point out that BYOB and Panther support is something you can develop if you wish, but not something the library would use. We already have block files for Panther and sprite files containing custom blocks for BYOB (though now I come to think of it, a patch for Panther to import blocks by number from the library would be pretty neat).

Yes. When the patch is installed I have to replace the block specs, because this code has to be added: , (CustomBlockSpecsDictionary formatAsArrayFor: 'All'). I could just as well replace all the args. uncoloredArgMorphsFor: also has to be replace to support custom args.
New dabblers.. hmmm... I never thought about that. How could I implement the word args. It's very efficient, but not many people know a lot about it, and some, as you say, may be confused. If they're confused they should probably ask me.

Are you sure nothing appears after you file-in the patch? You have to select 'save image for end-user' to save and rebuild the menu panels, ('file edit help'), then the 'blocks' menu will show up, did you do that?

As for Panther and BYOB, I was thinking of making a block importer that's compatible with them too, plus exporting custom blocks (BYOB and CYOB) compatible with the scratch block importer.
Isn't there already a 'download $Number$ block from library' block?

Offline

 

#110 2012-04-23 13:48:24

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

I'm worried that someone will start exploring the browser in Scratch and see $Word$ arguments, then they'll try and do it in an unpatched version of Scratch and get very confused about the %l arguments. However, I suppose it could be mentioned as a patch feature on the patch downloader. I think we'll also supply a download for a copy of the Scratch image that has been patched for the use of people who can't, won't or don't want to file the patch in themselves.

I'll have another go at running it, I did save image for end user last time and saw no change...

The thing is, I don't really see the use of a block importer for BYOB or Panther... Panther has a custom blocks system already, which works quite well and doesn't actually involve browser edits, meaning blocks are stored in project files, letting them work in all copies. The block downloader reads a file containing the block spec, colour, author and method from a file hosted by me, then uses a smalltalk script created by MathWizz to add the block to the custom blocks list. This is, of course, yours to use if you want to.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#111 2012-04-23 13:59:52

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

I'm worried that someone will start exploring the browser in Scratch and see $Word$ arguments, then they'll try and do it in an unpatched version of Scratch and get very confused about the %l arguments. However, I suppose it could be mentioned as a patch feature on the patch downloader. I think we'll also supply a download for a copy of the Scratch image that has been patched for the use of people who can't, won't or don't want to file the patch in themselves.

I'll have another go at running it, I did save image for end user last time and saw no change...

The thing is, I don't really see the use of a block importer for BYOB or Panther... Panther has a custom blocks system already, which works quite well and doesn't actually involve browser edits, meaning blocks are stored in project files, letting them work in all copies. The block downloader reads a file containing the block spec, colour, author and method from a file hosted by me, then uses a smalltalk script created by MathWizz to add the block to the custom blocks list. This is, of course, yours to use if you want to.

You're right, I should also make an image, and I should mention the $word$ arguments as a feature. I already have a download block feature, it's the same as the importer only it imports from an url. I think panther is amazing, by the way. My favorite things are CYOB and the color blocks. Once I ALMOST entirely ported the color blocks to the scratch source code, the only problem was that it couldn't save properly.

Offline

 

#112 2012-04-23 14:18:29

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

I'm glad you like Panther, we worked for a long time on it  smile  I think the colour functionality (on top of the webcam connection) as well as custom blocks are its most powerful tools, I've used to make learning scripts that recognise different country flags for my artificial intelligence coursework!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#113 2012-04-23 15:25:40

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

So if you're agreeable, and could post an image file for sharing, I'd like to update the Scratch>control section of the block library to this new format to see how it would all look! Could you share the .block files for Scratch>control that you have finished making? I'll take them and rehost them on the blocks.scratchr site so you can just post the file code in a post and I'll upload them as .block files if that's easier for you.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#114 2012-04-23 15:29:16

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

So if you're agreeable, and could post an image file for sharing, I'd like to update the Scratch>control section of the block library to this new format to see how it would all look! Could you share the .block files for Scratch>control that you have finished making? I'll take them and rehost them on the blocks.scratchr site so you can just post the file code in a post and I'll upload them as .block files if that's easier for you.

YES! Thank you. There are a few bugs in the newest block importer that I have to clear up first, but I can give you the files for motion and the controls ones I've made.

Offline

 

#115 2012-04-23 15:35:43

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Okay, if you can give me the block files, I can start working on a nice layout. I'll just do the control section for now so that everyone can suggest aesthetic changes  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#116 2012-04-23 15:42:20

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

I'm gonna use pseudo code here, cos I've not used smalltalk in a long time, but have you considered doing something like this?:

in the patch:

Code:

create a file called version.txt
add 1.0 to line 1 (The current version)
add 1.0 to line 2 (The last version it was updated at)

in the Scratch startup script:

Code:

try to connect to http://www.blocks.scratchr.org/blockFiles/newestVersion.php and then read the version number from that page using readfromURL. (page doesn't exist atm)
compare the read version number against the version.txt line 1
if(newestVersion > version.txtLine1 && newestVersion > version.txtLine2){
display a popup asking if they want to install the new version
if(yes selected){
read latest patch from http://www.blocks.scratchr.org/blockFiles/newestPatch.php
file this in
restart Scratch
}
else{
change line 2 of version.txt to latestVersion so that they aren't asked again if they wish to update until another patch comes out
}
}

http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#117 2012-04-24 09:28:58

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

I'm gonna use pseudo code here, cos I've not used smalltalk in a long time, but have you considered doing something like this?:

in the patch:

Code:

create a file called version.txt
add 1.0 to line 1 (The current version)
add 1.0 to line 2 (The last version it was updated at)

in the Scratch startup script:

Code:

try to connect to http://www.blocks.scratchr.org/blockFiles/newestVersion.php and then read the version number from that page using readfromURL. (page doesn't exist atm)
compare the read version number against the version.txt line 1
if(newestVersion > version.txtLine1 && newestVersion > version.txtLine2){
display a popup asking if they want to install the new version
if(yes selected){
read latest patch from http://www.blocks.scratchr.org/blockFiles/newestPatch.php
file this in
restart Scratch
}
else{
change line 2 of version.txt to latestVersion so that they aren't asked again if they wish to update until another patch comes out
}
}

I think I should incorporate that in the patch, but it shouldn't be in the startup. In panther, as you know, when you start up a dialog shows up titled: 'Panther News', which gets contents from an url. A few times, when I lost internet, I tried to use panther, but it got stuck on the 'connecting...' thing, so I couldn't start panther because I had no internet at the moment. I think there should be a label in the blocks menu called: 'Update Block Importer' , version. Basically, 'Update Block Importer ' combined with the version.

Offline

 

#118 2012-04-24 10:15:24

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Okay, that sounds like a good solution!

Could you post the block files you've done for the Control section?


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#119 2012-04-24 10:17:50

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

Okay, that sounds like a good solution!

Could you post the block files you've done for the Control section?

Actually, with the word args, I have to start over, but that's not too bad.

Offline

 

#120 2012-04-24 10:20:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

dreamod wrote:

sparks wrote:

Okay, that sounds like a good solution!

Could you post the block files you've done for the Control section?

Actually, with the word args, I have to start over, but that's not too bad.

Find and replace?  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#121 2012-04-24 11:15:54

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

dreamod wrote:

sparks wrote:

Okay, that sounds like a good solution!

Could you post the block files you've done for the Control section?

Actually, with the word args, I have to start over, but that's not too bad.

Find and replace?  tongue

I'm going to start over, I'm working on completing the final patch, it's almost done. I've also made a Mac OS X Block Importer 2.0 VM. Basically, an edit of the Scratch application, except with the 'info.plist' edited. I've fixed a few glitches and it's almost completely done.

Offline

 

#122 2012-04-24 11:47:15

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

Very cool! I'm really looking forward to implementing it!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#123 2012-04-24 12:06:56

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

I'll also make a tutorial of how to use every single feature in it, and take it to the max.

Offline

 

#124 2012-04-24 12:10:02

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Block Files

That's cool  smile

Is the patch removeable? It's something you might want to think about in case someone doesn't want it anymore. Remember the patch might mess up any custom blocks they added to their copy of Scratch beforehand if arguments are shared or because of the $words$.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#125 2012-04-24 12:41:14

dreamod
New Scratcher
Registered: 2012-01-22
Posts: 100+

Re: Block Files

sparks wrote:

That's cool  smile

Is the patch removeable? It's something you might want to think about in case someone doesn't want it anymore. Remember the patch might mess up any custom blocks they added to their copy of Scratch beforehand if arguments are shared or because of the $words$.

My advice to anybody who installs this patch is: before you install the patch, backup the image, make sure you have an extra copy, in case you're not satisfied.

Offline

 

Board footer