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

#1 2008-05-26 17:54:33

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Time/Date

Ok, I have the scrach squeak code up and running, but I'm not that familer with small talk. I know Just-Basic* and tried to enter the date and time code:

Code:

time$

Code:

date$

But it didn't work. Is there a time and/or date code for small talk? Thanks!!

*Just-Basic: A simple programing language. http://www.justbasic.com/

Last edited by N-Wear (2008-05-26 18:03:28)


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#2 2008-05-26 18:22:19

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Time/Date

Jens is probably the one to answer this question...


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-05-27 01:21:53

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Time/Date

In the Squeak system browser category Kernel-Magnitudes you'll find classes Time and Date. Look at their protocol (their methods) to find out how they work (hint: it's much easier than in BASIC and you don't need the "$" because Smalltalk is not typed, instead you can send it a "asString" message).


Jens Mönig

Offline

 

#4 2008-05-27 19:00:27

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Time/Date

Jens wrote:

In the Squeak system browser category Kernel-Magnitudes you'll find classes Time and Date. Look at their protocol (their methods) to find out how they work (hint: it's much easier than in BASIC and you don't need the "$" because Smalltalk is not typed, instead you can send it a "asString" message).

Wait, can I find the Kernel-Magnitudes category in the scratch source browser?
And can I just type:

Code:

('Time'              r      Time)

?

Thanks for all the help!!


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#5 2008-05-27 19:04:10

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Time/Date

Oh, and I want to try something. Can you tell me where to fing the "save" code in the browser?!

Thanks again!!


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#6 2008-05-28 04:02:59

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Time/Date

Ah, now I guess I understand what you're trying to do. Looks like you would like to create a new block that reports the system time. The short answer is: No, this code will not work.

My advice would be to learn Smalltalk-80 first, and to get aquainted with the idea of classes, instances and messages/methods, as well as how Smalltalk code is organized in an "image" file which can be explored using various browsers, inspectors and other tools (browsers for senders/implementors of methods, change sorters, halts, the debugger, the system transcript, workspaces, class hierarchy browsers etc). I'd also like to encourage you to first create a couple of own programming projects in Squeak/Smalltalk, before trying to understand how Scratch works. Scratch, after all, is a very complex "world" of its own.

Back when I learned Smalltalk-80 some of the first things I tried were very simple hacks like:

a rolodex
create a new class for personal contact data with a minimal public protocol (accessor-methods), and play with it using the System-Transcript. Get aquainted with the Collections-hierarchy, especially with Sets, OrderedCollections and Dictionaries.

a counter
let the user increment/reset a simple counter, get aquainted with the mvc-concept and with the basics of building a morphic user interface. Try creating several different views on the same model (i.e. one graphical, another one text-based) which are each updated simultaneously whenever the model changes.

There are some other great suggestions how to learn Squeak/Smalltalk elsewhere in the forums, especially about a very good bank-account tutorial by John Maloney:

   http://static.squeak.org/tutorials/BankAccount.html

[edit:] I especially like this bank account tutorial because it uses a version of Squeak which is very similar to the one Scratch is implemented in. The newer versions of Squeak look rather different (although they do work the same way) [/edit].

Such basic experiments are not really hard to program, but they're far from being trivial either. The amazing thing is, that you'll probably at some point be hit by a flash of sudden understanding of what object oriented programming is all about. Afterwards you'll most likely be able to understand much of the Scratch Source Code by just getting a feeling of how to browse it. Then you'll also be able to find and grasp the "save" code, too.

Another favorite resource of mine are free books (!) about Squeak:

   http://stephane.ducasse.free.fr/FreeBooks.html

One last remark about Time:
You might want to start using the timer - blocks which are available in Scratch. The only drawback (or challange) is to come up with a mechanism to manually set it to the current system time whenever you start your project. I'd be very interested to see how you would accomplish this...


Jens Mönig

Offline

 

#7 2008-05-28 09:41:51

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

Re: Time/Date

Squeak has the weirdest syntax I've ever seen. I probably want to learn it, though.


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

Offline

 

#8 2008-05-28 09:54:00

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Time/Date

fullmoon wrote:

Squeak has the weirdest syntax I've ever seen.

True, Smalltalk-80 doesn't look like your conventional programming language, but it's
supposed to be closer to "plain natural English" than anything else.

Maybe they should've awarded Alan Kay the Pulitzer instead of the Turing  smile


Jens Mönig

Offline

 

#9 2008-05-28 10:18:50

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Time/Date

The language closest to "plain natural English" i have ever seen is HyperTalk, the language included  with hyperCard, some kind of programmable powerpoint/database/programming tool included on old macs.
some code straight out of the book "HyperTalk Beginner's Guide"

Code:

 
on mouseUp
 if the optionKey is down then
  go to card "index"
 else
  lock screen
  repeat with countvar = 1 to the number of cards
   go to card countVar
   if background field "artist" is not empty then
    put background field "artist" & "    " & background field "Title" & Return after indexVar
   end if
  end repeat
  go to card "index"
  put indexVar into card field "Entries"
  unlock screen
 end if
end mouseUp

or a message to pop up:

Code:

answer "Sort by what?" with "Category" or "Title" or "Artist"
if it is "category" or it is "title"
 answer "You have not selected Artist" with "OK" or "Cancel"
end if

This language is so "easy" that it is way to hard to understand without a book at your side the whole time...


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#10 2008-05-28 11:06:54

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Time/Date

Ah, HyperTalk, candygrammer with syntactic salt ...


Jens Mönig

Offline

 

#11 2008-05-28 15:53:11

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: Time/Date

Lol, I never heard of "candygrammer" or "syntactic salt" before. I used to love hypertalk, though. I believe the excellent game "Myst" was initially a hypertalk document.

Offline

 

#12 2008-05-28 16:51:01

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Time/Date

Jens wrote:

One last remark about Time:
You might want to start using the timer - blocks which are available in Scratch. The only drawback (or challange) is to come up with a mechanism to manually set it to the current system time whenever you start your project. I'd be very interested to see how you would accomplish this...

I've spent some time thinking about it, and so far the only way to do it with the scratch blocks that are already there is to have the program ask the user what the current time is.


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#13 2008-05-28 17:03:36

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Time/Date

Some of the comands in HyperTalk look just like the ones in Basic.
Here is a pop-up prompt:

Code:

prompt "Please enter your answer."; responce$
Answer = upper$(responce$)
if not (Answer = "Artist")
    notice "You did not select Artist!"
else
    notice "You selected Artist!"
end if
end

The "upper$(  )" comand makes the input (responce$) all capitalized so that capitalization isn't a problem.


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#14 2008-05-28 18:27:54

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Time/Date

chalkmarrow wrote:

I believe the excellent game "Myst" was initially a hypertalk document

really? I loved Myst! I gave up on computer games afterwards for fear of being attracted by them too much...

N-Wear wrote:

I've spent some time thinking about it, and so far the only way to do it with the scratch blocks that are already there is to have the program ask the user what the current time is.

Exactly! But I'm curious just how you would go about querying it from the user. Maybe WidgetFarmer could come up with something handy...


Jens Mönig

Offline

 

#15 2009-01-01 21:47:21

markyiscool
Scratcher
Registered: 2008-04-09
Posts: 100+

Re: Time/Date

i like it but every time i put a % (number) in any block, it says:

Code:

 subscript is out of bounds: 1 
Array (object)>>error:
Array (object)>>errorSubscriptBounds:
array(object)>>at:
Array (SequencableCollection)>>first
VariableBlockMorph(commandBlockMorph)>>addlabel

There is more but i hope you can easily reproduce the problem

P.S. Isnt BYOB like a copy of the program MYOB?


Wanted the Netherlands to win or want to re-experience Spain's victory? Do it withthis!
Projects not being loved, here's an idea!

Offline

 

#16 2009-11-20 12:50:03

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: Time/Date

markyiscool wrote:

i like it but every time i put a % (number) in any block, it says:

Code:

 subscript is out of bounds: 1 
Array (object)>>error:
Array (object)>>errorSubscriptBounds:
array(object)>>at:
Array (SequencableCollection)>>first
VariableBlockMorph(commandBlockMorph)>>addlabel

There is more but i hope you can easily reproduce the problem

P.S. Isnt BYOB like a copy of the program MYOB?

What about this funny code:

Code:

The http://gamma.scratch.mit.edu/ is not Scratch Mit Edu!

Offline

 

#18 2009-11-20 13:09:23

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Time/Date

this is in net scratch already!

Last edited by dav09 (2009-11-20 13:22:54)

Offline

 

#20 2009-11-20 13:23:27

dav09
Scratcher
Registered: 2009-03-25
Posts: 1000+

Re: Time/Date

tomorrow its gona be 1 year since 1.3 i think

Offline

 

#21 2009-11-20 20:31:35

illusionist
Retired Community Moderator
Registered: 2008-07-02
Posts: 1000+

Re: Time/Date

dav09 wrote:

tomorrow its gona be 1 year since 1.3 i think

Actually, Scratch 1.3 was released at the very end of August.  smile


http://i.imgur.com/8LX1NrV.png

Offline

 

#22 2009-11-20 21:10:27

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

Re: Time/Date

BASIC, a lovely languange, I find commodore basic to be quite entertaining to program in.
although, I'm concentrating on C++ and IA-32 at the moment.


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

Offline

 

#23 2009-11-20 21:48:27

songhead95
Scratcher
Registered: 2008-03-19
Posts: 100+

Re: Time/Date

rdococ wrote:

Where is Scratch 1.5?

oh dear I think you are lost

Offline

 

#24 2010-01-01 19:22:54

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

Re: Time/Date

Before Scratch, I used VB2008. It's very easy.

Offline

 

#25 2010-01-08 16:43:23

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

Re: Time/Date

3 = 3 #ifTrue [self inform 'Good job!'] #ifElse [self inform 'Not correct]

Offline

 

Board footer