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

#1 2010-09-11 15:34:02

gabe3
Scratcher
Registered: 2009-08-19
Posts: 23

how to make the (nagative ()) block

1. shift click the R in the scratch logo and click "turn fill screen off" or use the scratch source code and click "file" then "turn fill screen off",
2. click the gray area in the bottom-left corner, a menu that says "World" should come up, (if not, repeat this step, if you continue to get this delay, exit scratch, when it says "Save Changes?", press no, then restart scratch and continue from step 1.) anyway, click "open" then "browser", (if the Browser does not come up, refer to the debug help in step 2 part a.),
3. Click "scratch-objects" then "instance" then "scriptable-scratch-morph" then "Other-Ops", from there, click the box at the bottom of the window (not the scratch window, the browser window) (the one with text in it) and erase the text in it, then type:

Code:

negative: t1

then click right click (cmd+click on mac) and press accept or just press ctrl+a (cmd+click on mac)
4. in the same box, under the "nagative: t1" text, type:

Code:

    ^ 0 - t1 abs

and then click right click (cmd+click on mac) and press accept or just press ctrl+a (cmd+click on mac)
5. click "scriptable-scratch-morph" (yes, "scriptable-scratch-morph") and then "class"
6. then click "block-specs" and then "block-specs" (the one that just popped up) and scroll down to where it says "('not %b' #b #not)" and right next to it type:

Code:

#- ('negative %n' #r #negative: 10)

then click right click (cmd+click on mac) and press accept or just press ctrl+a (cmd+click on mac) and exit the browser, then shift click the R in the scratch logo and click "turn fill screen on" or (if your using the scratch source code) click "file" then "turn fill screen on" then shift click the R in the scratch logo and click "save image screen for end-user" then click "accept" in the window that comes up, or (if your using the scratch source code) click "file" then "save image screen for end-user", after that, scratch should close, if not, wait until it does, then open scratch back up and now you have the block!

Offline

 

#2 2010-09-11 15:40:01

developdood
Scratcher
Registered: 2009-04-16
Posts: 63

Re: how to make the (nagative ()) block

shouldn't it be just ^ 0 - t1? Isn't the block for inverting a number? and if it is then it is easier to use the (( ) - ( )) block and if it isn't then it doesn't seem very useful and could easily be done with the ([abs] of ( )) block. Just using the abs block would be much more useful aswell.


Have a look at some of my games. I made a cool physics game called "Physics Marble Cannon" which is really cool. I let anyone remix any of my projects without permission or credit necessary.

Offline

 

#3 2010-09-11 15:49:50

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: how to make the (nagative ()) block

Smalltalk already has a method to negate numbers, so this works better:

Code:

 #- ('%n negated' #r #negative: 10)

Code:

negative: anInteger

^ anInteger negated.

http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#4 2010-09-11 16:15:01

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

Re: how to make the (nagative ()) block

No I think its good, a nagative block at last!


You can now reach me on Twitter @johnnydean1_

Offline

 

#5 2010-09-12 01:15:21

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: how to make the (nagative ()) block

You so stole my block. Lol.
Its

Code:

Negative of: aNumber
^ 0 - aNumber

NO ABS.  tongue   tongue   tongue   tongue

Last edited by bbbeb (2010-09-12 01:15:50)


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#6 2010-09-12 03:44:38

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: how to make the (nagative ()) block

bbbeb wrote:

NO ABS.

LOL. anyways.

does this work?
('%n negated' r negated 2)
because it should. only block spec. try it and tell me...

edit never mind it doesnt you need the method.

Last edited by LS97 (2010-09-12 03:45:57)

Offline

 

#7 2010-09-12 06:46:10

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: how to make the (nagative ()) block

In fact, whenever you have this:

('do something to %n' #r #whatever: 3)

whatever: t1
^ t1 affected

you can more simply do:

('do something to %n' #r #affected 3)


/* No comment */

Offline

 

#8 2010-09-12 11:00:19

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

Re: how to make the (nagative ()) block

TheSuccessor wrote:

In fact, whenever you have this:

('do something to %n' #r #whatever: 3)

whatever: t1
^ t1 affected

you can more simply do:

('do something to %n' #r #affected 3)

Naw....
That would try to perform a zero-argument method (which doesn't exist) of ScriptableScratchMorph (or a subclass) with one argument. Not good.


nXIII

Offline

 

#9 2010-09-12 13:14:17

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: how to make the (nagative ()) block

Well, it worked for me...


/* No comment */

Offline

 

#10 2010-09-12 13:34:42

NewlandBB
Scratcher
Registered: 2010-01-25
Posts: 43

Re: how to make the (nagative ()) block

This can be achieved WITHOUT hacking scratch, but I can't be bothered to type how unless someone messages me specifically.


For Scratch Related Content, including tutorials for help with Scratch & My opinion of the Scratch 2.0 Alpha , check out my Youtube Channel!
Username: iAmNewlandBB

Offline

 

#11 2010-09-12 13:47:35

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: how to make the (nagative ()) block

NewlandBB wrote:

This can be achieved WITHOUT hacking scratch, but I can't be bothered to type how unless someone messages me specifically.

No duh.
(0-(number))


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#12 2010-09-12 13:49:32

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: how to make the (nagative ()) block

LS97 wrote:

bbbeb wrote:

NO ABS.

LOL. anyways.

does this work?
('%n negated' r negated 2)
because it should. only block spec. try it and tell me...

edit never mind it doesnt you need the method.

Nothing works without a method. Its as though i did this:
('broadcast %e with arg %s'                           -      broadcast:withArg:)
Lol.


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

#13 2010-09-12 14:15:20

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

Re: how to make the (nagative ()) block

bbbeb wrote:

('broadcast %e with arg %s'                           -      broadcast:withArg:)

Whats that even do


You can now reach me on Twitter @johnnydean1_

Offline

 

#14 2010-09-13 13:49:50

TheSuccessor
Scratcher
Registered: 2010-04-23
Posts: 1000+

Re: how to make the (nagative ()) block

Sometimes the method is already there for you.


/* No comment */

Offline

 

#15 2010-09-13 13:53:22

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: how to make the (nagative ()) block

TheSuccessor wrote:

Sometimes the method is already there for you.

or it works if it's the sprite you're referring to (or if there's a special case in the execution wath's-it-called)

Offline

 

#16 2010-09-13 19:25:00

bbbeb
Scratcher
Registered: 2009-06-11
Posts: 1000+

Re: how to make the (nagative ()) block

johnnydean1 wrote:

bbbeb wrote:

('broadcast %e with arg %s'                           -      broadcast:withArg:)

Whats that even do

Examples. Ever heard of em?

And the block is useless.  tongue


Back in my day.... there were no laws that censored the internet... now, there are.... nah.

Offline

 

Board footer