Andres recently started a topic about what networking features you'd like to see in Scratch, and I think a bunch of them can more or less be distilled as loading external data into Scratch. A URL() block would do a really nice job of implementing a lot of these features. Its purpose is pretty self-explanatory:
set costume to ( URL ( "scratch.mit.edu/logo.gif") ) play sound ( URL ( "freesounds.org/soundoftheday.mp3" ) ) set [loaded data] to ( URL ( "feeds.scratch.mit.edu/users/fullmoon/updates.xml" ) ) set [query] to ( URL ( "http://something.com/api.php?name=cheese" ) )
Once something was loaded it wouldn't be garbage collected until the Java VM needs it to, so repeated calls to get the same external file wouldn't repeatedly load it. If necessary, another block:
reload URL ( )
could be used to get data that is constantly changing, like an RSS feed.
What say you?
Last edited by fullmoon (2010-02-21 09:37:32)
Offline
Yes, having just a URL block for images and sounds would make my projects a lot easier, and I'm pretty sure it'd be the same for other people.
Offline
Another url block: {refreshed?}
It would be a boolean repoter. It would report if the page was refreshed.
Last edited by scratch_yoshi (2009-11-15 17:35:19)
Offline
scratch_yoshi wrote:
Another url block: {refreshed?}
It would be a boolean repoter. It would report if the page was refreshed.
like <is (url) refreshed?> ?
Yeah, that would eliminate the need for a refresh URL() block. But of course it would require the data to be loaded again.
Last edited by fullmoon (2010-02-21 09:38:25)
Offline
cocoanut wrote:
I wanted to post this the other day, but you beat me to it!
I agree, it could be useful.
Yes I agree too. I love the ideas, I am working on my own programming system and these would be really cool! . I would also like blocks like these ones :
post {lists and variable} on server { www.somewebsite.com } ( input from server (67) ) create public server called {someserver} create private server name:{someserver} password:{***********} join server {someserver} if password use {***********} send {Hello} on server (67)
and buttons like these ones:
(create server) (join server)
Which would pop up windows like this:
{----------------------------------------------------------------------------------------------------------------------} |server name:{someserver} |password:{somepassword} |o private o public |o worldwide o network o on networks: | {blah} | {blah} {-----------------------------------------------------------------------------------------------------------------------}
Last edited by butheadrecoverdwpa (2009-12-13 16:24:23)
Offline
Offline
HTTP POST and GET would be nice and relatively simple but we would need a way to use a string as an index in a list (like a hash/dictionary):
List vars; Var result; set item ["name"] of [vars] to ["fullmoon"] set item ["password"] of [vars] to ["password"] set result to (request data from URL("http://something.com/login.php") with [vars] and method [POST]) if(item["success"] of [result] = "true"){ broadcast ["logged in"] }else{ broadcast ["failed to log in"] }
Note the use of just one new block: the reporter request data from () with () and method [POST/GET].
What it does is exactly that. It sends the data to the specified URL but attaches URL-encoded variables (in this case, username and password). It would wait until data is returned from the server and then report. Depending on the type of data returned the Scratch user may have to use the (item [] of []) block to retrieve a URL-encoded variable or may just be able to use the name of the variable the request data is stored in to retrieve text if it was returned.
Offline
this may not be relevant, but you should be able to disable downloads on your project.
Offline
fullmoon wrote:
waveos wrote:
this may not be relevant, but you should be able to disable downloads on your project.
I don't think so...one of the principles of Scratch is that everything should be open source.
Yeah. It's called the "Creative Commons License"
Offline
Offline
However awesome a Open URL block, people could load like, 50000 Rick rolls to open, causing somebodies computer to slowdown and freeze. And what about creepy people who link innocent kids into innappropriate websites?
Offline
I know the ways of saving an image of the stage or part of a screen etc.. but that is part of the scratch program and not part of the
project.. would a url block be of use if you wanted to create a project such as creating a tshirt or card/design and exporting the finished
image to a location within computers file structure from within the project..
Offline
The URL block shouldn't be added, because viruses and innapropriate content can be put in projects. Maybe something where the link needs to be approved by the Scratch Team before it works in projects?
Offline
GirWaffles64 wrote:
However awesome a Open URL block, people could load like, 50000 Rick rolls to open, causing somebodies computer to slowdown and freeze. And what about creepy people who link innocent kids into innappropriate websites?
I agree that sending people to websites could be a problem, and I think it could be handled the same way Flash player handles camera/mic requests. A pop-up within the Scratch player that asks "Are you sure you want to visit such-and-such" with options to confirm, deny, and prevent this project from making such requests in the future.
Offline
fullmoon wrote:
GirWaffles64 wrote:
However awesome a Open URL block, people could load like, 50000 Rick rolls to open, causing somebodies computer to slowdown and freeze. And what about creepy people who link innocent kids into innappropriate websites?
I agree that sending people to websites could be a problem, and I think it could be handled the same way Flash player handles camera/mic requests. A pop-up within the Scratch player that asks "Are you sure you want to visit such-and-such" with options to confirm, deny, and prevent this project from making such requests in the future.
I agree. Also, instead of confirm and deny, I think OK and Cancel would be easier to understand :)
Offline
fullmoon wrote:
GirWaffles64 wrote:
However awesome a Open URL block, people could load like, 50000 Rick rolls to open, causing somebodies computer to slowdown and freeze. And what about creepy people who link innocent kids into innappropriate websites?
I agree that sending people to websites could be a problem, and I think it could be handled the same way Flash player handles camera/mic requests. A pop-up within the Scratch player that asks "Are you sure you want to visit such-and-such" with options to confirm, deny, and prevent this project from making such requests in the future.
Good idea... didn't think of that!
Offline
No, a URL block wouldn't be a good idea. The one, big, fat reason is this:
Someone uploads a project to the web that opens up a virused website.
Everyone who views the project gets a virus.
Do you like this situation?
Offline
I think I posted somthing like this awhile ago, great idea!
OMG! MY 1000th POST!
Offline
rubiks_cube_guy238 wrote:
No, a URL block wouldn't be a good idea. The one, big, fat reason is this:
Someone uploads a project to the web that opens up a virused website.
Everyone who views the project gets a virus.
Do you like this situation?
How would it download...?
Offline
This idea isn't great. I don't give my consent.
Offline