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:
time$
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)
Treat others the way you want to be treated!
Offline
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).
Offline
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:
('Time' r Time)?
Thanks for all the help!!
Treat others the way you want to be treated!
Offline
Oh, and I want to try something. Can you tell me where to fing the "save" code in the browser?!
Thanks again!!
Treat others the way you want to be treated!
Offline
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...
Offline
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
Offline
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"
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 mouseUpor a message to pop up:
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...
Offline
Offline
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
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.
Treat others the way you want to be treated!
Offline
Some of the comands in HyperTalk look just like the ones in Basic.
Here is a pop-up prompt:
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
endThe "upper$( )" comand makes the input (responce$) all capitalized so that capitalization isn't a problem.
Treat others the way you want to be treated!
Offline
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...
Offline
i like it but every time i put a % (number) in any block, it says:
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?
Offline
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)>>addlabelThere 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:
The http://gamma.scratch.mit.edu/ is not Scratch Mit Edu!
Offline
What is MYOB? that is make your own bag!
Offline
this is in net scratch already!
Last edited by dav09 (2009-11-20 13:22:54)
Offline
Where is Scratch 1.5?
Offline
tomorrow its gona be 1 year since 1.3 i think
Offline
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.
Offline
rdococ wrote:
Where is Scratch 1.5?
oh dear I think you are lost
Offline
Offline
3 = 3 #ifTrue [self inform 'Good job!'] #ifElse [self inform 'Not correct]
Offline