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

#126 2010-05-01 08:57:08

Superspeed76
Scratcher
Registered: 2008-03-24
Posts: 11

Re: ITopic: Cool Source code tricks...

meew0 wrote:

Click in the white area to open the world menu  smile

Superspeed76 wrote:

Where in the white area? Which white area? I still can't find the world menu! I'm stopped from this "Legalized Hack" like a [blocks] <stop all> [/blocks] block!!! Please get more in depth!

Offline

 

#127 2010-05-01 08:58:36

markyparky56
Scratcher
Registered: 2008-03-20
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Superspeed76 wrote:

meew0 wrote:

Click in the white area to open the world menu  smile

Superspeed76 wrote:

Where in the white area? Which white area? I still can't find the world menu! I'm stopped from this "Legalized Hack" like a [blocks] <stop all> [/blocks] block!!! Please get more in depth!

Shift click on the curve in the 'R' in the scratch logo, click turn full screen off, then click on the white space that appears.


http://j.mp/jgVnTq
Check out my game engine development site: NewDawn I'm a Level 171 Scratcher.I am http://bit.ly/nkvLNT

Offline

 

#128 2010-05-01 09:01:37

Superspeed76
Scratcher
Registered: 2008-03-24
Posts: 11

Re: ITopic: Cool Source code tricks...

markyparky56 wrote:

Superspeed76 wrote:

meew0 wrote:

Click in the white area to open the world menu  smile

Superspeed76 wrote:

Where in the white area? Which white area? I still can't find the world menu! I'm stopped from this "Legalized Hack" like a [blocks] <stop all> [/blocks] block!!! Please get more in depth!

Shift click on the curve in the 'R' in the scratch logo, click turn full screen off, then click on the white space that appears.

Superspeed76 wrote:

2 things, 1 I did that already, and 2 my problems won't be so bad anymore- I just found it!  smile   smile   smile

Offline

 

#129 2010-05-07 20:18:31

celloguy123
Scratcher
Registered: 2009-01-15
Posts: 100+

Re: ITopic: Cool Source code tricks...

nXIII wrote:

markyparky56 wrote:

Could you please tell me how to get other keys into the keypressed boolean block, itd really like to be able to use other keys other than the ones we have already.

Okay, let's get started: the FULL key pressed block tutorial:
First, let's see which keys we want to include:
Note: Some of these only apply to windows OS's.

Keys and Their ASCII
shift : 16
control (ctrl) : 17
alt : 18
enter : 13
backspace : 8
num lock : 144*
caps lock : 20
scroll lock : 145*
pause break : 3*
print screen : 44*
delete (del) : 46*
insert (ins) : 45*
home : 36*
end : 35*
page up : 33*
page down : 34*
left windows : 91
right window : 92
Function keys : 112-123**
Escape : 27
* I have tested these and they do not work due to them being harvested by other processes; the sensor does not receive them.
** f2 returns false until pressed but does not return false after that point. I have chosen not to include it.

OK, on to the code editing:
You need to modify the method called asciiFor: in ScriptableScratchMorph's category sensing ops. Add the following lines before ^ -1:

'shift' = t1 ifTrue: [^ 16].
    'control' = t1 ifTrue: [^ 17].
    'alt' = t1 ifTrue: [^ 18].
    'backspace' = t1 ifTrue: [^ 8].
    'caps lock' = t1 ifTrue: [^ 20].
    'left windows' = t1 ifTrue: [^ 91].
    'right windows' = t1 ifTrue: [^ 92].
    'f1' = t1 ifTrue: [^ 112].
    'f3' = t1 ifTrue: [^ 114].
    'f4' = t1 ifTrue: [^ 115].
    'f5' = t1 ifTrue: [^ 116].
    'f6' = t1 ifTrue: [^ 117].
    'f7' = t1 ifTrue: [^ 118].
    'f8' = t1 ifTrue: [^ 119].
    'f9' = t1 ifTrue: [^ 120].
    'f10' = t1 ifTrue: [^ 121].
    'f11' = t1 ifTrue: [^ 122].
    'f12' = t1 ifTrue: [^ 123].
    'escape' = t1 ifTrue: [^ 27].

Press Alt + s. This saves the changes.

Next, modify the method keyNames. Add the following after 'space':

'shift' 'control' 'alt' 'backspace' 'caps lock' 'left windows' 'right windows' 'f1' 'f3' 'f4' 'f5' 'f6' 'f7' 'f8' 'f9' 'f10' 'f11' 'f12' 'escape'

Press Alt + s.

Important Note: You must shift-click the R in the Scratch logo and select save image for end-user to save these changes so they stay in effect next time you use Scratch. Select yes when asked, then reopen Scratch (it should close)

Thank you.  smile


http://internetometer.com/image/33068.png

Offline

 

#130 2010-05-07 23:57:29

poppyseeds
Scratcher
Registered: 2009-02-28
Posts: 24

Re: ITopic: Cool Source code tricks...

I know this is kinda dumb to ask since its useless now with the new ScratchCommentMorph, but what is the code for the comment block?


http://nyxscratch.webs.com/

Offline

 

#131 2010-05-22 08:33:39

colabcalub
Scratcher
Registered: 2010-04-22
Posts: 64

Re: ITopic: Cool Source code tricks...

Ohhhh! I am soooooooooo dumb! I tried making a block and deleted all the Control Blocks by accedent. Please tell me how to fix this!


http://i50.tinypic.com/x45f9j.png
Are you?

Offline

 

#132 2010-05-22 08:40:13

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Reinstall Scratch.  smile


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#133 2010-05-28 17:56:59

waveOSBeta
Scratcher
Registered: 2009-12-08
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Are all of these in Streak?


http://internetometer.com/image/10202.png]
New signature coming soon!  smile

Offline

 

#134 2010-05-29 02:08:29

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: ITopic: Cool Source code tricks...

waveOSBeta wrote:

Are all of these in Streak?

Just try out. http://streak.t35.com/


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#135 2010-05-30 12:54:46

HumanLight
Scratcher
Registered: 2009-09-20
Posts: 44

Re: ITopic: Cool Source code tricks...

whats the blank gray screen on squeak?


HumanLight
BRIEF NEWS: I am back from holiday! Now all of the Request Shops etc are open for business! The weekly newspaper shall come out tomorrow. Sorry it was a bit late, it's because I ended up having an extra 3 days of holiday!  smile

Offline

 

#136 2010-05-30 14:09:50

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: ITopic: Cool Source code tricks...

It's the space that shows up when you turn fillscreen off.


Check out my projects if you have a chance.

Offline

 

#137 2010-05-30 21:43:46

bizzib
Scratcher
Registered: 2010-03-10
Posts: 14

Re: ITopic: Cool Source code tricks...

hmm

Offline

 

#138 2010-05-30 23:26:56

kittenizator
Scratcher
Registered: 2010-01-13
Posts: 18

Re: ITopic: Cool Source code tricks...

How to make block like forever(with command inserter)?

Offline

 

#139 2010-05-31 06:47:09

da123
Scratcher
Registered: 2010-01-15
Posts: 35

Re: ITopic: Cool Source code tricks...

Wow. This is some great information!

I'll be using this!

Offline

 

#140 2010-06-02 08:09:37

EmperorEvil
Scratcher
Registered: 2009-02-13
Posts: 1000+

Re: ITopic: Cool Source code tricks...

Epic! I mod scratch all the time now!


http://oi54.tinypic.com/t8ogle.jpg http://blocks.scratchr.org/API.php?user=veggieman001&amp;action=onlineStatus

Offline

 

#141 2010-06-22 19:34:15

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

Re: ITopic: Cool Source code tricks...

colabcalub wrote:

Ohhhh! I am soooooooooo dumb! I tried making a block and deleted all the Control Blocks by accedent. Please tell me how to fix this!

Replace your scriptableScratchMorph blockspecs with this:

Code:

blockSpecs
    | t1 |
    t1 _ #('control' ('when %m clicked' #S #-) ('when %k key pressed' #K #-) ('when %m clicked' #M #-) #- ('wait %n secs' #t #wait:elapsed:from: 1) #- ('forever' #c #doForever) ('repeat %n' #c #doRepeat 10) #- ('broadcast %e' #- #broadcast:) ('broadcast %e and wait' #s #doBroadcastAndWait) ('when I receive %e' #E #-) #- ('forever if %b' #c #doForeverIf) ('if %b' #c #doIf) ('if %b' #c #doIfElse) ('wait until %b' #s #doWaitUntil) ('repeat until %b' #c #doUntil) #- ('stop script' #s #doReturn) ('stop all' #- #stopAll) 'operators' ('%n + %n' #r #+ #- #-) ('%n - %n' #r #- #- #-) ('%n * %n' #r #* #- #-) ('%n / %n' #r #/ #- #-) #- ('pick random %n to %n' #r #randomFrom:to: 1 10) #- ('%s < %s' #b #< '' '') ('%s = %s' #b #= '' '') ('%s > %s' #b #> '' '') #- ('%b and %b' #b #&) ('%b or %b' #b #|) ('not %b' #b #not) #- ('join %s %s' #r #concatenate:with: 'hello ' 'world') ('letter %n of %s' #r #letter:of: 1 'world') ('length of %s' #r #stringLength: 'world') #- ('%n mod %n' #r #\\ #- #-) ('round %n' #r #rounded #-) #- ('%f of %n' #r #computeFunction:of: 'sqrt' 10) 'sound' ('play sound %S' #- #playSound:) ('play sound %S until done' #s #doPlaySoundAndWait) ('stop all sounds' #- #stopAllSounds) #- ('play drum %D for %n beats' #t #drum:duration:elapsed:from: 48 0.2) ('rest for %n beats' #t #rest:elapsed:from: 0.2) #- ('play note %N for %n beats' #t #noteOn:duration:elapsed:from: 60 0.5) ('set instrument to %I' #- #midiInstrument: 1) #- ('change volume by %n' #- #changeVolumeBy: -10) ('set volume to %n%' #- #setVolumeTo: 100) ('volume' #r #volume) #- ('change tempo by %n' #- #changeTempoBy: 20) ('set tempo to %n bpm' #- #setTempoTo: 60) ('tempo' #r #tempo) 'motor' ('motor on for %n secs' #t #motorOnFor:elapsed:from: 1) ('motor on' #- #allMotorsOn) ('motor off' #- #allMotorsOff) ('motor power %n' #- #startMotorPower: 100) ('motor direction %W' #- #setMotorDirection: 'this way') 'variables' ('show variable %v' #- #showVariable:) ('hide variable %v' #- #hideVariable:) 'list' ('add %s to %L' #- #append:toList: 'thing') #- ('delete %y of %L' #- #deleteLine:ofList: 1) ('insert %s at %i of %L' #- #insert:at:ofList: 'thing' 1) ('replace item %i of %L with %s' #- #setLine:ofList:to: 1 'list' 'thing') #- ('item %i of %L' #r #getLine:ofList: 1) ('length of %L' #r #lineCountOfList:) ('%L contains %s' #b #list:contains: 'list' 'thing') ).
    ^ t1 , self obsoleteBlockSpecs

"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

 

#142 2010-06-22 19:35:51

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

Re: ITopic: Cool Source code tricks...

kittenizator wrote:

How to make block like forever(with command inserter)?

In the block spec, make the second symbol #c instead of #-.
Ie:
('A C-shaped block' #c #aCshapedBlock)


"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

 

#143 2010-06-25 12:33:17

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ITopic: Cool Source code tricks...

Do all those blocks in the picture actually work, and can you post the code for them? Also, what's the point of an

Code:

(()==())

block? It would be the same as

Code:

(()=())

.

Last edited by rubiks_cube_guy238 (2010-06-25 12:35:07)


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#144 2010-06-25 12:41:32

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: ITopic: Cool Source code tricks...

climber59 wrote:

How do I define variables in custom functions?

Well, here is the format for a function:

nameOfCommandWithInputsLike: t1 or: input1
     "comment about the function"

     | temporary variables for function |
actual code here


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#145 2010-06-25 12:55:09

climber59
Scratcher
Registered: 2009-12-15
Posts: 100+

Re: ITopic: Cool Source code tricks...

I asked that a long time ago and found the answer, and I was actually looking for how to type the side arrow.


Check out my projects if you have a chance.

Offline

 

#146 2010-07-14 16:43:35

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: ITopic: Cool Source code tricks...

I can't find the scratch class!  sad
I'm using the source codee of Scratch 1.4.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#147 2010-07-14 17:14:01

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: ITopic: Cool Source code tricks...

bobbybee wrote:

I can't find the scratch class!  sad
I'm using the source codee of Scratch 1.4.

Here:
1: (if you already know how to open the browser, skip this step) Click on the grey space that appears when you turn fill screen off. Then click 'open' and then click 'browser'. Now you have your browser open.

2: In the upper left pane in the browser, click 'Scratch-Objects'. In the pane to the right of that, click ScriptableScratchMorph. On the bottom of that pane are two choices, class and instance. It will already be selected on instance, so click class. Now, in the next pane, click 'block specs' and in the pane after that, click 'blockSpecs.'

3: now you can edit blocks.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#148 2010-07-14 20:33:17

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: ITopic: Cool Source code tricks...

I can edit and save the blocks, but my changes don't appear when I right-click, open, Scratch.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#149 2010-07-22 21:09:07

blaizer3
New Scratcher
Registered: 2010-07-22
Posts: 6

Re: ITopic: Cool Source code tricks...

OK, How can I make it a MMORPG, like club penguin or runescape?

Offline

 

#150 2010-07-22 21:20:34

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: ITopic: Cool Source code tricks...

bobbybee wrote:

I can edit and save the blocks, but my changes don't appear when I right-click, open, Scratch.

You need to shift click the R in the Scratch logo and turn fill Screen on. Then shift click the R again and click save image for end user.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

Board footer