So tutorials have to be text not a project?
Offline
jji7skyline wrote:
So tutorials have to be text not a project?
If you could convert it over that would be great. if not, you can give us a link and ill put it in the useful links section
scimonster wrote:
Maybe I should get the pass.
You messed up on BBCode and grammar.![]()
Sorry
Last edited by hello12345678910 (2011-07-22 16:58:44)
Offline
bump
Offline
my name is GP1 (as you can see) and I'm writing this Scratch tutorial for tutorials-r-us.
lets start with it. I'm going to show you how to make extra menus (ex. file, share) in Scratch.
1) Open the Scratch browser (giving that you know how to, otherwise shift-click the loop in the R of the scratch logo and clock fill screen off, then click the grey space on the side that appears and click open, then click browser)
scroll to scratch-ui-panes then scratchFrameMorph then menu/actions
2) clear the text in the bottom window and replace it with:
yourMenuGoesHereMenu: t1
| t2 |
t2 _ CustomMenu new.
"menu commands go here"
t2 localize.
#(1 2 ) do: [:t3 | t2 labels at: t3 put: ((t2 labels at: t3)
copyFrom: 1 to: (t2 labels at: t3) size - 1)
, ScratchTranslator ellipsesSuffix].
t2 invokeOn: self at: t1 bottomLeft + (0 @ 10)3) replace the yourMenuGoesHere with the name of your menu (no spaces) but keep the Menu after the menu name with no spaces
4) to make a text in the menu, type in one line under the "menu commands go here" (click after the last " and press the enter) :
t2 add: 'The text (or command of the menu) here, but keep the single quotes' action: #theActionSelectorHere.
replace the text and the selector, keeping the ' and the # and the .
If you want to have the action do nothing (just text) then open another browser and browse to scratch-ui-panes>>scratchFrameMorph>>menu/actions and replace the bottom window with:
nothing
right-click on the text and click the accept button and replace the selector in the other browser (the one with the #theActionSelectorHere) and replace the #theActionSelectorHere with #nothing (once you have the nothing typed in and accepted, you don't have to do it again)
5)if you want the text to do something, replace the theActionSelectorHere with a command with no spaces (ex. #command) then open another browser and go to the menu/actions (you probably know how to do it by now) and replace the text in the bottom window with:
command "commands go here, look for them in another tutorial, they are not described here"
and replace command with the selector you used in the other browser (don't add the #).
6) if You want a line in between your commands, put:
t2 addLine.
7)right click and accept the browser with the yourMenuGoesHereMenu
8) in the third window to the right, click all, then scroll to createMenuPanel
9) find the line where it has:
t1 _ #( (#File #fileMenu:) (#Edit #editMenu:) (#Share #shareMenu:) (#Help #helpMenu:) ).
and replace it with:
t1 _ #((#File #fileMenu:) (#Edit #editMenu:) (#TheNameOfYourMenuNoSpaces #yourMenuGoesHereMenu:) (#Share #shareMenu:) (#Help #helpMenu:) ).
and right-click accept
10) shift-click the loop ion the R in the Scratch logo and click save image for end user, and click yes to save the image for the end user
11) restart scratch and your extra menu will be there
This is the end of the tutorial. I just found out how to do this, so I put it here.

Last edited by GP1 (2011-07-30 17:39:32)
Offline
My name is GP1 and I'm going to show you how to use selector (#selectorNmae) code in Scratch.
Menu:
Simple codes
Simple codes
Here is an example of a selector code. I will explain it slowly after we read it.
moveSteps | t1 t2 t3 | t1 _ self ownerThatIsA: ScratchSpriteMorph. t2 _ t1 xpos. t3 _ t2+10; t1 xpos: t3
This code will move the current sprite 10 steps.
Okay. Lets go through this now.
the moveSteps is the selector. It is called when another script does self or a menu has
t2 add: 'move current srite 10 steps' action: #moveSteps
Did you know?
self is a way to execute a selector in the same class. If a self is called with a selector afterwards in scratch-ui-panes, then it will look for it in scratch-ui-panes only. The only way it looks for it in another class is if a variable is a world variable. We'll talk about these later.
Did you know?
a selector is a fancy way of giving a code a name. Like somebody giving their baby a name, then when their older, and they recognize their name, when you call it, they'll come to you (I hope)
the next thing is the temporary variables. These are defined in a pipe (|) and stop difining in another pipe(|). In this example, there are three temporary variables. the first is t1, the second is t2, and the third is t3. You can have as many temporary variables as you want in a code.
Next is a little different. first we call t1, then we are going to tell squeak that we are going to give it a value, wich is _. when you type _, it will turn into an arrow that points left. Don''t be alarmed by it. We are going to make it a global variable so that we can access all the blocks in scratch. We do this by calling self, then use ownerThatIsA: ScratchSpriteMorph. to tell it that the code we want is in scratchframemorph. usually, blocks are located in ScriptableScratchMorph, but motion blocks are only executed as a sprite (the stage can't move). Now that t1 is a global variable, it acts like a self exept only for the class that you assigned it to (ScratchSpriteMorph). We will further call t1 instead of self for this code.
Did you know?
the period is needed at the end of every statement to execute it. It is sort of like a seperator in a binder. You don't need a period at the end of the last statement, though.
We will now call t2 to set a value to it. in scratch, the x position block is called xpos in the browser, so we will use _ to set the value of t2 to that position. We will first (after _) use t1 to call xpos. This will be:
t2 _ t1 xpos.
next, we will set t3. This code moves the current selected sprite 10 steps, so we will give this variable the x position of the sprite moved 10 pixels (steps) to the right. We will call it, the use _ to assign the value to it. the first value we want is t2, thenwe want to add 10 to it. In math (yes, you should have stayed awake) you use + to add two numeric values together. So, we will add 10 to t2 by doing
t2+10.
Did you know?
There are four different math symbols:
/ devides (t1/t2)
* multiplies (t1*t2)
+ adds (t1+t2);
- subtracs (t1-t2)
But, if you want to add two variables of text together (or a variable and some text) the you use ,
example:Code:
t2 _ 'world!'. t1 = 'Hello ', t2.will give t1 the value of "Hello World!"
Finally, we set the x position of the current sprite to t3. First, we call the global variable (t1) then xpos: t3.
Did you know?
xpos and xpos: are two different things. xpos sets a value and xpos: expects the value of wich to set the x position of the sprite. You could set a numeric value to xpos:, but it would count as a string, wich is inside of a pair of ', so it would be xpos: '0'.
There you have your first scratch frame morph code. Keep reading for more info and how to do more things.
I am sorry, I don't have scratch 1.4 on tis computer at this time. I will make the other parts of this tutorial later when I have it for reference.

Last edited by GP1 (2011-07-31 21:12:15)
Offline
Oh I didnt notice that was a new one. Did you fix thE old one? I'm eating breakfast right now I'll add it when I have a chance.
Offline
ProgrammingFreak wrote:
Glad I could help!
![]()
Thanks!!
Thank you too, GP1!!
Offline
Bump
Offline
bump... Someone please write
Offline
GP1 wrote:
does it have to be related to scratch (ex. Scratch, squeak) or can I do something else, say XNA or html5?
It has to be scratch. But it can be using scratch blocks, like a tutorial on how to scroll.
Offline