I want to make a lot of blocks for lists, but whenever I make one, the default list is "a" instead of the first existing list. So if my list is named list, instead of |do this to {list v}|
it becomes |do this to list {a v}|. Does anyone know how to change this to the default list?

Offline
I know it. It's something somewhere which tells the menus to set their default option to some variable. Let me look for it...
Offline
ScriptableScratchMorph -> blocks -> defaultArgFor:
Offline
LS97 wrote:
ScriptableScratchMorph -> blocks -> defaultArgFor:
![]()
Thanks so much LS97!!!!!!!!

Offline
LS97 wrote:
ScriptableScratchMorph -> blocks -> defaultArgFor:
![]()
Darn. I thought I knew how to change that code correctly, but it's not working.
My block's method is FontsToList. It takes one %L argument.
Based on the surrounding code, I assumed this was what I needed to add:
#FontstoList: = t4
ifTrue: [t2 size >= 1 ifTrue: [t2 at: 1 put: self defaultListName]].But it's not working. What am I doing wrong?
If anyone can fix this, I'll give them credit as an improvement to the block when I share it at the Library.

Offline
In the blockspec of your new block, put a default value of 'list', just like the "replace" and "contains" list blocks:
('fontsToList %L' r fontsToList: 'list')I don't know if you want a reporter, this was just an example to show you how to solve your problem.
Offline
And by the way, you shouldn't use the original Scratch to create your mod, but use the Scratch source code provided by MIT, because in the source code, variables have names that tell the programmer what they mean, not strange things like t1, t2, t3 and so on. If I hadn't the source code, I wouldn't be able to guess what the hell was t4 and t2, which in the source code have the names "sel" (from the word "selector") and "defaultArgs". I guess I don't have to say anything more to show you how easy this is to interpret.
Offline
Baderous wrote:
And by the way, you shouldn't use the original Scratch to create your mod, but use the Scratch source code provided by MIT, because in the source code, variables have names that tell the programmer what they mean, not strange things like t1, t2, t3 and so on. If I hadn't the source code, I wouldn't be able to guess what the hell was t4 and t2, which in the source code have the names "sel" (from the word "selector") and "defaultArgs". I guess I don't have to say anything more to show you how easy this is to interpret.
Where is that? I just use the browser...

Offline
Baderous wrote:
In the blockspec of your new block, put a default value of 'list', just like the "replace" and "contains" list blocks:
Code:
('fontsToList %L' r fontsToList: 'list')I don't know if you want a reporter, this was just an example to show you how to solve your problem.
That's odd. I could have sworn that I had tried that...but it's working. Thanks!
EDIT: Oh wait, that's because you need to do both. Oh...
Last edited by Greenatic (2011-07-30 13:34:44)

Offline
Greenatic wrote:
Baderous wrote:
And by the way, you shouldn't use the original Scratch to create your mod, but use the Scratch source code provided by MIT, because in the source code, variables have names that tell the programmer what they mean, not strange things like t1, t2, t3 and so on. If I hadn't the source code, I wouldn't be able to guess what the hell was t4 and t2, which in the source code have the names "sel" (from the word "selector") and "defaultArgs". I guess I don't have to say anything more to show you how easy this is to interpret.
Where is that? I just use the browser...
The browser is just a tool to explore the code. You can explore it in 2 ways:
1) Hacking the original Scratch, by shift-clicking the loop in the 'R' character of "Scratch", and selecting turn fill screen off, then opening the browser;
2) Run the source code image which already gives you an open browser and a Scratch window that isn't full screen;
The difference in using both, besides license's restrictions, is that the code in the source code image is well formatted (like having tabs and etc in things such as blockspecs, so it doesn't show up as a single confusing line) and methods variables have self-describing names to help programmers understand what they do, instead of the tX, 1<=X<infinity, naming rule used in the original Scratch.
Offline
Baderous wrote:
Greenatic wrote:
Baderous wrote:
And by the way, you shouldn't use the original Scratch to create your mod, but use the Scratch source code provided by MIT, because in the source code, variables have names that tell the programmer what they mean, not strange things like t1, t2, t3 and so on. If I hadn't the source code, I wouldn't be able to guess what the hell was t4 and t2, which in the source code have the names "sel" (from the word "selector") and "defaultArgs". I guess I don't have to say anything more to show you how easy this is to interpret.
Where is that? I just use the browser...
The browser is just a tool to explore the code. You can explore it in 2 ways:
1) Hacking the original Scratch, by shift-clicking the loop in the 'R' character of "Scratch", and selecting turn fill screen off, then opening the browser;
2) Run the source code image which already gives you an open browser and a Scratch window that isn't full screen;
The difference in using both, besides license's restrictions, is that the code in the source code image is well formatted (like having tabs and etc in things such as blockspecs, so it doesn't show up as a single confusing line) and methods variables have self-describing names to help programmers understand what they do, instead of the tX, 1<=X<infinity, naming rule used in the original Scratch.
So when I open the source code image, it gives me an easier-to-read browser? (correct me if I'm misunderstanding).
How do I get the source code image? Also, what's the difference in the license restrictions? And will I need to copy over the changes I made in the browser?

Offline
Greenatic wrote:
Baderous wrote:
Greenatic wrote:
Where is that? I just use the browser...
The browser is just a tool to explore the code. You can explore it in 2 ways:
1) Hacking the original Scratch, by shift-clicking the loop in the 'R' character of "Scratch", and selecting turn fill screen off, then opening the browser;
2) Run the source code image which already gives you an open browser and a Scratch window that isn't full screen;
The difference in using both, besides license's restrictions, is that the code in the source code image is well formatted (like having tabs and etc in things such as blockspecs, so it doesn't show up as a single confusing line) and methods variables have self-describing names to help programmers understand what they do, instead of the tX, 1<=X<infinity, naming rule used in the original Scratch.So when I open the source code image, it gives me an easier-to-read browser? (correct me if I'm misunderstanding).
Check the differences:
1) ScriptableScratchMorph>>blockSpecs in the source code image: http://i.imgur.com/ugHYW.png
2) The same in the original Scratch: http://i.imgur.com/PV1Nu.png
Greenatic wrote:
How do I get the source code image?
The source code can be downloaded from this page: http://info.scratch.mit.edu/Source_Code
Greenatic wrote:
Also, what's the difference in the license restrictions? And will I need to copy over the changes I made in the browser?
I don't know if there are any restrictions on using the original Scratch to create a mod, but the source code package has its own license. Also, the original Scratch license doesn't say anything about modding it, so I think it's safer to use the source code image. But you should contact the Scratch Team if you want to know more about it.
Offline
Baderous wrote:
Greenatic wrote:
Baderous wrote:
The browser is just a tool to explore the code. You can explore it in 2 ways:
1) Hacking the original Scratch, by shift-clicking the loop in the 'R' character of "Scratch", and selecting turn fill screen off, then opening the browser;
2) Run the source code image which already gives you an open browser and a Scratch window that isn't full screen;
The difference in using both, besides license's restrictions, is that the code in the source code image is well formatted (like having tabs and etc in things such as blockspecs, so it doesn't show up as a single confusing line) and methods variables have self-describing names to help programmers understand what they do, instead of the tX, 1<=X<infinity, naming rule used in the original Scratch.So when I open the source code image, it gives me an easier-to-read browser? (correct me if I'm misunderstanding).
Check the differences:
1) ScriptableScratchMorph>>blockSpecs in the source code image: http://i.imgur.com/ugHYW.png
2) The same in the original Scratch: http://i.imgur.com/PV1Nu.pngGreenatic wrote:
How do I get the source code image?
The source code can be downloaded from this page: http://info.scratch.mit.edu/Source_Code
Greenatic wrote:
Also, what's the difference in the license restrictions? And will I need to copy over the changes I made in the browser?
I don't know if there are any restrictions on using the original Scratch to create a mod, but the source code package has its own license. Also, the original Scratch license doesn't say anything about modding it, so I think it's safer to use the source code image. But you should contact the Scratch Team if you want to know more about it.
Yeah, that does look a lot easier. But since I'm used to using the standard browser and I don't plan on officially making a mod, I don't think I need it right now. Thanks though

Offline
Greenatic wrote:
Since I'm used to using the standard browser and I don't plan on officially making a mod, I don't think I need it right now. Thanks though
![]()
The browser's exactly the same -- really the only thing that the source adds is the CHANGES file, which contains this nice code formatting and explanatory comments.
Offline