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

#51 2010-03-07 15:41:31

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

Re: ITopic: Cool Source code tricks...

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)

Last edited by nXIII (2010-03-07 15:42:17)


nXIII

Offline

 

#52 2010-03-07 16:15:53

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

Re: ITopic: Cool Source code tricks...

Does this trick work on Scratch 1.4? My Scratch Browser doesn't have "Scratch" After "ScriptableScratchMorph". Keep in mind I have windows 7


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

Offline

 

#53 2010-03-07 17:32:25

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

Re: ITopic: Cool Source code tricks...

EmperorEvil wrote:

Does this trick work on Scratch 1.4? My Scratch Browser doesn't have "Scratch" After "ScriptableScratchMorph". Keep in mind I have windows 7

select 'block specs' instead.


nXIII

Offline

 

#54 2010-03-07 17:51:05

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: ITopic: Cool Source code tricks...

MathWizz wrote:

Where are, basically the blockSpecs for the cBlockMorph located?

HALP!


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#55 2010-03-07 17:56:29

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Jonathanpb wrote:

billyedward wrote:


They're still up there:
[open Browser with URL []]
(if<>then[]else[]).
More coming soon!

Oh, you're using projects?

Those guides aren't helping - I want to make my own blocks, whatever blocks I want, and I want those blocks to work. How do I do that?

To teach you this, I really have to teach you how to use the whole squeak programming language. (search Google for 'squeak tutorial')

I will, however, make a tutorial explaining the basics of block making.

ARGH

I suppose I'll look for a tutorial then.

Sorry...  sad


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#56 2010-03-08 11:16:05

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

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)

Hey thanks!  big_smile


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

 

#57 2010-03-08 15:59:57

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

Re: ITopic: Cool Source code tricks...

I'm trying to make a distance block where you enter all the coordinates, but it always says error, and I can't understand the debug thing. Can someone help me? My function is this
dista: t1 n: t2 c: t3 e: t4
    | t5 t6 t7 t8 t9 t10 |
    t5 _ t1 - t2.
    t6 _ t5 * t5.
    t7 _ t2 - t4.
    t8 _ t7 * t7.
    t9 _ t8 + t6.
    t10 _ t9 sqrt.
    ^ t10


Check out my projects if you have a chance.

Offline

 

#58 2010-03-08 16:59:34

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

Re: ITopic: Cool Source code tricks...

climber59 wrote:

I'm trying to make a distance block where you enter all the coordinates, but it always says error, and I can't understand the debug thing. Can someone help me? My function is this
dista: t1 n: t2 c: t3 e: t4
    | t5 t6 t7 t8 t9 t10 |
    t5 _ t1 - t2.
    t6 _ t5 * t5.
    t7 _ t2 - t4.
    t8 _ t7 * t7.
    t9 _ t8 + t6.
    t10 _ t9 sqrt.
    ^ t10

Are you sending four arguments to it in the blockSpecs?


nXIII

Offline

 

#59 2010-03-08 17:03:18

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

Re: ITopic: Cool Source code tricks...

nXIII wrote:

Are you sending four arguments to it in the blockSpecs?

Yes. Here is the blockSpecs code
('distance from x: %s y: %s to x: %s y: %s' #r #dista:n:c:e:)

Last edited by climber59 (2010-03-08 17:03:55)


Check out my projects if you have a chance.

Offline

 

#60 2010-03-08 21:35:44

midnightleopard
Scratcher
Registered: 2007-09-13
Posts: 1000+

Re: ITopic: Cool Source code tricks...

what do I need to have downloaded? what program(s)?


http://pwp.wizards.com/5103673563/Scorecards/Landscape.png

Offline

 

#61 2010-03-08 21:43:47

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

Re: ITopic: Cool Source code tricks...

climber59 wrote:

nXIII wrote:

Are you sending four arguments to it in the blockSpecs?

Yes. Here is the blockSpecs code
('distance from x: %s y: %s to x: %s y: %s' #r #dista:n:c:e smile

Use %n, since it is a number and not a string that you want.
Also, please copy and paste the error message in so I can try to figure it out.


"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

 

#62 2010-03-08 21:45:04

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

Re: ITopic: Cool Source code tricks...

midnightleopard wrote:

what do I need to have downloaded? what program(s)?

You need the scratch source code.


"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

 

#63 2010-03-08 21:53:40

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

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Use %n, since it is a number and not a string that you want.

Thanks! That and fixing a wrong variable (t5 should have been t1 - t3 not t1 - t2) fixed it.


Check out my projects if you have a chance.

Offline

 

#64 2010-03-11 10:41:10

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

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)

When I tried to save the first code change, it said 'nothing more expected just before 'control'. HELP!!!


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

#65 2010-03-11 10:53:43

maciej
Scratcher
Registered: 2009-01-05
Posts: 15

Re: ITopic: Cool Source code tricks...

sounds awesome, i must try when i get onto scratch

Offline

 

#66 2010-03-11 10:55:19

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

Re: ITopic: Cool Source code tricks...

Scratchguy3 wrote:

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)

When I tried to save the first code change, it said 'nothing more expected just before 'control'. HELP!!!

Worked fine for me...


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

 

#67 2010-03-12 10:17:30

mathguy
Scratcher
Registered: 2008-11-20
Posts: 19

Re: ITopic: Cool Source code tricks...

I have worked in this area before (http://scratch.mit.edu/projects/mathguy/349196) and your ideas have sparked some more of mine. I am on a different computer that doesn't have scratch and am installing it :

Output folder: C:\program files\Scratch
Created uninstaller
Completed

I have worked with it with the standard version of squeak with the scratch image and will try the MIT version.

Some of my ideas are:
-while %b true (#c)
-set variable %vForBools to %b  (#-)

... And I just forgot the rest. Darn.

Offline

 

#68 2010-03-12 10:26:35

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

Re: ITopic: Cool Source code tricks...

mathguy wrote:

Some of my ideas are:
-while %b true (#c)
-set variable %vForBools to %b  (#-)

What do these do? I only know the very basics of how to do it.


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

 

#69 2010-03-12 20:47:26

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

Re: ITopic: Cool Source code tricks...

Would it be possible to make a block that created a sprite that looked like the stage did at that time(including pen marks, graphic effects and all)?


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

#70 2010-03-13 10:59:02

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

Re: ITopic: Cool Source code tricks...

Scratchguy3 wrote:

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)

When I tried to save the first code change, it said 'nothing more expected just before 'control'. HELP!!!

You probably forgot to add a closing bracket.
However, another typo could also have caused this.
If possible, could you copy and paste the block specs which are giving you trouble in here, so I can see?


"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

 

#71 2010-03-13 11:00:54

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

Re: ITopic: Cool Source code tricks...

Scratchguy3 wrote:

Would it be possible to make a block that created a sprite that looked like the stage did at that time(including pen marks, graphic effects and all)?

Yes.
I can make another how to make a new block tutorial, if you want...


"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

 

#72 2010-03-14 12:53:36

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Scratchguy3 wrote:

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':

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)

When I tried to save the first code change, it said 'nothing more expected just before 'control'. HELP!!!

You probably forgot to add a closing bracket.
However, another typo could also have caused this.
If possible, could you copy and paste the block specs which are giving you trouble in here, so I can see?

Here:

asciiFor: t1
    | t2 |
    t1 size = 1 ifTrue: [^ t1 first asciiValue].
    t2 _ t1 localized.
    'space' localized = t2 ifTrue: [^ Character space asciiValue].
    'enter' localized = t2 ifTrue: [^ Character cr asciiValue].
    'up arrow' localized = t2 ifTrue: [^ 30].
    'down arrow' localized = t2 ifTrue: [^ 31].
    'right arrow' localized = t2 ifTrue: [^ 29].
    'left arrow' localized = t2 ifTrue: [^ 28].
    'up' = t1 ifTrue: [^ 30].
    'down' = t1 ifTrue: [^ 31].
    'right' = t1 ifTrue: [^ 29].
    'left' = t1 ifTrue: [^ 28].
    '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].
    ^ -1


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

#73 2010-03-14 12:55:05

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

Re: ITopic: Cool Source code tricks...

billyedward wrote:

Scratchguy3 wrote:

Would it be possible to make a block that created a sprite that looked like the stage did at that time(including pen marks, graphic effects and all)?

Yes.
I can make another how to make a new block tutorial, if you want...

PLEASE????????????????????????????!!!!!!!!!!!!!!!!!!!!!?????????????????????!!!!!!!!!!!!!!!!!
I NEED IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

#74 2010-03-14 12:57:05

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

Re: ITopic: Cool Source code tricks...

Isn't tat just like making its save the screen and insted of saving it, add it to a sprites costume?


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

 

#75 2010-03-14 17:13:24

Scratchguy3
Scratcher
Registered: 2010-02-07
Posts: 29

Re: ITopic: Cool Source code tricks...

markyparky56 wrote:

Isn't tat just like making its save the screen and insted of saving it, add it to a sprites costume?

Pretty much. It would replace the sprites costume though, and I wan't a block for it.


http://ev.carsoncheng.com/dropbox/scratchguy3-forum-sig.png

Offline

 

Board footer