I am currently in the process of making a mod called Condor. I have added three new categories: Other, List, and BlockLibrary. My only problem is with List. I want to move the 'Make a list' and 'Delete a list' buttons moved from the variables category. I've looked over and over in the source code but I can't find how I should do this in there. If someone can tell me how or at the very least point me in the right direction I would greatly appreciate it.
[blocks]
<when I receive[ my awnswer
<forever>
<say[ thankyou
<end>
[/blocks]
Offline
Scriptmaster01 wrote:
I am currently in the process of making a mod called Condor. I have added three new categories: Other, List, and BlockLibrary. My only problem is with List. I want to move the 'Make a list' and 'Delete a list' buttons moved from the variables category. I've looked over and over in the source code but I can't find how I should do this in there. If someone can tell me how or at the very least point me in the right direction I would greatly appreciate it.
[blocks]
<when I receive[ my awnswer
<forever>
<say[ thankyou
<end>
[/blocks]
I'm reporting this so it can be moved to Advanced Topics. You'll probably get more help there!
Offline
undefeatedgames wrote:
Scriptmaster01 wrote:
I am currently in the process of making a mod called Condor. I have added three new categories: Other, List, and BlockLibrary. My only problem is with List. I want to move the 'Make a list' and 'Delete a list' buttons moved from the variables category. I've looked over and over in the source code but I can't find how I should do this in there. If someone can tell me how or at the very least point me in the right direction I would greatly appreciate it.
[blocks]
<when I receive[ my awnswer
<forever>
<say[ thankyou
<end>
[/blocks]I'm reporting this so it can be moved to Advanced Topics. You'll probably get more help there!
I can see you becoming a mod sometime in the future. @Scriptmaster01: I think that it's under Scratch-Objects -> ScriptableScratchMorph -> blocks -> addGenericListBlocksTo:y:
I hope that helps!
Offline
yea that definitely helped. In case anyone out there needs to know how to do it this is what you do:
go to Scratch-Objects --> ScriptableScratchMorph -> instance -> variables -> variablesPage you should come up with something like this
variablesPage
| t1 t2 t3 t4 t5 t6 t7 t8 |
t1 _ ScratchBlockPaletteMorph new color: (Color
r: 0.8
g: 0.8
b: 1.0);
borderWidth: 0.
t2 _ ScratchFrameMorph buttonLabel: 'Make a variable' localized selector: #addGlobalVariable.
(self isKindOf: ScratchSpriteMorph)
ifTrue: [t2 actionSelector: #addVariable].
t3 _ ScratchFrameMorph buttonLabel: 'Delete a variable' localized selector: #deleteVariable.
t6 _ 13.
t1 addMorph: (t2 target: self;
position: t6 @ 7).
t7 _ t2 bottom + 3.
t4 _ self varNames size > 0.
(t5 _ self ownerThatIsA: ScratchStageMorph)
ifNotNil: [t5 varNames size > 0 ifTrue: [t4 _ true]].
t4
ifTrue:
[t1 addMorph: (t3 target: self;
position: t6 @ t7).
t7 _ t3 bottom + 10.
t7 _ self
addVariableReportersTo: t1
x: t6
y: t7.
t7 _ t7 + 12.
t7 _ self
addGenericVariableBlocksTo: t1
x: t6
y: t7].
self addGenericListBlocksTo: t1 y: t7.
t1 updateWatcherButtonsForFrame: (self ownerThatIsA: ScratchFrameMorph).
t8 _ t1 submorphs inject: 0 into: [:t9 :t10 | t9 max: t10 right].
t1 extent: t8 + 10 @ t7.
^ t1Delete the line: self addGenericListBlocksTo: t1 y: t7.
click accept.
Now you go to Scratch-Objects --> ScriptableScratchMorph ->instance -> blocks -> viewerPageForCategory you should up with
viewerPageForCategory: t1
| t2 t3 t4 |
t1 = 'variables' ifTrue: [^ self variablesPage].
t1 = 'motion' ifTrue: [^ self viewerPageForMotion].
t1 = 'sensing' ifTrue: [^ self viewerPageForSensing].
t2 _ ScratchBlockPaletteMorph new.
t3 _ 12.
t4 _ 10.
(self blocksFor: t1)
do: [:t5 | t5 = #- | (t5 = #~)
ifTrue:
[t5 = #- ifTrue: [t4 _ t4 + 15].
t5 = #~ ifTrue: [t4 _ t4 + 5]]
ifFalse: [t4 _ self
createBlock: t5
atPosition: t3 @ t4
onPage: t2]].
^ t2add
t1 = 'list' ifTrue: [^ self listPage].
to the string
click accept.
Now you add a method with this code
listPage
| t1 t2 t3 |
t2 _ self.
t1 _ ScratchBlockPaletteMorph new color: (Color
r: 0.8
g: 0.8
b: 1.0);
borderWidth: 0.
self addGenericListBlocksTo: t1 y: t2.
t1 updateWatcherButtonsForFrame: (self ownerThatIsA: ScratchFrameMorph).
t3 _ t1 submorphs inject: 0 into: [:t4 :t5 | t4 max: t5 right].
^ t1click accept
Lastly go to addGenericListBlocksTo:y: and replace it with this code
addGenericListBlocksTo: t1 y: t2
| t3 t4 t5 t6 t7 t8 |
t3 _ ScratchFrameMorph buttonLabel: 'Make a list' localized selector: #addList.
(self isKindOf: ScratchStageMorph)
ifTrue: [t3 actionSelector: #addGlobalList].
t4 _ ScratchFrameMorph buttonLabel: 'Delete a list' localized selector: #deleteList.
t5 _ 13.
t1 addMorph: (t3 target: self;
position: t5 @ 7).
t6 _ t3 bottom + 3.
t7 _ self listVarNames size > 0.
(t8 _ self ownerThatIsA: ScratchStageMorph)
ifNotNil: [t8 listVarNames size > 0 ifTrue: [t7 _ true]].
t7 ifFalse: [^ self].
t1 addMorph: (t4 target: self;
position: t5 @ t6).
t6 _ t4 bottom + 10.
t6 _ (self
addListReportersTo: t1
x: t5
y: t6)
+ 10.
(self blocksFor: 'list')
do: [:t9 | t9 = #- | (t9 = #~)
ifTrue:
[t9 = #- ifTrue: [t6 _ t6 + 15].
t9 = #~ ifTrue: [t6 _ t6 + 5]]
ifFalse:
[t6 _ self
createBlock: t9
atPosition: t5 @ t6
onPage: t1.
t1 submorphs last color: ScriptableScratchMorph listBlockColor]]I would like to thank Scratcher7_13 for helping point me in the right direction
Offline