I tried to make a "negate block" which would be the same as 0-______ but would be simpler to look at, and only have one empty slot. For this code, within the Source code, I created a new change set, clicked "ScriptableScratchMorph" for blocks in ALL of scratch, and made a new line in Numbers:
('Negate %n' r negate)but when I had filed out the changes and opened Scratch (within the source code) it had that little checkbox so I could look at the value as a watcher onscreen, which is not what I wanted. I ignored that, and tested my block. I got a walkback, which did not surprise me. I don't know what went wrong. I did not declare "negate" as a method since it was an existing one in Squeak. And by Squeak, I mean Squeak 3.10, not the one which Scratch was created. Is negate an existing method in this version? And how do I get rid of the checkmark?? Someone please help me!
Offline
Jens, could you please help? You know the most about this...
Offline
Lanie wrote:
I was told computers could only add with negative and positives
What do you mean? the negate block would turn a positive number negative, and a negative number positive.
Offline
Lanie wrote:
Oh lol i dunno, just forget i ever posted that
Um, ok. Forgotten!
Offline
Lanie wrote:
rotfl
So, do you know how to make it work/no checkbox?
Offline
I went to the local library to try and find Squeak By Example which is a book bout Squeak, but all I found was a book on Blender and one on Python.
Offline
Cyclone103 wrote:
I went to the local library to try and find Squeak By Example which is a book bout Squeak, but all I found was a book on Blender and one on Python.
I was trying to find some books like that 2 days go at my library but i couldnt
Offline
Lanie wrote:
Cyclone103 wrote:
I went to the local library to try and find Squeak By Example which is a book bout Squeak, but all I found was a book on Blender and one on Python.
I was trying to find some books like that 2 days go at my library but i couldnt
I think Squeak By Example is actually available as a PDF file, but I have not been able to find it.
Offline
Cyclone103 wrote:
Jens, could you please help? You know the most about this...
Some quick hints:
1. You need to implement a method for the intended receiver (i.e. ScriptableScratch Morph), it is going to need a number as an argument, something like: 'negate: aNumber'
2. By browsing class Number you'll find that the method you're looking for is called 'negated'. So in your ScriptableScratchMorph method called 'negate: aNumber' you'll code something like this: ^aNumber negated
The checkbox? Ah, I'm sure that'll be fun to find out...
Oh, btw: http://squeakbyexample.org
Cheers!
Offline
Jens wrote:
Cyclone103 wrote:
Jens, could you please help? You know the most about this...
Some quick hints:
1. You need to implement a method for the intended receiver (i.e. ScriptableScratch Morph), it is going to need a number as an argument, something like: 'negate: aNumber'
2. By browsing class Number you'll find that the method you're looking for is called 'negated'. So in your ScriptableScratchMorph method called 'negate: aNumber' you'll code something like this: ^aNumber negated
The checkbox? Ah, I'm sure that'll be fun to find out...
Oh, btw: http://squeakbyexample.org
Cheers!
Thanks so much Jens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Offline