Can someone help me with the codes and chains in my MOD? This is what I need help with right now:
1. Block building!
CLOSED CURRENTLY
I want a block builder for my MOD. Here is some stuff I got so far: Go to Scratch-UI-Panes, ScratchScriptEditorMorph, menu/button ops, and scriptsMenu. Replace the full code with:
scriptsMenu: aPosition "Present a menu of Scratch script operations." | menu choice | self target ifNil: [^ self]. menu _ CustomMenu new. menu add: 'clean up' action: #cleanUp. menu add: 'save picture of scripts' action: #saveScriptsToImage. menu add: 'add comment' action: #addComment:. menu addLine. menu add: 'Create a new block' action: #buildABlock. choice _ menu localize startUp. choice ifNil: [^ self]. choice = #addComment: ifTrue: [self perform: choice with: aPosition] ifFalse: [self perform: choice].
Right - click the scripts menu, and you get 'Create a new block' in the menu. DON'T CLICK IT! It causes an error! I want a code, so it comes up with a dialog, and you type in the blockspec, block category and block code. When you press OK, the block will appear in that category. It may be sort of like panther, though. Please post!
2. Feedback mailer! I need a dialog where you can rate the program, and add other comments, then upload it to my private site.
Last edited by zorket (2011-05-02 20:25:55)
Offline
You're the lucky exception to my 'no internet on holidays' rule...
I'll help best I can, but keep in mind that it's not easy to understand the mechanics of Squeak code, really. Try to understand the concept of my code examples instead of just copying them out, and I'll do my best to explain it fully too.
See how the last bit uses the choice variable to determine what to actually do? Choice is the result of the menu we showed using the line choice _ menu startUp. It's obviously going to be one of the menu options, or nil if the menu was dismissed.
The last line tells Squeak to perform an action present in the editor's methods with the name of the menu option (if the option was not 'handled' -- taken care of -- before). This means...
We have to create a method in the editor's class with the name of the action you chose. In other words, 'buildABlock'.
In this method, we have to define a dialog. Do this by assigning a temporary variable with the value DialogBoxMorph new.
To add stuff to this dialog, browse the DialogBoxMorph class in Scratch-UI-Dialogs for methods and categories to add textboxes, labels, etc.
Good luck!
(PS. Sorry that last bit was so short, but I have to go and I admittedly spent too much on the first bit )
Offline
LS97 wrote:
You're the lucky exception to my 'no internet on holidays' rule...
I'll help best I can, but keep in mind that it's not easy to understand the mechanics of Squeak code, really. Try to understand the concept of my code examples instead of just copying them out, and I'll do my best to explain it fully too.
(I've cut off a bit because it is big)
Thanks! That post was really helpful. Now, I'm gonna try it.
Offline
Right, I spared a second to come back to this.
Another thing you'll need is a way to save the custom code to the project, and I suggest you do that using a global variable. I can't help much with that though because I never experimented it myself.
Offline
What's it called?
Offline
zorket wrote:
Can someone help me with the codes and chains in my MOD? This is what I need help with right now:
1. Block building! I want a block builder for my MOD. Here is some stuff I got so far: Go to Scratch-UI-Panes, ScratchScriptEditorMorph, menu/button ops, and scriptsMenu. Replace the full code with:Code:
scriptsMenu: aPosition "Present a menu of Scratch script operations." | menu choice | self target ifNil: [^ self]. menu _ CustomMenu new. menu add: 'clean up' action: #cleanUp. menu add: 'save picture of scripts' action: #saveScriptsToImage. menu add: 'add comment' action: #addComment:. menu addLine. menu add: 'Create a new block' action: #buildABlock. choice _ menu localize startUp. choice ifNil: [^ self]. choice = #addComment: ifTrue: [self perform: choice with: aPosition] ifFalse: [self perform: choice].Right - click the scripts menu, and you get 'Create a new block' in the menu. DON'T CLICK IT! It causes an error! I want a code, so it comes up with a dialog, and you type in the blockspec, block category and block code. When you press OK, the block will appear in that category. It may be sort of like panther, though. Please post!
save the code to a file, then make it so at the end of blockspecs, it will have:
^t1, self obsoleteBlockSpecs, customBlockSpecs
For the code of the thing it would make a file wich would have the code in it, and add to the blockSpec file '(''' , textinsertforfrontcover, ''' #', (blocktype), '#', methodname, ')'
Make the file block method.
Then the customBlockSpecs could be something like:
^readFromFile: 'blockspecs file', ')'
Okay, i lost myself there, it would be easier to make a block which you would type the name of to block, I cant realy help i don't have time, sorry.
Offline
Pecola1 wrote:
save the code to a file, then make it so at the end of blockspecs, it will have:
^t1, self obsoleteBlockSpecs, customBlockSpecs
For the code of the thing it would make a file wich would have the code in it, and add to the blockSpec file '(''' , textinsertforfrontcover, ''' #', (blocktype), '#', methodname, ')'
Make the file block method.
Then the customBlockSpecs could be something like:
^readFromFile: 'blockspecs file', ')'
Okay, i lost myself there, it would be easier to make a block which you would type the name of to block, I cant realy help i don't have time, sorry.
Can you explain a little easier?
Offline
zorket wrote:
Pecola1 wrote:
save the code to a file, then make it so at the end of blockspecs, it will have:
^t1, self obsoleteBlockSpecs, customBlockSpecs
For the code of the thing it would make a file wich would have the code in it, and add to the blockSpec file '(''' , textinsertforfrontcover, ''' #', (blocktype), '#', methodname, ')'
Make the file block method.
Then the customBlockSpecs could be something like:
^readFromFile: 'blockspecs file', ')'
Okay, i lost myself there, it would be easier to make a block which you would type the name of to block, I cant realy help i don't have time, sorry.Can you explain a little easier?
Basically, save the code for a block, then when that block is inserted in the custom block block, it will run the txt file simply by having it read the file and run the file, that is the quick and easy way. It is harder to make the block show up in blockspecs.
Offline
Pecola1 wrote:
zorket wrote:
Pecola1 wrote:
save the code to a file, then make it so at the end of blockspecs, it will have:
^t1, self obsoleteBlockSpecs, customBlockSpecs
For the code of the thing it would make a file wich would have the code in it, and add to the blockSpec file '(''' , textinsertforfrontcover, ''' #', (blocktype), '#', methodname, ')'
Make the file block method.
Then the customBlockSpecs could be something like:
^readFromFile: 'blockspecs file', ')'
Okay, i lost myself there, it would be easier to make a block which you would type the name of to block, I cant realy help i don't have time, sorry.Can you explain a little easier?
Basically, save the code for a block, then when that block is inserted in the custom block block, it will run the txt file simply by having it read the file and run the file, that is the quick and easy way. It is harder to make the block show up in blockspecs.
Do you think we could do this for the Library?
Offline
scimonster wrote:
Pecola1 wrote:
zorket wrote:
Can you explain a little easier?
Basically, save the code for a block, then when that block is inserted in the custom block block, it will run the txt file simply by having it read the file and run the file, that is the quick and easy way. It is harder to make the block show up in blockspecs.
Do you think we could do this for the Library?
We could, the only problem with this method is it would only work for blocks without any inserts like the pi block or infinity. So you cant make a block like, ( ( ) ^ ( ) ).
Last edited by Pecola1 (2011-05-04 12:10:22)
Offline
Pecola1 wrote:
scimonster wrote:
Pecola1 wrote:
Basically, save the code for a block, then when that block is inserted in the custom block block, it will run the txt file simply by having it read the file and run the file, that is the quick and easy way. It is harder to make the block show up in blockspecs.Do you think we could do this for the Library?
We could, the only problem with this method is it would only work for blocks without any inserts like the pi block or infinity. So you cant make a block like, ( ( ) ^ ( ) ).
Why not?
Offline
scimonster wrote:
Pecola1 wrote:
scimonster wrote:
Do you think we could do this for the Library?
We could, the only problem with this method is it would only work for blocks without any inserts like the pi block or infinity. So you cant make a block like, ( ( ) ^ ( ) ).
Why not?
Because there isn't a separate insert for it.
Offline
Try basing your mod on BYOB instead of Scratch. To learn how to hack BYOB 3.0+, go to here.
Offline
rdococ wrote:
Try basing your mod on BYOB instead of Scratch. To learn how to hack BYOB 3.0+, go to here.
I've already started my MOD and added about 1,000,000,000,000,000,000,000,000,000 features. Basing it on BYOB will remove alot of features.
Offline
zorket wrote:
rdococ wrote:
Try basing your mod on BYOB instead of Scratch. To learn how to hack BYOB 3.0+, go to here.
I've already started my MOD and added about 1,000,000,000,000,000,000,000,000,000 features. Basing it on BYOB will remove alot of features.
LOL! That is a lot of features. XD
Offline
Is E drive a memory stick or a partition which hosts an OS?
Offline
LS97 wrote:
Is E drive a memory stick or a partition which hosts an OS?
I have a Mac, but I'm guessing on a Windows and Ubuntu computers it is a secondry C: / drive.
Last edited by williambl (2011-05-17 14:54:37)
Offline
LS97 wrote:
Is E drive a memory stick or a partition which hosts an OS?
Yes, though mine is (I:)
Last edited by Pecola1 (2011-05-17 18:08:49)
Offline
zorket wrote:
LS97 wrote:
Is E drive a memory stick or a partition which hosts an OS?
Its a HARD DRIVE, not a stick!
Normally C: is the main drive... Do you really have 3 HDDs?
Offline
LS97 wrote:
zorket wrote:
LS97 wrote:
Is E drive a memory stick or a partition which hosts an OS?
Its a HARD DRIVE, not a stick!
Normally C: is the main drive... Do you really have 3 HDDs?
Yes, but sometimes it could be A: as the main drive, as it was in old versions of DOS and Windows.
Offline