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

#1 2008-07-13 21:43:06

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Negate block

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:

Code:

('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!


All your base are belong to us

Offline

 

#2 2008-07-16 09:20:12

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

Jens, could you please help? You know the most about this...


All your base are belong to us

Offline

 

#3 2008-07-16 09:25:47

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

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.


All your base are belong to us

Offline

 

#4 2008-07-16 09:36:29

Lanie
Scratcher
Registered: 2008-02-03
Posts: 1000+

Re: Negate block

Oh lol i dunno, just forget i ever posted that

Offline

 

#5 2008-07-16 09:40:04

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

Lanie wrote:

Oh lol i dunno, just forget i ever posted that

Um, ok. Forgotten!


All your base are belong to us

Offline

 

#6 2008-07-16 09:41:36

Lanie
Scratcher
Registered: 2008-02-03
Posts: 1000+

Re: Negate block

rotfl

Offline

 

#7 2008-07-16 09:43:03

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

Lanie wrote:

rotfl

So, do you know how to make it work/no checkbox?


All your base are belong to us

Offline

 

#8 2008-07-16 09:44:11

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

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.


All your base are belong to us

Offline

 

#9 2008-07-16 09:44:51

Lanie
Scratcher
Registered: 2008-02-03
Posts: 1000+

Re: Negate block

Cyclone103 wrote:

Lanie wrote:

rotfl

So, do you know how to make it work/no checkbox?

Your asking the wrong person lol, im not good with things like that your better off personally asking Jens on one of his projects

Offline

 

#10 2008-07-16 09:45:29

Lanie
Scratcher
Registered: 2008-02-03
Posts: 1000+

Re: Negate block

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

 

#11 2008-07-16 09:48:16

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

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.


All your base are belong to us

Offline

 

#12 2008-07-16 09:52:27

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

Re: Negate block

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!


Jens Mönig

Offline

 

#13 2008-07-16 10:05:50

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Negate block

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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


All your base are belong to us

Offline

 

Board footer