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

#1 2010-10-01 15:49:57

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Hey...

Right, so my class is having a competition on who can make the best cutom blok, but my teacher said we can't use any of the online blocks, and it looks like she's blocked pretty much everything. I have NO idea of squeak stuff and I came up with...

Get IP Adress!!

But this is what i wrote:

Get IP Adress t1:

t1 = getIPadress


None of the tutorials I have seen have helped so it would be really nice if someone told me how, not do it for me.

Offline

 

#2 2010-10-01 15:59:17

Sperry
Scratcher
Registered: 2010-03-09
Posts: 500+

Re: Hey...

TornFusion wrote:

Right, so my class is having a competition on who can make the best cutom blok, but my teacher said we can't use any of the online blocks, and it looks like she's blocked pretty much everything. I have NO idea of squeak stuff and I came up with...

Get IP Adress!!

But this is what i wrote:

Get IP Adress t1:

t1 = getIPadress


None of the tutorials I have seen have helped so it would be really nice if someone told me how, not do it for me.

Its a reporter right? Well, if it is, that method doesn't return a value, so add

Code:

^ variable

where variable is the thing you want the block to report.

Does this help?


http://img709.imageshack.us/img709/3252/gobanim2.gifhttp://ls.gd/bo

Offline

 

#3 2010-10-01 16:01:14

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

not really, i am 10, she's just pushing us, and Im the most experienced person in my class. By the way, I have no idea what you're talking about, upload a pic.

Offline

 

#4 2010-10-01 16:07:05

Sperry
Scratcher
Registered: 2010-03-09
Posts: 500+

Re: Hey...

Off the top of my head, I don't know how to get the IP address myself, so I coudln't give you a hint in that direction.

If you want to make a reporter block, it has to actually return something in the method itself. To do this you need to add the ^ sign, then put what you want to return after it.

Also I don't think you need the t1, so remove the t1 in the top line, and then put that code you've got after the ^ sign to return it.


Is that better? I could write a fully blown explanation on how to make a block if you like. When have you got to do this by?


http://img709.imageshack.us/img709/3252/gobanim2.gifhttp://ls.gd/bo

Offline

 

#5 2010-10-01 16:11:48

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

Sperry wrote:

Off the top of my head, I don't know how to get the IP address myself, so I coudln't give you a hint in that direction.

If you want to make a reporter block, it has to actually return something in the method itself. To do this you need to add the ^ sign, then put what you want to return after it.

Also I don't think you need the t1, so remove the t1 in the top line, and then put that code you've got after the ^ sign to return it.


Is that better? I could write a fully blown explanation on how to make a block if you like. When have you got to do this by?

Monday, If I do it, I get to represent my school on who can make the best scratch project, if I win I get put on the school's hall of fame and win the school £1,000 so it's pretty important. I just made a previous costume without looking at anyone blocks, but I could use a fully blown explanation.

Offline

 

#6 2010-10-01 16:13:16

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

Re: Hey...

this is.... odd. You're 10 and your teacher is making you code your own blocks?! most 10 year olds just about stick the blocks together... What are you doing this in? Scratch itself or a modification like BYOB or Panther?

Last edited by sparks (2010-10-01 16:14:03)


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

Offline

 

#7 2010-10-01 16:14:00

Sperry
Scratcher
Registered: 2010-03-09
Posts: 500+

Re: Hey...

TornFusion wrote:

Sperry wrote:

Off the top of my head, I don't know how to get the IP address myself, so I coudln't give you a hint in that direction.

If you want to make a reporter block, it has to actually return something in the method itself. To do this you need to add the ^ sign, then put what you want to return after it.

Also I don't think you need the t1, so remove the t1 in the top line, and then put that code you've got after the ^ sign to return it.


Is that better? I could write a fully blown explanation on how to make a block if you like. When have you got to do this by?

Monday, If I do it, I get to represent my school on who can make the best scratch project, if I win I get put on the school's hall of fame and win the school £1,000 so it's pretty important. I just made a previous costume without looking at anyone blocks, but I could use a fully blown explanation.

I'll write one tomorrow on how to make blocks, and it will have some examples, because I've got to go to bed now, I'm pretty tired after a long week.

What time zone are you in? Just curious as to when you'll see my reply tomorrow.


http://img709.imageshack.us/img709/3252/gobanim2.gifhttp://ls.gd/bo

Offline

 

#8 2010-10-01 16:17:02

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

Re: Hey...

representing the school? that's pretty neat  smile  In that case we definetly don't want to give you actual block code, but there are TONS of tutorials around this section of the forums!

TornFusion wrote:

Monday, If I do it, I get to represent my school on who can make the best scratch project, if I win I get put on the school's hall of fame and win the school £1,000 so it's pretty important. I just made a previous costume without looking at anyone blocks, but I could use a fully blown explanation.

^ best scratch project? you don't need to code your own blocks to make a good project. It's more the application of blocks that should win you points...

Last edited by sparks (2010-10-01 16:42:34)


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

Offline

 

#9 2010-10-01 16:21:55

Andres-Vander
Scratcher
Registered: 2010-09-16
Posts: 1000+

Re: Hey...

Hey I'm in a contest like that too. Are you near.. nevermind don't give out any personal information. I'm going to win mine though


http://www.gifsoup.com/view1/2260823/flugelhorn-feline-o.gif

Offline

 

#10 2010-10-01 16:24:04

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

sparks wrote:

representing the school? that's pretty neat  smile  In that case we definetly don't want to give you actual block code, but there are TONS of tutorials around this section of the forums!

"Monday, If I do it, I get to represent my school on who can make the best scratch project, if I win I get put on the school's hall of fame and win the school £1,000 so it's pretty important. I just made a previous costume without looking at anyone blocks, but I could use a fully blown explanation."

^ best scratch project? you don't need to code your own blocks to make a good project. It's more the application of blocks that should win you points...

Noo... The person in our class that make the best blocks, I have no idea though, I understand your view. But we need to use 3 custom blocks in our best project.

Offline

 

#11 2010-10-01 16:29:02

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

Re: Hey...

interesting. have you enabled mesh on your copy of Scratch? if not, your IP block isn't going to help much  tongue  I don't know if this will count, but there are a lot of obselete blockspecs hanging round readily taken from the browser. Have a look there if you can find them  smile


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

Offline

 

#12 2010-10-02 05:06:06

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

I can help with most blocks, but I dont think a IP block is very useful. Also I believe the code is already online somewhere so...


You can now reach me on Twitter @johnnydean1_

Offline

 

#13 2010-10-02 05:20:28

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

johnnydean1 wrote:

I can help with most blocks, but I dont think a IP block is very useful. Also I believe the code is already online somewhere so...

WHAT?!

How about display text from (URL). And by the way, teach me not tell me.

Offline

 

#14 2010-10-02 05:30:20

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

ok then.

So open up the folder where the Scratch.exe is. You can see .dll files right?
These are plugins.
Are you with me so far?


You can now reach me on Twitter @johnnydean1_

Offline

 

#15 2010-10-02 05:34:10

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

johnnydean1 wrote:

ok then.

So open up the folder where the Scratch.exe is. You can see .dll files right?
These are plugins.
Are you with me so far?

yep,but could you try to upload all of it in one go?

Offline

 

#16 2010-10-02 05:38:57

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: Hey...

TornFusion wrote:

not really, i am 10, she's just pushing us, and Im the most experienced person in my class. By the way, I have no idea what you're talking about, upload a pic.

Your teacher is asking 10 year olds to code blocks in Smalltalk!?


/* No comment */

Offline

 

#17 2010-10-02 05:44:46

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

an some1 just upload the guide?

Offline

 

#18 2010-10-02 05:52:24

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

TornFusion wrote:

johnnydean1 wrote:

ok then.

So open up the folder where the Scratch.exe is. You can see .dll files right?
These are plugins.
Are you with me so far?

yep,but could you try to upload all of it in one go?

Ok. So these plugins can be called from within small talk (the language scratch runs in)

Heres how you call the web page plugin
(HTTPSocket httpGet: variableHere)

so using this you can code:
|variableHere page|
"This declares the variables"
variableHere_ 'page url'.
"This sets variableHere to page url"
page_ ((HTTPSocket httpGet: variableHere) contents).
"This gets the contents of the page variableHere"
page = 'Server  is not responding"
ifTrue: [
page_ ''.
].
"This makes the page set to nothing if the websites down or non-existant"
^ page
"This reports the page value"



On to the next step the code.

Your block needs to look like

getURL: variableHere
| input page|
input_ variableHere asString.
page_ ((HTTPSocket httpGet: input ) contents).
page = 'Server  is not responding"
ifTrue: [
page_ ''.
].
^ page

the getURL: bit is the name of the meathod.
':' is a input.
So in this case we are setting variableHere to a input.

Now to the block spec
Your block spec should look like:

('get url %s' #r #getURL: '')
Ok the %s is a string input (a box)

#r means its a reporter

#getUrl: is the meathod name

'' is the deafault value





Congrats you have made a get URL block!


You can now reach me on Twitter @johnnydean1_

Offline

 

#19 2010-10-02 06:00:07

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

johnnydean1 wrote:

TornFusion wrote:

johnnydean1 wrote:

ok then.

So open up the folder where the Scratch.exe is. You can see .dll files right?
These are plugins.
Are you with me so far?

yep,but could you try to upload all of it in one go?

Ok. So these plugins can be called from within small talk (the language scratch runs in)

Heres how you call the web page plugin
(HTTPSocket httpGet: variableHere)

so using this you can code:
|variableHere page|
"This declares the variables"
variableHere_ 'page url'.
"This sets variableHere to page url"
page_ ((HTTPSocket httpGet: variableHere) contents).
"This gets the contents of the page variableHere"
page = 'Server  is not responding"
ifTrue: [
page_ ''.
].
"This makes the page set to nothing if the websites down or non-existant"
^ page
"This reports the page value"



On to the next step the code.

Your block needs to look like

getURL: variableHere
| input page|
input_ variableHere asString.
page_ ((HTTPSocket httpGet: input ) contents).
page = 'Server  is not responding"
ifTrue: [
page_ ''.
].
^ page

the getURL: bit is the name of the meathod.
':' is a input.
So in this case we are setting variableHere to a input.

Now to the block spec
Your block spec should look like:

('get url %s' #r #getURL: '')
Ok the %s is a string input (a box)

#r means its a reporter

#getUrl: is the meathod name

'' is the deafault value





Congrats you have made a get URL block!

Wait, i cant find scratch.exe or dll. plugins

Offline

 

#20 2010-10-02 06:03:04

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

ok ignore that bit then


You can now reach me on Twitter @johnnydean1_

Offline

 

#21 2010-10-02 06:23:16

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

johnnydean1 wrote:

ok ignore that bit then

That just looks like gobbledegoop. How about get contents of page but dont open it?

Offline

 

#22 2010-10-02 06:29:45

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

What do you mean?


You can now reach me on Twitter @johnnydean1_

Offline

 

#23 2010-10-02 06:30:45

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

('get url %s' #r #getURL: '')


getURL: variableHere
| input page|
input_ variableHere asString.
page_ ((HTTPSocket httpGet: input ) contents).
page = 'Server  is not responding"
ifTrue: [
page_ ''.
].
^ page


is what you asked for!
it gets HTML code off of the page!


You can now reach me on Twitter @johnnydean1_

Offline

 

#24 2010-10-02 06:34:10

TornFusion
Scratcher
Registered: 2010-09-03
Posts: 1000+

Re: Hey...

johnnydean1 wrote:

What do you mean?

Like, say if a page had text, set it to a variable

Offline

 

#25 2010-10-02 06:44:15

johnnydean1
Scratcher
Registered: 2010-02-12
Posts: 1000+

Re: Hey...

well that would take me some time but I could do it, but you have a go.


You can now reach me on Twitter @johnnydean1_

Offline

 

Board footer