the sprite name block is made like this:
go to scriptablescratchmorph go to the control section then put this:
('sprite name' #r #name)
go to instance on the screen that pops up put this:
name
^ self objname
Offline
11-16-01 wrote:
the sprite name block is made like this:
go to scriptablescratchmorph go to the control section then put this:
('sprite name' #r #name)
go to instance on the screen that pops up put this:
name
^ self objname
How'd u figur dat ou?
Offline
11-16-01: is that your D.O.B. !? It would make you another one of our primary school squeakers.
Offline
rubiks_cube_guy238 wrote:
LS97 wrote:
Hey Scratchers!
Here's a brief list of the different arguments:#- no arguments (command or 'stack' block)
#r Reporter block (the round ones)
#b boolean block (diamond shaped)
#c C shaped block (like the forever block)
#t Time block (like wait X secs)
#W 'when' hat block (obsolete)
#S start button click hat block
#K key-activated hat block
#E event hat block (broadcast)
#s special form (hard to code)I happen to be a master of the ScratchProcess*, and can generate C-blocks and S-blocks like any other Scratch block.
Just sayin'.
So, if you have any requests, feel free to ask me.
*ScratchProcess: The ScratchProcess takes care of scripts and C-blocks and S-blocks.
I wnat a do one of these block NOW!
Offline
LS97 wrote:
The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:Code:
('%s mouse down?' #b #mousePressed: 'left')then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.Code:
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressedThen click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.
i want a dropdown list version of it.
Offline
kinker wrote:
LS97 wrote:
The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:Code:
('%s mouse down?' #b #mousePressed: 'left')then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.Code:
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressedThen click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.
i want a dropdown list version of it.
sorry but i'm not accepting any more requests for that i'm fed up in explaining the same thing 100 times over. Find it somewhere, there's about 30 explanations in the forums
Offline
Shal I make a new thread with all the blocks in this one and several extra feature tutorials?
Offline
me450 wrote:
johnnydean1 wrote:
Shal I make a new thread with all the blocks in this one and several extra feature tutorials?
if its fine with you that would be excellent
sure -- but fine-tune it a bit please
Offline
ok, when I get a free second
Last edited by johnnydean1 (2010-10-10 09:40:57)
Offline
New block! ( (shuffle) (string) )
See the block!
Last edited by zorket (2010-10-10 13:50:12)
Offline
kinker wrote:
LS97 wrote:
The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:Code:
('%s mouse down?' #b #mousePressed: 'left')then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.Code:
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressedThen click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.
i want a dropdown list version of it.
in other ops in scriptablesprite morphs
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressed
Scratch blocks> commandBlockMorph> all> uncoloredArgMorphFor: add a strip:
$Z = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #mouseoptions; choice: 'left'].
Scratch objects> scriptableScratchMorph> otherOps:
mouseoptions ^ #('left' 'right' 'middle' 'any' 'left ' 'right ' 'middle ' 'any ')
Blockspec - boolean
('%Z mouse down?' #b #mousePressed:)
Blockspec - reporter
('%Z mouse down?' #r #mousePressed:)
that should work
Last edited by me450 (2010-10-12 05:38:01)
Offline
@post above
There's about 7 explanations in this thread only. Thanks for making it really clear though -- I'll link the post to this instead
Offline
pwiter wrote:
I got a new block
http://img831.imageshack.us/img831/1435/capturesc.jpg
Instance ops:Code:
| dialogBox | dialogBox _ DialogBoxMorph new. dialogBox title: t1. dialogBox withButtonsForYes: false no: false okay: true cancel: false. dialogBox message: t2. dialogBox getUserResponse.Blockspecs
Code:
ho('sw dialog titled %s with contents %s' #- #showDialogTitle:Contents: 'info' 'hello')Copyright pwitter 2010
Actually, the code is
showDialogTitle: t1 Contents: t2 | dialogBox | dialogBox _ DialogBoxMorph new. dialogBox title: t1. dialogBox withButtonsForYes: false no: false okay: true cancel: false. dialogBox message: t2. dialogBox getUserResponse.
But this does give me an idea for a new block: [close scratch]
Blockspec:
('close scratch' #- #closeUpScratch
closeUpScratch | t1 | t1 _ DialogBoxMorph new. t1 title: '?'. t1 withButtonsForYes: true no: true okay: false cancel: true. t1 message: 'Save changes before quitting?'. t1 getUserResponse.
But there is a small problem with this block... It doesn't close scratch! I need help!
Last edited by zorket (2010-10-13 16:01:38)
Offline
How could you add more keys to
<key[ ]pressed?>
?
Offline
me450 wrote:
kinker wrote:
LS97 wrote:
The http://www.freeimagehosting.net/uploads/db8cb97ba8.gifblock
Another request of SeptimusHeap.
Put this code in both Sprite and Stage Morph blockSpecs in the sensing category:Code:
('%s mouse down?' #b #mousePressed: 'left')then into the instance, into ScriptableScratchMorph, and into 'sensing ops'.
replace the 'mousePressed' code with the one below.Code:
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressedThen click accept and it should be fine. you'll find the new block in the sensing category. you can put left, right, middle or any into the box and it'll give you the respective sensor button boolean.
i want a dropdown list version of it.
in other ops in scriptablesprite morphs
Code:
mousePressed: t1 t1 = 'left' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any' ifTrue: [^ Sensor anyButtonPressed]. t1 = 'left ' ifTrue: [^ Sensor redButtonPressed]. t1 = 'right ' ifTrue: [^ Sensor yellowButtonPressed]. t1 = 'middle ' ifTrue: [^ Sensor blueButtonPressed]. t1 = 'any ' ifTrue: [^ Sensor anyButtonPressed]. ^ Sensor redButtonPressedScratch blocks> commandBlockMorph> all> uncoloredArgMorphFor: add a strip:
Code:
$Z = t2 ifTrue: [^ ChoiceOrExpressionArgMorph new getOptionsSelector: #mouseoptions; choice: 'left'].Scratch objects> scriptableScratchMorph> otherOps:
Code:
mouseoptions ^ #('left' 'right' 'middle' 'any' 'left ' 'right ' 'middle ' 'any ')Blockspec - boolean
Code:
('%Z mouse down?' #b #mousePressed:)Blockspec - reporter
Code:
('%Z mouse down?' #r #mousePressed:)that should work
Thanks!
Offline
How would you/what is the code for adding more code to the
<key[ ]pressed?>
???
Offline
Bobsterman wrote:
How would you/what is the code for adding more code to the
<key[ ]pressed?>
???
to add key names use the keyNames method, to define those keyNames use the asciiFor: method (you need to know the ascii code for it though)
Offline
zorket wrote:
But there is a small problem with this block... It doesn't close scratch! I need help!
LOL. there is no code to quit scratch in there.
use ScratchFrameMorph quitScratch or whatever it's called to do so
Offline
Smalltalk snapshot: false andQuit: true
I HATE the 60s rule.
Offline
TheSuccessor wrote:
Smalltalk snapshot: false andQuit: true
I HATE the 60s rule.
DO NOT do this.
It does not save.
Use #quitScratch instead.
Offline
Whoops... I knew that, i just didn't see zorket's post.
Offline