I have worked for a while and finally the elusive show/hide list blocks are in my possession!
Here's what ya gotta do:
Important Note:
GirWaffles64 discovered that this will only work on a Mac if the indentations are deleted.
#0: Turn fill screen off and open a browser
Open Scratch and hold shift while clicking the loop of the 'R' in the Scratch logo (the one in the top-right corner). Select 'turn fill screen off', then click in the whitespace that comes up. Select 'open...', then 'browser'.
#1: Add the showOrHideList:show: Method
Select the path 'Scratch-Objects/ScriptableScratchMorph/list ops' and copy/paste the following into the bottom panel: (Note: use Alt + V to paste in Squeak)
showOrHideList: t1 show: t2
| t3 t4 t5 |
(self listVarNames includes: t1)
ifFalse: [^ self].
t3 _ lists at: t1.
t2
ifTrue: [(t4 _ self ownerThatIsA: ScratchStageMorph) ifNotNil: [t4 addMorph: t3]]
ifFalse: [t3 delete].
(t5 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ self].
t5 viewerPane categoryChanged: 'variables'
Press Alt + S to save it.
#2: Add the showList: and hideList: Methods
Click 'list ops' again and paste the following into the bottom panel:
showList: t1
| t2 |
self showOrHideList: t1 show: true.
t2 _ self ownerThatIsA: ScratchStageMorph.
t2 ~= self ifTrue: [t2 showOrHideList: t1 show: true]
Press Alt + S to save it, then click 'list ops' a third time and paste the following into the bottom panel:
hideList: t1
| t2 |
self showOrHideList: t1 show: false.
t2 _ self ownerThatIsA: ScratchStageMorph.
t2 ~= self ifTrue: [t2 showOrHideList: t1 show: false]
Press Alt + S.
#3: Add the correct blockSpecs
Click the 'class' button under the second-from-the-left panel and select 'block specs/blockSpecs'. Paste the following before the last two parenthesis:
('show list %L' #- #showList:) ('hide list %L' #- #hideList:)
Press Alt + S and save the image (using the shift-click menu) in end-user mode.
Next time you navigate to the variable blocks page, two shiny new blocks will be there!
NOTE: I have found that the argument will not (by default) show the first list. If I find a way to fix this problem, I will post an update here.
Scratch On!
Last edited by nXIII (2010-03-25 20:27:15)
Offline
Cool! Can't wait to try it and add it to my source code mods!
Offline
Does it work upon uploading? Does it work when you download it from the scratch site?
Offline
Lucario621 wrote:
Does it work upon uploading? Does it work when you download it from the scratch site?
I'm about to find out.
EDIT: "nothing more expected" keeps coming up, and I can't save the thing? I get a menu that says :
unknown variable: nothing please correct, or cancel:
declare global
string
noteevent
remotestring
cancel
Last edited by juststickman (2010-03-20 11:24:35)
Offline
juststickman wrote:
Lucario621 wrote:
Does it work upon uploading? Does it work when you download it from the scratch site?
I'm about to find out.
EDIT: "nothing more expected" keeps coming up, and I can't save the thing? I get a menu that says :
unknown variable: nothing please correct, or cancel:
declare global
string
noteevent
remotestring
cancel
What step are you on?
Offline
Can you just upload the Squeak image? I'm far too lazy.
Offline
Nevermind. I overcame my laziness, and even uploaded a project to test them in Java.
Offline
Yep. Java obviously doesn't work.
But I'm gonna decompile the JAR, and poke around, see how it works.
Offline
gershmer wrote:
Yep. Java obviously doesn't work.
But I'm gonna decompile the JAR, and poke around, see how it works.
Nice
I would just show you the image, but it has like 15 other blocks in it too...
Offline
Cool! I will use this!
Offline
nXIII wrote:
gershmer wrote:
Yep. Java obviously doesn't work.
But I'm gonna decompile the JAR, and poke around, see how it works.Nice
I would just show you the image, but it has like 15 other blocks in it too...
I wouldn't mind more goodies!
Offline
Cool! I can't pretend I'm not a little disappointed though... I tried this EXACT SAME CODE AND PROCEDURE yesterday and I ALMOST HAD IT!!!! I just forgot to use ScratchStageMorph. Actually I tried using it, but I forgot to insert it into one of the categories (I think it was "ShoworHide").
Offline
nXIII wrote:
juststickman wrote:
Lucario621 wrote:
Does it work upon uploading? Does it work when you download it from the scratch site?
I'm about to find out.
EDIT: "nothing more expected" keeps coming up, and I can't save the thing? I get a menu that says :
unknown variable: nothing please correct, or cancel:
declare global
string
noteevent
remotestring
cancelWhat step are you on?
I was saving the first thing.
Offline
juststickman wrote:
nXIII wrote:
juststickman wrote:
I'm about to find out.
EDIT: "nothing more expected" keeps coming up, and I can't save the thing? I get a menu that says :
unknown variable: nothing please correct, or cancel:
declare global
string
noteevent
remotestring
cancelWhat step are you on?
I was saving the first thing.
Odd... you DO have 1.4, right?
Offline
nXIII wrote:
juststickman wrote:
nXIII wrote:
What step are you on?I was saving the first thing.
Odd... you DO have 1.4, right?
Yup.
Offline
That's cool, even though I don't know why I would need those blocks.
Offline
IT DOESN'T WORK!
i cant get past the first scripting part!!!
Offline
The-Whiz wrote:
juststickman wrote:
nXIII wrote:
Odd... you DO have 1.4, right?
Yup.
Do you have a Mac?
Yup.
Offline
nXIII wrote:
Here is a demonstration. If yours don't work like this, tell me and I will re-paste the scripts.
Cool!
Offline