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

#1 2010-03-10 16:19:54

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Post Your Block Coding Here!

Post coding for blocks and where the programming goes here!


http://i46.tinypic.com/dw7zft.png

Offline

 

#2 2010-03-11 08:16:09

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Post Your Block Coding Here!

Bump


http://i46.tinypic.com/dw7zft.png

Offline

 

#3 2010-03-11 18:11:19

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Post Your Block Coding Here!

What does that mean?


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#4 2010-03-11 19:14:51

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: Post Your Block Coding Here!

Coding for source code, such as the clone block.


http://i46.tinypic.com/dw7zft.png

Offline

 

#5 2010-03-11 20:40:28

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Post Your Block Coding Here!

Okay, the clone block:

Code:

('clone this sprite' #- #duplicateNoAttach)
('delete this sprite' #- #undoableDeleteSprite)

I'll bring more in later


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#6 2010-03-11 21:56:44

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: Post Your Block Coding Here!

('distance from x: %n y: %n to x: %n y: %n' #r #dista:n:c:e:)

dista: t1 n: t2 c: t3 e: t4
    | t5 t6 t7 t8 t9 t10 |
    t5 _ t1 - t3.
    t6 _ t5 * t5.
    t7 _ t2 - t4.
    t8 _ t7 * t7.
    t9 _ t8 + t6.
    t10 _ t9 sqrt.
    ^ t10

Last edited by climber59 (2010-03-22 15:11:06)


Check out my projects if you have a chance.

Offline

 

#7 2010-03-22 07:43:06

rocket101
Scratcher
Registered: 2009-08-21
Posts: 500+

Re: Post Your Block Coding Here!

Nice blocks, cds56!

Offline

 

#8 2010-03-22 12:17:34

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

Re: Post Your Block Coding Here!

Show/Hide List Blocks (I made them)


nXIII

Offline

 

#9 2010-03-22 14:56:00

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Post Your Block Coding Here!

rocket101 wrote:

Nice blocks, cds56!

thanks, but I will take no credit for them. I only implemented them.


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#10 2010-03-22 18:10:12

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: Post Your Block Coding Here!

Here's the code I used to get a time/date block into streak:
First, add this to scratchSpriteMorph class:

Code:

('date/time:%t' #r #returnW:)

Under scratch-blocks > commandBlockMorph > private > uncoloredArgMorphFor:, add:

Code:

    $t = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #timeDates;
         choice: 'time'].

Under scriptableScratchMorph > sensing ops, add this:

Code:

timeDates
    ^ #('time' 'hour' 'minute' 'second' 'date' 'day of month' 'day of year' 'weekday-name' 'weekday-#' 'month-name' 'month-#' 'year' )

Finally, under scriptableScratchMorph > sensing ops add this function:

Code:

returnW: t1 
    | time date |
    time _ Time now.
    date _ Date today.
    'time' = t1 ifTrue: [^ time].
    'hour' = t1 ifTrue: [^ time hours].
    'minute' = t1 ifTrue: [^ time minutes].
    'second' = t1 ifTrue: [^ time seconds].
    'date' = t1 ifTrue: [^ date].
    'weekday-name' = t1 ifTrue: [^ date weekday].
    'weekday-#' = t1
        ifTrue: 
            [date weekday = 'Monday' ifTrue: [^ 1].
            date weekday = 'Tuesday' ifTrue: [^ 2].
            date weekday = 'Wednesday' ifTrue: [^ 3].
            date weekday = 'Thursday' ifTrue: [^ 4].
            date weekday = 'Friday' ifTrue: [^ 5].
            date weekday = 'Saturday' ifTrue: [^ 6].
            date weekday = 'Sunday' ifTrue: [^ 7]].
    'month-name' = t1 ifTrue: [^ date monthName].
    'month-#' = t1 ifTrue: [^ date monthIndex].
    'day of month' = t1 ifTrue: [^ date dayOfMonth].
    'day of year' = t1 ifTrue: [^ date daysInYear - date daysLeftInYear].
    'year' = t1 ifTrue: [^ date year].
    ^ 0

After all of this, you should have a shiny new date/time block!
Just be glad that I made the code; you just have to copy it!

You can also see these projects of mine to get two more:
[open Browser with URL []]
(if<>then[]else[]).

Last edited by billyedward (2010-03-22 18:12:56)


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#11 2010-03-23 15:49:47

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

Re: Post Your Block Coding Here!

That's a great block, billyedward! I learned a lot from that!  smile


nXIII

Offline

 

#12 2010-03-23 16:13:33

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: Post Your Block Coding Here!

Somebody please post an image with all of these  tongue


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#13 2010-03-24 08:02:05

rocket101
Scratcher
Registered: 2009-08-21
Posts: 500+

Re: Post Your Block Coding Here!

billyedward wrote:

Here's the code I used to get a time/date block into streak:
First, add this to scratchSpriteMorph class:

Code:

('date/time:%t' #r #returnW:)

Under scratch-blocks > commandBlockMorph > private > uncoloredArgMorphFor:, add:

Code:

    $t = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #timeDates;
         choice: 'time'].

Under scriptableScratchMorph > sensing ops, add this:

Code:

timeDates
    ^ #('time' 'hour' 'minute' 'second' 'date' 'day of month' 'day of year' 'weekday-name' 'weekday-#' 'month-name' 'month-#' 'year' )

Finally, under scriptableScratchMorph > sensing ops add this function:

Code:

returnW: t1 
    | time date |
    time _ Time now.
    date _ Date today.
    'time' = t1 ifTrue: [^ time].
    'hour' = t1 ifTrue: [^ time hours].
    'minute' = t1 ifTrue: [^ time minutes].
    'second' = t1 ifTrue: [^ time seconds].
    'date' = t1 ifTrue: [^ date].
    'weekday-name' = t1 ifTrue: [^ date weekday].
    'weekday-#' = t1
        ifTrue: 
            [date weekday = 'Monday' ifTrue: [^ 1].
            date weekday = 'Tuesday' ifTrue: [^ 2].
            date weekday = 'Wednesday' ifTrue: [^ 3].
            date weekday = 'Thursday' ifTrue: [^ 4].
            date weekday = 'Friday' ifTrue: [^ 5].
            date weekday = 'Saturday' ifTrue: [^ 6].
            date weekday = 'Sunday' ifTrue: [^ 7]].
    'month-name' = t1 ifTrue: [^ date monthName].
    'month-#' = t1 ifTrue: [^ date monthIndex].
    'day of month' = t1 ifTrue: [^ date dayOfMonth].
    'day of year' = t1 ifTrue: [^ date daysInYear - date daysLeftInYear].
    'year' = t1 ifTrue: [^ date year].
    ^ 0

After all of this, you should have a shiny new date/time block!
Just be glad that I made the code; you just have to copy it!

You can also see these projects of mine to get two more:
[open Browser with URL []]
(if<>then[]else[]).

Can you please post screen shots?

Offline

 

#14 2010-03-28 15:25:32

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

Re: Post Your Block Coding Here!

For The <hidden?> Block, Go To Scratch-Objects Then ScratchSpriteMorph Then Blockspecs Then Blockspecs Again. Now Just Before Sensing, Type:

Code:

('hidden?' #b #isHidden)

And Then Press Alt+s And You Should Now Have The <hidden?> Block Under The Looks Section!  big_smile

Offline

 

#15 2010-03-28 18:01:06

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: Post Your Block Coding Here!

Thanks, billyedward, that time block could be helpful for making passwords/ encrypting stuff.
Thanks gamemaster, i've added your block to my mod.

big_smile


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

#16 2010-03-29 08:24:00

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

Re: Post Your Block Coding Here!

No Problem. I Appriciate Your Thanks.  big_smile

Last edited by TheGameMaster1231 (2010-03-29 08:24:26)

Offline

 

#17 2010-04-04 15:50:40

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Post Your Block Coding Here!

bump


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#18 2010-04-08 15:53:00

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

Re: Post Your Block Coding Here!

bump  smile


You can now reach me on Twitter @johnnydean1_

Offline

 

#19 2010-04-08 16:10:02

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

Re: Post Your Block Coding Here!

lol try using the delete block on the stage  big_smile


You can now reach me on Twitter @johnnydean1_

Offline

 

#20 2010-04-08 16:26:33

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: Post Your Block Coding Here!

johnnydean1 wrote:

lol try using the delete block on the stage  big_smile

WHOA!


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#21 2010-04-09 15:10:18

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

Re: Post Your Block Coding Here!

johnnydean1 wrote:

lol try using the delete block on the stage  big_smile

If You Did That, You Have Just Gotton Pwnzed. XD

Offline

 

#22 2010-04-10 07:47:37

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

Re: Post Your Block Coding Here!

bump


You can now reach me on Twitter @johnnydean1_

Offline

 

#23 2010-04-12 20:32:40

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: Post Your Block Coding Here!

billyedward wrote:

Here's the code I used to get a time/date block into streak:
First, add this to scratchSpriteMorph class:

Code:

('date/time:%t' #r #returnW:)

Under scratch-blocks > commandBlockMorph > private > uncoloredArgMorphFor:, add:

Code:

    $t = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #timeDates;
         choice: 'time'].

Under scriptableScratchMorph > sensing ops, add this:

Code:

timeDates
    ^ #('time' 'hour' 'minute' 'second' 'date' 'day of month' 'day of year' 'weekday-name' 'weekday-#' 'month-name' 'month-#' 'year' )

Finally, under scriptableScratchMorph > sensing ops add this function:

Code:

returnW: t1 
    | time date |
    time _ Time now.
    date _ Date today.
    'time' = t1 ifTrue: [^ time].
    'hour' = t1 ifTrue: [^ time hours].
    'minute' = t1 ifTrue: [^ time minutes].
    'second' = t1 ifTrue: [^ time seconds].
    'date' = t1 ifTrue: [^ date].
    'weekday-name' = t1 ifTrue: [^ date weekday].
    'weekday-#' = t1
        ifTrue: 
            [date weekday = 'Monday' ifTrue: [^ 1].
            date weekday = 'Tuesday' ifTrue: [^ 2].
            date weekday = 'Wednesday' ifTrue: [^ 3].
            date weekday = 'Thursday' ifTrue: [^ 4].
            date weekday = 'Friday' ifTrue: [^ 5].
            date weekday = 'Saturday' ifTrue: [^ 6].
            date weekday = 'Sunday' ifTrue: [^ 7]].
    'month-name' = t1 ifTrue: [^ date monthName].
    'month-#' = t1 ifTrue: [^ date monthIndex].
    'day of month' = t1 ifTrue: [^ date dayOfMonth].
    'day of year' = t1 ifTrue: [^ date daysInYear - date daysLeftInYear].
    'year' = t1 ifTrue: [^ date year].
    ^ 0

After all of this, you should have a shiny new date/time block!
Just be glad that I made the code; you just have to copy it!

You can also see these projects of mine to get two more:
[open Browser with URL []]
(if<>then[]else[]).

doesn't work


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#24 2010-04-13 16:58:24

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

Re: Post Your Block Coding Here!

midnightleopard wrote:

billyedward wrote:

Here's the code I used to get a time/date block into streak:
First, add this to scratchSpriteMorph class:

Code:

('date/time:%t' #r #returnW:)

Under scratch-blocks > commandBlockMorph > private > uncoloredArgMorphFor:, add:

Code:

    $t = t2 ifTrue: [^ ChoiceArgMorph new getOptionsSelector: #timeDates;
         choice: 'time'].

Under scriptableScratchMorph > sensing ops, add this:

Code:

timeDates
    ^ #('time' 'hour' 'minute' 'second' 'date' 'day of month' 'day of year' 'weekday-name' 'weekday-#' 'month-name' 'month-#' 'year' )

Finally, under scriptableScratchMorph > sensing ops add this function:

Code:

returnW: t1 
    | time date |
    time _ Time now.
    date _ Date today.
    'time' = t1 ifTrue: [^ time].
    'hour' = t1 ifTrue: [^ time hours].
    'minute' = t1 ifTrue: [^ time minutes].
    'second' = t1 ifTrue: [^ time seconds].
    'date' = t1 ifTrue: [^ date].
    'weekday-name' = t1 ifTrue: [^ date weekday].
    'weekday-#' = t1
        ifTrue: 
            [date weekday = 'Monday' ifTrue: [^ 1].
            date weekday = 'Tuesday' ifTrue: [^ 2].
            date weekday = 'Wednesday' ifTrue: [^ 3].
            date weekday = 'Thursday' ifTrue: [^ 4].
            date weekday = 'Friday' ifTrue: [^ 5].
            date weekday = 'Saturday' ifTrue: [^ 6].
            date weekday = 'Sunday' ifTrue: [^ 7]].
    'month-name' = t1 ifTrue: [^ date monthName].
    'month-#' = t1 ifTrue: [^ date monthIndex].
    'day of month' = t1 ifTrue: [^ date dayOfMonth].
    'day of year' = t1 ifTrue: [^ date daysInYear - date daysLeftInYear].
    'year' = t1 ifTrue: [^ date year].
    ^ 0

After all of this, you should have a shiny new date/time block!
Just be glad that I made the code; you just have to copy it!

You can also see these projects of mine to get two more:
[open Browser with URL []]
(if<>then[]else[]).

doesn't work

It Does Work. You Have Simply Made A Mistake. You Can Just Copy And Paste It You Know.  hmm

Offline

 

Board footer