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

#1 2009-11-15 16:22:29

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

A URL() block?

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:

Code:

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:

Code:

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)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#2 2009-11-15 16:23:37

gettysburg11
Scratcher
Registered: 2008-06-14
Posts: 1000+

Re: A URL() block?

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.


http://i256.photobucket.com/albums/hh184/mnacmilan/LOGO_ACMILAN-Splash.gif

Offline

 

#3 2009-11-15 16:44:34

cocoanut
Scratcher
Registered: 2007-07-10
Posts: 1000+

Re: A URL() block?

I wanted to post this the other day, but you beat me to it!

I agree, it could be useful.


http://i42.tinypic.com/20gyvif.jpgPlease leave a message at the beep.
Steam: Hellephant

Offline

 

#4 2009-11-15 17:35:03

scratch_yoshi
Scratcher
Registered: 2009-06-12
Posts: 1000+

Re: A URL() block?

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)


Retired from Scratch, but just the language itself. Not the forums.

Offline

 

#5 2009-11-15 18:03:07

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: A URL() block?

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)


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#6 2009-12-13 16:15:10

butheadrecoverdwpa
Scratcher
Registered: 2009-01-25
Posts: 25

Re: A URL() block?

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!  smile  . I would also like blocks like these ones :

Code:

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:

Code:

(create server)
(join server)

Which would pop up windows like this:

Code:

{----------------------------------------------------------------------------------------------------------------------}
|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

 

#7 2009-12-13 17:47:57

ThePCKid
Scratcher
Registered: 2009-09-16
Posts: 1000+

Re: A URL() block?

[Open browser with URL [Text Here]]

Offline

 

#8 2009-12-13 18:23:02

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: A URL() block?

That would be awesome!


http://i48.tinypic.com/2z5pqad.png

Offline

 

#9 2009-12-13 19:20:45

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

Re: A URL() block?

Interesting idea..


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

Offline

 

#10 2009-12-15 13:23:17

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: A URL() block?

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):

Code:

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.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#11 2009-12-16 17:03:52

waveos
Scratcher
Registered: 2009-08-13
Posts: 16

Re: A URL() block?

this may not be relevant, but you should be able to disable downloads on your project.


There are 10 types of people in this world- Those who understand binary, and those who don't! Level up my Doodle!

Offline

 

#12 2009-12-16 17:28:47

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: A URL() block?

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.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#13 2009-12-16 18:03:42

gershmer
Scratcher
Registered: 2009-02-12
Posts: 1000+

Re: A URL() block?

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"


Visit my site, Gershmer.net
Leave me a voicemail at my Google Voice number, [removed]

Offline

 

#14 2009-12-21 17:13:52

somelia
Scratcher
Registered: 2009-09-13
Posts: 1000+

Re: A URL() block?

Bump  smile


I like this idea.

Offline

 

#15 2009-12-22 19:38:52

GirWaffles64
Scratcher
Registered: 2009-08-09
Posts: 1000+

Re: A URL() block?

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?


hey kiddoes i'm back

Offline

 

#16 2009-12-22 19:39:52

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: A URL() block?

Maybe a prompt would ask you "are you sure you want to go to so-and-so-website?"

Offline

 

#17 2009-12-22 21:28:04

forest
Scratcher
Registered: 2007-07-29
Posts: 100+

Re: A URL() block?

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

 

#18 2009-12-23 04:42:02

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: A URL() block?

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?


~ihaveamac - visit ihaveamac.net

Offline

 

#19 2009-12-24 14:52:18

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: A URL() block?

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.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#20 2009-12-29 19:28:13

pikavee
Scratcher
Registered: 2009-09-17
Posts: 19

Re: A URL() block?

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 :)


http://img293.imageshack.us/img293/2360/dinoclorsig.png
I am Dinoclor's old account =P

Offline

 

#21 2009-12-30 13:21:28

GirWaffles64
Scratcher
Registered: 2009-08-09
Posts: 1000+

Re: A URL() block?

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!


hey kiddoes i'm back

Offline

 

#22 2010-01-27 13:01:00

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: A URL() block?

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?


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#23 2010-01-30 15:23:50

coolperson
Scratcher
Registered: 2007-08-21
Posts: 1000+

Re: A URL() block?

I think I posted somthing like this awhile ago, great idea!
OMG! MY 1000th POST!


Coolperson- 2012 National Vex Robotics Finalist!
http://www.scratch.mit.edu/ext/youtube/?v=sn7p84DQFyk

Offline

 

#24 2010-01-30 16:32:56

gershmer
Scratcher
Registered: 2009-02-12
Posts: 1000+

Re: A URL() block?

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...?


Visit my site, Gershmer.net
Leave me a voicemail at my Google Voice number, [removed]

Offline

 

#25 2010-01-30 16:39:13

Ace-of-Spades
Scratcher
Registered: 2010-01-08
Posts: 1000+

Re: A URL() block?

This idea isn't great. I don't give my consent.


11110010100011010100011010101000100011011011001010111100101000110101000110101010001000110110110010101111001010001101010001101010100010001101101100101011110010100011010100011010101000100011011011001010
110101010010001010101010101010101010101010100110101010010101010010101001101011010101010010101010101

Offline

 

Board footer