Splodgey wrote:
joefarebrother wrote:
Splodgey wrote:
DID I submit it correctly? If not how do I submit it correctly?For scratch and panther. use this syntax:
image of block (with no inputs) - if you are a new scratcher, just post the url and ask someone else to add the [img] tags
blockspec:Code:
the blockspec in a code tagcode:
Code:
the code in a code tagFor BYOB:
image of block (with no inputs)
image of the scriptsHow do I add an image?
[img]url_of_image[/img]
Offline
nXIII wrote:
OS blocks! (these should go in sensing)
('operating system' r platformName) (tested)platformName
^ Smalltalk platformName('operating system version' r osVersion) (tested)
osVersion
^ Smalltalk osVersion('Mac OS X?' b isMacOSX) (tested)
isMacOSX
^ Smalltalk isMaxOSX('Unix?' b isUnix) (tested)
isUnix
^ Smalltalk isUnix('Windows?' b isWindows) (tested)
isWindows
^ Smalltalk isWindowsEDIT: Tested them all!
A bunch of people just uploaded OS blocks, including myself. (Are you sure you didn't read those is____ methods from my last post? And by the way, MathWizz already did platformName. )
The osVersion reports 'NT' for me. What does that mean?
EDIT: 100th page of this thread!!!
Last edited by Greenatic (2011-12-28 12:04:19)
Offline
Greenatic wrote:
A bunch of people just uploaded OS blocks, including myself.
Constructing a new SystemDictionary isn't necessary, and your original doesn't support all systems, and could be inaccurate.
Are you sure you didn't read those is____ methods from my last post?
No, actually, I opened a Browser on SystemDictionary's instance 'miscellaneous' instance methods.
And by the way, MathWizz already did platformName.
Yeah, he posted the Smalltalk code. I was just including it with the block spec, etc. for completeness.
The osVersion reports 'NT' for me. What does that mean?
Are you using windows?
By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.
Last edited by nXIII (2011-12-28 12:41:25)
Offline
nXIII wrote:
Greenatic wrote:
The osVersion reports 'NT' for me. What does that mean?
Are you using windows?
Any version of windows based on the NT kernel will report this (Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Home Server, Windows Server 2008, and Windows 7).
Offline
Variables
('set background color of %v to %c' - setColorOfVar:to:) (tested)
setColorOfVar: varName to: aColor
| b w frame stage |
frame := self ownerThatIsA: ScratchFrameMorph.
frame ifNil: [
(w := self ownerThatIsA: OffscreenWorldMorph) ifNil: [^ self].
frame := w frame].
(self varNames includes: varName) ifFalse: [
stage := frame workPane.
(stage varNames includes: varName) ifTrue: [^ stage setColorOfVar: varName to: aColor]].
b := VariableBlockMorph new commandSpec: varName; receiver: self blockReceiver.
w := frame watcherForBlock: b.
w ifNotNil: [w setCategoryColor: aColor].
Control
('update from %s version %s' - update:version:) (tested)
update: aURL version: v
| version frame dir url name stream |
(aURL endsWith: '/') ifTrue: [url := aURL] ifFalse: [url := aURL, '/'].
frame := ScratchFrameMorph allInstances first.
version := (HTTPSocket httpGet: url, 'version.txt') contents lines first.
version = v ifTrue: [^ self].
(DialogBoxMorph ask: 'A new version (', version, ') is available. Would you like to download it?') ifFalse: [^ self].
name := frame projectName, '.sb'.
(dir := frame projectDirectory) deleteFileNamed: name.
stream := (dir newFileNamed: version, '.sb').
stream reset.
stream nextPutAll: (HTTPSocket httpGet: url, version, '.sb') contents.
frame openScratchProjectNamed: dir pathName, dir slash, version, '.sb'; shoutGo.
Offline
...
nXII keep it up... soon we'll see if we can get chuck norris to help us with the update once it snowballs. XD
No but rlly, keep it up!
Offline
nXIII wrote:
The osVersion reports 'NT' for me. What does that mean?
Are you using windows?
By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.
Yes, I'm using Windows XP.
About the naming: I know. I do it personally so that all the methods I make appear at the top of my browser, so I know what methods are original to Scratch and which are added.
Offline
Greenatic wrote:
nXIII wrote:
The osVersion reports 'NT' for me. What does that mean?
Are you using windows?
By the way, totally unrelated, but you should stop capitalizing the first letter of your message selectors. It's not the Smalltalk naming convention. Global and class variables are UpperCamelCase, and message selectors are lowerCamelCase.Yes, I'm using Windows XP.
About the naming: I know. I do it personally so that all the methods I make appear at the top of my browser, so I know what methods are original to Scratch and which are added.
Put them in a new category, or just look at the changes to 'working'.
Offline
('tell %m to' c doTell) (tested)
Tells another sprite to perform some action(s).
ScratchProcess >> doTell
| blocks arguments argExp |
blocks := stackFrame expression firstBlockList.
(blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
arguments := stackFrame arguments.
arguments size < 1
ifTrue: [argExp _ stackFrame expression argumentAt: 1.
^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
self setReceiverIn: blocks to: arguments first.
self popStackFrame.
self pushStackFrame: (ScratchStackFrame new expression: blocks)
('tell %m to (then continue)' c doTellAndContinue) (tested)
Tells another sprite to perform some action(s) without waiting for the sprite to finish.
ScratchProcess >> doTellAndContinue
| blocks arguments argExp |
blocks := stackFrame expression firstBlockList.
(blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
arguments := stackFrame arguments.
arguments size < 1
ifTrue: [argExp _ stackFrame expression argumentAt: 1.
^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
self setReceiverIn: blocks to: arguments first.
(stackFrame expression receiver ownerThatIsA: ScratchStageMorph) startProcessFor: blocks first.
self popStackFrame.
(Helper method, required for both)
ScratchProcess >> setReceiverIn: b to: receiver
(b isKindOf: BlockMorph) ifTrue: [
(ScriptableScratchMorph isSpriteSpecificTarget: b receiver selector: b selector) ifTrue: [
b receiver: receiver].
self setReceiverIn: b nextBlock to: receiver.
b firstBlockList do: [:block | self setReceiverIn: block to: receiver].
b argMorphs do: [:block | self setReceiverIn: block to: receiver]].
(b isKindOf: IfElseBlockMorph) ifTrue: [
b falseBlockList do: [:block | self setReceiverIn: block to: receiver]].
(b isKindOf: Collection) ifTrue: [
b do: [:block | self setReceiverIn: block to: receiver]].
NB: There are better implementations of this that allow hot-swapping code while the 'tell' is running, but these involve heavier modification of ScratchProcess.
Last edited by nXIII (2011-12-28 15:51:12)
Offline
Because of the disabled image tags, the scratch team is suggesting moving to the wiki (at least temporarily).
Offline
Tis a sad day
I've added a message to the first post and the library signature about this.
~~Sparks
Last edited by YourLocalBlockLib (2011-12-29 09:58:57)
Offline
YourLocalBlockLib wrote:
Tis a sad day
I've added a message to the first post and the library signature about this.
~~Sparks
sparks do you want any help with enabling remote sensor access i'm very good at SQL...
Offline
YourLocalBlockLib wrote:
Unfortunately the Block Library is not working at the moment. This is because of the disabled image tags on forum posts at the moment. We apologise for the inconvenience and assure you that the library will be up and running again as soon as the tags are re-enabled!
Click here to enable images, does NOT work in Internet Explorer, no one uses IE though.
Offline
TRocket wrote:
YourLocalBlockLib wrote:
Tis a sad day
I've added a message to the first post and the library signature about this.
~~Sparkssparks do you want any help with enabling remote sensor access i'm very good at SQL...
Take a look here for my documentation of problems as well as screenshots I would appreciate the help!
Offline
People can always use http://scratch.mit.edu/forums/viewtopic.php?id=85177 to view the images on here, perhaps you can mention it in the first post?
Offline
can someone please make a [ [colour] is similar to [colour] ? ] for Panther?
Offline
Wow, there's too many blocks to try! I want to try one, and make a block that downloads a block in the internet! Before You do I do, you have to learn Squeak and structure of how Scratch works with Shift-Click on loop of 'R' of 'SCRATCH', and leafing through Brower to learn about the classes!
Offline
nXIII wrote:
('tell %m to' c doTell) (tested)
Tells another sprite to perform some action(s).ScratchProcess >> doTell
| blocks arguments argExp |
blocks := stackFrame expression firstBlockList.
(blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
arguments := stackFrame arguments.
arguments size < 1
ifTrue: [argExp _ stackFrame expression argumentAt: 1.
^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
self setReceiverIn: blocks to: arguments first.
self popStackFrame.
self pushStackFrame: (ScratchStackFrame new expression: blocks)('tell %m to (then continue)' c doTellAndContinue) (tested)
Tells another sprite to perform some action(s) without waiting for the sprite to finish.ScratchProcess >> doTellAndContinue
| blocks arguments argExp |
blocks := stackFrame expression firstBlockList.
(blocks isNil or: [blocks size = 0]) ifTrue: [^ self popStackFrame].
arguments := stackFrame arguments.
arguments size < 1
ifTrue: [argExp _ stackFrame expression argumentAt: 1.
^self pushStackFrame: (ScratchStackFrame new expression: argExp)].
arguments first = #mouse ifTrue: [self error: 'Can''t tell mouse to do something'].
self setReceiverIn: blocks to: arguments first.
(stackFrame expression receiver ownerThatIsA: ScratchStageMorph) startProcessFor: blocks first.
self popStackFrame.(Helper method, required for both)
ScratchProcess >> setReceiverIn: b to: receiver
(b isKindOf: BlockMorph) ifTrue: [
(ScriptableScratchMorph isSpriteSpecificTarget: b receiver selector: b selector) ifTrue: [
b receiver: receiver].
self setReceiverIn: b nextBlock to: receiver.
b firstBlockList do: [:block | self setReceiverIn: block to: receiver].
b argMorphs do: [:block | self setReceiverIn: block to: receiver]].
(b isKindOf: IfElseBlockMorph) ifTrue: [
b falseBlockList do: [:block | self setReceiverIn: block to: receiver]].
(b isKindOf: Collection) ifTrue: [
b do: [:block | self setReceiverIn: block to: receiver]].NB: There are better implementations of this that allow hot-swapping code while the 'tell' is running, but these involve heavier modification of ScratchProcess.
looking for how ScratchProcess works and each variables in that code works.
You're both good Scratcher, Squeaker(I made this expression) and Small-Talker!!
<say[ You're great! ]for( infinite )secs>
Offline
roijac wrote:
nathanprocks wrote:
can someone please make a [ [colour] is similar to [colour] ? ] for Panther?
definition of similar?
ok so... this colour (#ff0000) is similar to this colour (#cc0000)
Offline
nathanprocks wrote:
roijac wrote:
nathanprocks wrote:
can someone please make a [ [colour] is similar to [colour] ? ] for Panther?
definition of similar?
ok so... this colour (#ff0000) is similar to this colour (#cc0000)
How would a computer detect that? You would need a certain formula to figure out if they are similar.
Offline
SJRCS_011 wrote:
nathanprocks wrote:
roijac wrote:
definition of similar?ok so... this colour (#ff0000) is similar to this colour (#cc0000)
How would a computer detect that? You would need a certain formula to figure out if they are similar.
well i need to use the computers webcam in panther to detect a certain colour which is affected by the lighting so it is impossible to make it work with out such block
Offline
Maybe some really good programmer could make a tempory block library not on the forums, but completely new site. You could Copy/paste code and use sparks' bbcode code to make it bbcode, so you won't have to rewrite it all again
Offline