This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » how to make the (if <> then [] else []) and <if <> then <> else <>>..

#1 2010-08-04 11:31:13

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

how to make the (if <> then [] else []) and <if <> then <> else <>>..

... blocks. any way, start up the scratch source code or just open scratch and shift-click the R in the scratch logo, then, click the gray space in the corner, then press "open..." then "browser", then, in the window that comes up, click "scratch-objects" then "scriptableScratchMorph", now, delete all of the text in the box at the bottom of the window, and type

Code:

if: t1 then: t2 else: t3

and then right click and press "accept", then, under the text, type

Code:

    t1 ifTrue: [^ t2].
    ^ t3

then, right click and press accept, then click the button that says "scriptableScratchMorph" and then press class then click "Block specs" (if your using a mac, then click "scratch") and then block-specs in the next box to the right, now, find where it says "('not %b' #b #not)" and to the right of that type

Code:

('if %b then %s else %s' #r #if:then:else:) ('if %b then %b else %b' #b #if:then:else:)

then right click and press "accept" and then exit the window and turn the full screen off, and then save the image, and scratch should close, then open it back up and now you have the blocks!
EDIT: okay, I fixed the bug.

Last edited by gabe3 (2010-08-05 00:20:45)

Offline

 

#2 2010-08-04 16:45:01

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

I believe you mean:

Code:

t1 ifTrue: [^ t2].
    ^ t3

With what you had, it would report t2 if t1 was false, and and true if it was true!


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#3 2010-08-05 00:25:11

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

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

Oh, that was a typo, thanks! I did it right on my PC, but I made a typo in the form!

Offline

 

#4 2010-08-05 11:49:37

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

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

that's a pretty easy code.
it can also be easily scripted using normal scratch blocks...

but it's still good to have (in fact, bingo has it too)

Offline

 

#5 2010-09-14 14:24:04

rawleybrick
Scratcher
Registered: 2010-07-02
Posts: 2

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

this is not an easy way to create a Scratch block this is a hard way to create a Scratch block<say[

Offline

 

#6 2010-09-14 15:08:55

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

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

rawleybrick wrote:

this is not an easy way to create a Scratch block this is a hard way to create a Scratch block<say[

YouFail.


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

Offline

 

#7 2011-01-10 18:52:47

-Stendika-
Scratcher
Registered: 2009-11-12
Posts: 74

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

It doesn't work...


http://i1336.photobucket.com/albums/o660/Stendika/gbanner1_zpsd0178027.png
My latest games can be found here. Please view and give feedback!

Offline

 

#8 2011-01-11 08:48:22

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

i would suggest having it in:
Scratch-Objects --> ScriptableScratchMorph --- instance --> string ops --> [any of them]

Offline

 

#9 2011-07-08 16:38:34

MountainBoy
Scratcher
Registered: 2010-07-25
Posts: 34

Re: how to make the (if <> then [] else []) and <if <> then <> else <>>..

http://scratch.mit.edu/forums/viewtopic.php?pid=487363#req_message[image] boom! to hard

Offline

 
  • Index
  •  » Advanced Topics
  •  » how to make the (if <> then [] else []) and <if <> then <> else <>>..

Board footer