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

#676 2010-06-16 15:47:41

Zorbak42
Scratcher
Registered: 2009-01-27
Posts: 100+

Re: Cool custom blocks in Scratch

I'll give you an idea for a block! [post [string] on Twitter] command block. Good luck, you'll need it.

Offline

 

#677 2010-06-16 15:48:25

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

Re: Cool custom blocks in Scratch

You got that idea from me!


You can now reach me on Twitter @johnnydean1_

Offline

 

#678 2010-06-16 18:48:38

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

scratchisthebest wrote:

I need help. My new (key pressed) block gets an error, and my <key [space] pressed> block works like my modblock was supposed to!

Can someone help me? I don't do Squeak.

did you keep the top bold part same as before? that would make the key space pressed work just liek the mod block because the header is the same


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#679 2010-06-17 11:27:29

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Zorbak42 wrote:

I'll give you an idea for a block! [post [string] on Twitter] command block. Good luck, you'll need it.

whoa! that's way way too hard! i can see what i can do, but seeing as the url is probably not "string-sensitive" it's not gonna work.

Offline

 

#680 2010-06-17 12:22:21

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

what about the block: (pick random (1) or (10))


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#681 2010-06-17 12:29:41

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

Re: Cool custom blocks in Scratch

Joeman592 wrote:

what about the block: (pick random (1) or (10))

That can easily be achieved by:

set temp to (pick random 1 to 2)
if <temp = 1>
set someOtherVariable to 1
else
set someOtherVariablr to 2


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

Offline

 

#682 2010-06-17 13:00:23

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Sperry wrote:

Joeman592 wrote:

what about the block: (pick random (1) or (10))

That can easily be achieved by:

set temp to (pick random 1 to 2)
if <temp = 1>
set someOtherVariable to 1
else
set someOtherVariablr to 2

you could even add more numbers to that by using a list.
put the numbers you want in a list, then add the simple script:
[blocks]
<item <pick random( 1 )to( length of list )) of list>
[/blocks]
or, if the possible numbers are an equal distance apart (e.g. 0, 10, 20, 30, etc) you can use the script [blocks]
(( <pick random( 1 )to( 5 )) <*> 10 ))
[/blocks]
this example above will give you either 10, 20, 30, 40 or 50.

Last edited by LS97 (2010-06-18 11:03:31)

Offline

 

#683 2010-06-17 13:05:13

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

Re: Cool custom blocks in Scratch

You can get 4 that way!


You can now reach me on Twitter @johnnydean1_

Offline

 

#684 2010-06-17 13:25:39

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

@johnny:
4?

Offline

 

#685 2010-06-17 13:31:50

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

Re: Cool custom blocks in Scratch

Look at your post ^


You can now reach me on Twitter @johnnydean1_

Offline

 

#686 2010-06-17 14:47:50

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

yeah well 4 what?

Offline

 

#687 2010-06-17 15:14:02

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

Re: Cool custom blocks in Scratch

Joeman592 wrote:

LS97 wrote:

Joeman592 wrote:

how about... a previous costume block?

no use. just do a
[blocks]<switch to costume[ (( <costume#> <-> 1 ))

come on, please?

Code:

previousCostume

self costumeIndex: self costumeIndex - 1

/* No comment */

Offline

 

#688 2010-06-17 16:05:33

Zorbak42
Scratcher
Registered: 2009-01-27
Posts: 100+

Re: Cool custom blocks in Scratch

johnnydean1 wrote:

You got that idea from me!

Yes, I did. I'm helping you get it.

Offline

 

#689 2010-06-17 16:07:52

Zorbak42
Scratcher
Registered: 2009-01-27
Posts: 100+

Re: Cool custom blocks in Scratch

LS97 wrote:

Zorbak42 wrote:

I'll give you an idea for a block! [post [string] on Twitter] command block. Good luck, you'll need it.

whoa! that's way way too hard! i can see what i can do, but seeing as the url is probably not "string-sensitive" it's not gonna work.

lol, ya. Many people have tried. Luckily, Scratch 2.0 will probably have a block similar to this.

Offline

 

#690 2010-06-17 16:10:26

Zorbak42
Scratcher
Registered: 2009-01-27
Posts: 100+

Re: Cool custom blocks in Scratch

LS97 wrote:

Sperry wrote:

Joeman592 wrote:

what about the block: (pick random (1) or (10))

That can easily be achieved by:

set temp to (pick random 1 to 2)
if <temp = 1>
set someOtherVariable to 1
else
set someOtherVariablr to 2

you could even add more numbers to that by using a list.
put the numbers you want in a list, then add the simple script:
[blocks]
<item <pick random( 1 )to( length of list )) of list>
[/blocks]
or, if the possible numbers are an equal distance apart (e.g. 0, 10, 20, 30, etc) you can use the script [blocks]
(( <pick random( 1 )to( 5 )) <*> 10 ))
[/blocks]
this example above will give you either 10, 20, 30, 4 or 50.

I think you mean this example above will give you either 10, 20, 30, 40, 50.

Offline

 

#691 2010-06-17 17:14:17

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

those still wouldnt get what i want. i want a code for pick random 1 or 10 not a thing that gives you 10 20 30 40 50 or something else! PLEASE!


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#692 2010-06-18 11:01:02

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Joeman592 wrote:

those still wouldnt get what i want. i want a code for pick random 1 or 10 not a thing that gives you 10 20 30 40 50 or something else! PLEASE!

then do [blocks]
<if><( <pick random( 1 )to( 2 )) <=> 1 )>
<set{ whatever }to( 1 >
<else>
<set{ whatever }to( 10 >

Offline

 

#693 2010-06-18 11:03:01

TheGameMaster1231
Scratcher
Registered: 2009-07-24
Posts: 1000+

Re: Cool custom blocks in Scratch

LS97 wrote:

Joeman592 wrote:

those still wouldnt get what i want. i want a code for pick random 1 or 10 not a thing that gives you 10 20 30 40 50 or something else! PLEASE!

then do [blocks]
<if><( <pick random( 1 )to( 2 )) <=> 1 )>
<set{ whatever }to( 1 >
<else>
<set{ whatever }to( 10 >

Nobody Thought Of That Before? ROFLOL!  lol

Last edited by TheGameMaster1231 (2010-06-18 11:03:35)

Offline

 

#694 2010-06-18 11:03:04

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Zorbak42 wrote:

I think you mean this example above will give you either 10, 20, 30, 40, 50.

yep. typo. fixed

Offline

 

#695 2010-06-18 12:11:21

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Cool custom blocks in Scratch

TheGameMaster1231 wrote:

LS97 wrote:

Joeman592 wrote:

those still wouldnt get what i want. i want a code for pick random 1 or 10 not a thing that gives you 10 20 30 40 50 or something else! PLEASE!

then do [blocks]
<if><( <pick random( 1 )to( 2 )) <=> 1 )>
<set{ whatever }to( 1 >
<else>
<set{ whatever }to( 10 >

Nobody Thought Of That Before? ROFLOL!  lol

[/blocks]Well, you could use

[blocks]((   <pick random( 0 )to( 1 <*> 10 ))[/blocks]

sorry, that doesn't look right when I post it..

< < pick random ( 0 ) to ( 1 ) > * <10> >

Last edited by nXIII (2010-06-18 12:12:31)


nXIII

Offline

 

#696 2010-06-18 12:31:02

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

your pick random 1 to 0 set var to this is not what i want. you wouldn't get the same hting with 1 to 10, i want 1 OR 10, which gets you the answer of 1 IOR 10, to just 2 numbers next to each other. PLEASE UNDERSTAND!


EDIT: Wow, looking back at this today makes me realize that what you did is genius.

Last edited by Joeman592 (2011-05-24 23:14:10)


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#697 2010-06-18 12:45:41

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

if what you want to get as an answer is
'1'
or
'10'
then my method is perfect.
if what you want to get is
'1, 10'
or
'10, 1'
then just change the set variable to whatever it has to be.
if it's neither of these, explain youself better!

Offline

 

#698 2010-06-18 16:36:16

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Cool custom blocks in Scratch

Joeman592 wrote:

your pick random 1 to 0 set var to this is not what i want. you wouldn't get the same hting with 1 to 10, i want 1 OR 10, which gets you the answer of 1 IOR 10, to just 2 numbers next to each other. PLEASE UNDERSTAND!

Let me show you my evaluation of my example:

(pick random 0 to 1) -> 1 or 0

(answer * 10) -> 10 or 0.

If you want 1 or 10, just use

(((pick random 0 to 1) * 9) + 1)

the general algorithm would be

(((pick random 0 to 1) * (difference between two numbers)) + (smaller number))


nXIII

Offline

 

#699 2010-06-18 19:09:38

Joeman592
Scratcher
Registered: 2010-01-23
Posts: 100+

Re: Cool custom blocks in Scratch

ok...i get it now...thanks nXIII and LS97


http://i.imgur.com/HcAj1.png
http://i.imgur.com/gss7S.gifhttp://i.imgur.com/kbcKt.gifhttp://i.imgur.com/0LteM.gif

Offline

 

#700 2010-06-19 04:27:54

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Cool custom blocks in Scratch

Joeman592 wrote:

ok...i get it now...thanks nXIII and LS97

no problem! happy to help!

Offline

 

Board footer