nickbrickmaster wrote:
TRocket wrote:
- added konnect menu
- changed title
- added 6 new sensing blocks
- that's all really...
hope you like it![]()
download the scratch source and replace these files:
http://www.sendspace.com/filegroup/pK34 … 9yN84t1zRgI already started, sorry. can you just post the code and blockspecs? I'm sorry for being such a hassle.
i'll try and give you the changesets
Offline
Offline
TRocket wrote:
I meant like, in the [ code ] box.
Offline
scriptablescratchmoph class block specs
'sensing'
('start hosting mesh' - startMeshHost)
('stop hosting mesh' - stopMeshHost)
('ip address' r getIp)scriptablescratchmorph sensing ops:
getIp
| t1 t2 t3 |
Socket initializeNetwork.
t1 _ NetNameResolver localHostAddress.
t2 _ nil.
t3 _ NetNameResolver stringFromAddress: t1.
(t2 notNil and: [t2 ~= t1])
ifTrue: [t3 _ t3 , String cr , 'Internet: ' , (NetNameResolver stringFromAddress: t2)].
^ t3stopMeshHost
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 exitScratchSession.startMeshHost
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 quietlyStartHostingScratchSession.continued on next post...
Offline
UPDATE:
I found code for movieblocks and will be resurrecting them if they work!
Offline
scratchframemorph:
quietlyStartHostingScratchSession
"Start running the Scratch server, allowing Scratch and other applications to interact with this Scratch remotely."
| server |
workPane scratchServer ifNil: [
server _ ScratchServer new.
server stage: workPane.
workPane scratchServer: server].
workPane scratchServer startHosting.quietlyEnableRemoteSensors
"Start running the Scratch server, allowing Scratch and other applications to interact with this Scratch remotely."
| server |
workPane scratchServer ifNil: [
server _ ScratchServer new userName: 'Scratch'.
server stage: workPane.
workPane scratchServer: server].
workPane scratchServer startHosting.scriptablespritemorph blockspecs:
('quiely enable remote sensor connections' - quietlyEnableRemoteSensors)
('enable remote sensor connections' - enableRemoteSensors)
-
('hosting mesh?' b isHostingMesh)scriptablespritemorph sensing ops:
quietlyEnableRemoteSensors
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 quietlyEnableRemoteSensors.enableRemoteSensors
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 enableRemoteSensors.isHostingMesh
| t1 t2 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
(t2 _ t1 workPane scratchServer) ifNil: [^ false].
^ t2 isHostingthis is the same as above but for the stage:
scriptablestagemorph blockspecs:
('quiely enable remote sensor connections' - quietlyEnableRemoteSensors)
('enable remote sensor connections' - enableRemoteSensors)
-
('hosting mesh?' b isHostingMesh)scriptablestagemorph sensing ops:
quietlyEnableRemoteSensors
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 quietlyEnableRemoteSensors.enableRemoteSensors
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 enableRemoteSensors.isHostingMesh
| t1 t2 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
(t2 _ t1 workPane scratchServer) ifNil: [^ false].
^ t2 isHostingcontinued in next post...
Offline
scratchframemorph initalize:
added (Konnect konnectMenu:)
createMenuPanel
"Create and add a panel containing the menus and close button."
| menuSpecs m |
"create panel"
menuPanel _ AlignmentMorph new
color: Color transparent;
centering: #center;
inset: 0;
height: 0. "will grow as needed"
self addShortcutButtonsTo: menuPanel.
"menuSpecs defines the menus"
menuSpecs _ #(
"name selector"
(File fileMenu:)
(Edit editMenu:)
(Help helpMenu:)
(Konnect konnectMenu:)
).
menuSpecs do: [:spec |
m _ ScratchMenuTitleMorph new
contents: (spec at: 1) localized;
target: self selector: (spec at: 2).
menuPanel addMorphBack: m.
#konnetMenu: = (spec at: 2) ifFalse: [
menuPanel addMorphBack: (Morph new color: Color transparent; extent: 12@5)]].
topPane addMorph: menuPanel.scratchframemorph menubuttonactions:
new method
konnectMenu: aMenuTitleMorph
| menu |
menu _ CustomMenu new.
menu add: 'enable remote sensor connection' action: #enableRemoteSensors.
menu addLine.
self addServerCommandsTo: menu.
menu addLine.
"menu add: 'test' action: #launchHelpPage."
"menu add: 'Help Screens' action: #launchAllHelpScreens".
"menu addLine."
"menu add: 'About konnected' action: #aboutScratch."
menu add: 'what is this menu?' action: #launchHelpPage.
menu localize.
#(1 2 3) do: [:n |
menu labels at: n put:
((menu labels at: n) copyFrom: 1 to: (menu labels at: n) size - 1), ScratchTranslator ellipsesSuffix].
menu invokeOn: self at: aMenuTitleMorph bottomLeft + (0@10).Offline
You are simply amazing at Squeak.
I'm glad to have someone like you on the team.
I'll post some screenshots and more info later.
Last edited by nickbrickmaster (2011-12-28 12:50:33)
Offline
TRocket wrote:
nickbrickmaster wrote:
You are simply amazing at Squeak.
![]()
I'm glad to have someone like you on the team.
I'll post some screenshots and more info later.thanks
![]()
2 things quick:
1. Can I make it that enabling remote sensor connections does not enable mesh?
2. Could you make a |join mesh ip ""| block?
3. I edited the file menu and even after I took the edit away, it says Message not understood: action: if you could help...
Offline
disable remote sensor connections:
scratchFrameMorph:
newmethod
disableRemoteSensors workPane scratchServer shutDown.
scratchFrameMorph konnect menu:
from "new" to "endnew"
konnectMenu: aMenuTitleMorph
| menu |
menu _ CustomMenu new.
menu add: 'enable remote sensor connection' action: #enableRemoteSensors.
"new"
menu add: 'disable remote sensor connections' action: #disableRemoteSensors.
"endnew"
menu addLine.
self addServerCommandsTo: menu.
menu addLine.
"menu add: 'test' action: #launchHelpPage."
"menu add: 'Help Screens' action: #launchAllHelpScreens".
"menu addLine."
"menu add: 'About konnected' action: #aboutScratch."
menu add: 'what is this menu?' action: #launchHelpPage.
menu localize.
#(1 2 3) do: [:n |
menu labels at: n put:
((menu labels at: n) copyFrom: 1 to: (menu labels at: n) size - 1), ScratchTranslator ellipsesSuffix].
menu invokeOn: self at: aMenuTitleMorph bottomLeft + (0@10).scriptablescratchmorph sensing ops:
new method
stopRemoteSensors
| t1 |
(t1 _ self ownerThatIsA: ScratchFrameMorph) ifNil: [t1 _ (self ownerThatIsA: OffscreenWorldMorph) frame].
t1 disableRemoteSensors.scriptablescratchmorph block specs from "new" to "newend"
blockSpecs
"Answer a collection of block specifications for the blocks that are common to all objects. Block specificatons (Arrays) are interspersed with category names (Strings). A block specification is an Array of the form: (<block spec string> <block type> <selector> [optional initial argument values]).
Explanation of flags:
- no flags
b boolean reporter
c c-shaped block containing a sequence of commands (always special form)
r reporter
s special form command with its own evaluation rule
t timed command, like wait or glide
E message event hat
K key event hat
M mouse-click event hat
S start event hat
W when <condition> hat (obsolete)"
| blocks |
blocks _ #(
'control'
('when %m clicked' S -)
('when %k key pressed' K -)
('when %m clicked' M -)
-
('wait %n secs' t wait:elapsed:from: 1)
-
('forever' c doForever)
('repeat %n' c doRepeat 10)
-
('broadcast %e' - broadcast:)
('broadcast %e and wait' s doBroadcastAndWait)
('when I receive %e' E -)
-
('forever if %b' c doForeverIf)
('if %b' c doIf)
('if %b' c doIfElse)
('wait until %b' s doWaitUntil)
('repeat until %b' c doUntil)
-
('stop script' s doReturn)
('stop all' - stopAll)
'sensing'
"new"
('disable remote sensors' - stopRemoteSensors)
"newend"
('start hosting mesh' - startMeshHost)
('stop hosting mesh' - stopMeshHost)
('ip address' r getIp)
'operators'
('%n + %n' r + - -)
('%n - %n' r - - -)
('%n * %n' r * - -)
('%n / %n' r / - -)
-
('pick random %n to %n' r randomFrom:to: 1 10)
-
('%s < %s' b < '' '')
('%s = %s' b = '' '')
('%s > %s' b > '' '')
-
('%b and %b' b &)
('%b or %b' b |)
('not %b' b not)
-
('join %s %s' r concatenate:with: 'hello ' 'world')
('letter %n of %s' r letter:of: 1 'world')
('length of %s' r stringLength: 'world')
-
('%n mod %n' r \\ - -)
('round %n' r rounded -)
-
('%f of %n' r computeFunction:of: 'sqrt' 10)
'sound'
('play sound %S' - playSound:)
('play sound %S until done' s doPlaySoundAndWait)
('stop all sounds' - stopAllSounds)
-
('play drum %D for %n beats' t drum:duration:elapsed:from: 48 0.2)
('rest for %n beats' t rest:elapsed:from: 0.2)
-
('play note %N for %n beats' t noteOn:duration:elapsed:from: 60 0.5)
('set instrument to %I' - midiInstrument: 1)
-
('change volume by %n' - changeVolumeBy: -10)
('set volume to %n%' - setVolumeTo: 100)
('volume' r volume)
-
('change tempo by %n' - changeTempoBy: 20)
('set tempo to %n bpm' - setTempoTo: 60)
('tempo' r tempo)
'motor'
('motor on for %n secs' t motorOnFor:elapsed:from: 1)
('motor on' - allMotorsOn)
('motor off' - allMotorsOff)
('motor power %n' - startMotorPower: 100)
('motor direction %W' - setMotorDirection: 'this way')
'variables'
('show variable %v' - showVariable:)
('hide variable %v' - hideVariable:)
'list'
('add %s to %L' - append:toList: 'thing')
-
('delete %y of %L' - deleteLine:ofList: 1)
('insert %s at %i of %L' - insert:at:ofList: 'thing' 1)
('replace item %i of %L with %s' - setLine:ofList:to: 1 'list' 'thing')
-
('item %i of %L' r getLine:ofList: 1)
('length of %L' r lineCountOfList:)
('%L contains %s' b list:contains: 'list' 'thing')
).
^ blocks, self obsoleteBlockSpecsnew block and menu item
Last edited by TRocket (2011-12-28 13:42:45)
Offline
nickbrickmaster wrote:
TRocket wrote:
nickbrickmaster wrote:
You are simply amazing at Squeak.
![]()
I'm glad to have someone like you on the team.
I'll post some screenshots and more info later.thanks
![]()
2 things quick:
1. Can I make it that enabling remote sensor connections does not enable mesh?
2. Could you make a |join mesh ip ""| block?
3. I edited the file menu and even after I took the edit away, it says Message not understood: action: if you could help...
1. i think remote sensors and mesh are the same thing
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menu
Last edited by TRocket (2011-12-28 14:08:39)
Offline
join mesh on ip:
scriptablescratchmorph sensing ops:
new method
joinMesh: ip
| newserv serv |
(serv _ self ownerThatIsA: ScratchFrameMorph) ifNil: [^ ''].
newserv _ ScratchServer new.
newserv stage: serv workPane.
serv workPane scratchServer: newserv.
ip size = 0 ifTrue: [^ '']."no ip"
newserv _ serv workPane scratchServer joinSessionAt: ipscriptable scratch morph blockspecs:
from "new" to "newend"
blockSpecs
"Answer a collection of block specifications for the blocks that are common to all objects. Block specificatons (Arrays) are interspersed with category names (Strings). A block specification is an Array of the form: (<block spec string> <block type> <selector> [optional initial argument values]).
Explanation of flags:
- no flags
b boolean reporter
c c-shaped block containing a sequence of commands (always special form)
r reporter
s special form command with its own evaluation rule
t timed command, like wait or glide
E message event hat
K key event hat
M mouse-click event hat
S start event hat
W when <condition> hat (obsolete)"
| blocks |
blocks _ #(
'control'
('when %m clicked' S -)
('when %k key pressed' K -)
('when %m clicked' M -)
-
('wait %n secs' t wait:elapsed:from: 1)
-
('forever' c doForever)
('repeat %n' c doRepeat 10)
-
('broadcast %e' - broadcast:)
('broadcast %e and wait' s doBroadcastAndWait)
('when I receive %e' E -)
-
('forever if %b' c doForeverIf)
('if %b' c doIf)
('if %b' c doIfElse)
('wait until %b' s doWaitUntil)
('repeat until %b' c doUntil)
-
('stop script' s doReturn)
('stop all' - stopAll)
'sensing'
('disable remote sensors' - stopRemoteSensors)
"new"
('join mesh on ip:%s' - joinMesh:)
"newend"
('start hosting mesh' - startMeshHost)
('stop hosting mesh' - stopMeshHost)
('ip address' r getIp)
'operators'
('%n + %n' r + - -)
('%n - %n' r - - -)
('%n * %n' r * - -)
('%n / %n' r / - -)
-
('pick random %n to %n' r randomFrom:to: 1 10)
-
('%s < %s' b < '' '')
('%s = %s' b = '' '')
('%s > %s' b > '' '')
-
('%b and %b' b &)
('%b or %b' b |)
('not %b' b not)
-
('join %s %s' r concatenate:with: 'hello ' 'world')
('letter %n of %s' r letter:of: 1 'world')
('length of %s' r stringLength: 'world')
-
('%n mod %n' r \\ - -)
('round %n' r rounded -)
-
('%f of %n' r computeFunction:of: 'sqrt' 10)
'sound'
('play sound %S' - playSound:)
('play sound %S until done' s doPlaySoundAndWait)
('stop all sounds' - stopAllSounds)
-
('play drum %D for %n beats' t drum:duration:elapsed:from: 48 0.2)
('rest for %n beats' t rest:elapsed:from: 0.2)
-
('play note %N for %n beats' t noteOn:duration:elapsed:from: 60 0.5)
('set instrument to %I' - midiInstrument: 1)
-
('change volume by %n' - changeVolumeBy: -10)
('set volume to %n%' - setVolumeTo: 100)
('volume' r volume)
-
('change tempo by %n' - changeTempoBy: 20)
('set tempo to %n bpm' - setTempoTo: 60)
('tempo' r tempo)
'motor'
('motor on for %n secs' t motorOnFor:elapsed:from: 1)
('motor on' - allMotorsOn)
('motor off' - allMotorsOff)
('motor power %n' - startMotorPower: 100)
('motor direction %W' - setMotorDirection: 'this way')
'variables'
('show variable %v' - showVariable:)
('hide variable %v' - hideVariable:)
'list'
('add %s to %L' - append:toList: 'thing')
-
('delete %y of %L' - deleteLine:ofList: 1)
('insert %s at %i of %L' - insert:at:ofList: 'thing' 1)
('replace item %i of %L with %s' - setLine:ofList:to: 1 'list' 'thing')
-
('item %i of %L' r getLine:ofList: 1)
('length of %L' r lineCountOfList:)
('%L contains %s' b list:contains: 'list' 'thing')
).
^ blocks, self obsoleteBlockSpecsOffline
TRocket wrote:
- added konnect menu
- changed title
- added 6 new sensing blocks
- that's all really...
hope you like it![]()
download the scratch source and replace these files:
http://www.sendspace.com/filegroup/pK34 … 9yN84t1zRg
Guess I'm not using it then.


Offline
I'll try to restore it, and I can probably fix the remote sensor connections.
Offline
TRocket wrote:
nickbrickmaster wrote:
TRocket wrote:
thanks![]()
2 things quick:
1. Can I make it that enabling remote sensor connections does not enable mesh?
2. Could you make a |join mesh ip ""| block?
3. I edited the file menu and even after I took the edit away, it says Message not understood: action: if you could help...1. i think remote sensors and mesh are the same thing
![]()
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menu
No, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.
Offline
nickbrickmaster wrote:
TRocket wrote:
nickbrickmaster wrote:
2 things quick:
1. Can I make it that enabling remote sensor connections does not enable mesh?
2. Could you make a |join mesh ip ""| block?
3. I edited the file menu and even after I took the edit away, it says Message not understood: action: if you could help...1. i think remote sensors and mesh are the same thing
![]()
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menuNo, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.
they both seem to use the same server
what do you want me to do?
Offline
TRocket wrote:
nickbrickmaster wrote:
TRocket wrote:
1. i think remote sensors and mesh are the same thing![]()
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menuNo, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.they both seem to use the same server
what do you want me to do?
I guess they do. sorry. Nothing then.
Offline
nickbrickmaster wrote:
TRocket wrote:
nickbrickmaster wrote:
2 things quick:
1. Can I make it that enabling remote sensor connections does not enable mesh?
2. Could you make a |join mesh ip ""| block?
3. I edited the file menu and even after I took the edit away, it says Message not understood: action: if you could help...1. i think remote sensors and mesh are the same thing
![]()
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menuNo, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.
Remote sensor connections shares broadcasts and variables outside of scratch. Mesh is connecting two scratch projects USING remote server connections. You can have remote sensor connections without mesh, but not vice-versa.
Offline
gbear605 wrote:
nickbrickmaster wrote:
TRocket wrote:
1. i think remote sensors and mesh are the same thing![]()
2.i'll try
3.not sure, what did you change?
try clicking changes -> restore recent changes from the world menuNo, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.Remote sensor connections shares broadcasts and variables outside of scratch. Mesh is connecting two scratch projects USING remote server connections. You can have remote sensor connections without mesh, but not vice-versa.
Ok. Thanks.
Offline
nickbrickmaster wrote:
gbear605 wrote:
nickbrickmaster wrote:
No, Mesh is 2 scratch programs connecting together. Remote sensor connections is what allows Python/Java/ActionScript to connect.
And no, I probably can't fix it.Remote sensor connections shares broadcasts and variables outside of scratch. Mesh is connecting two scratch projects USING remote server connections. You can have remote sensor connections without mesh, but not vice-versa.
Ok. Thanks.
i'll try and get this working then...
Offline
TRocket wrote:
ZeroLuck wrote:
TRocket wrote:
ok 184 lines of code and javadoc:
[...]You are new to Java, aren't you?
Because it looks so![]()
used it a bit for four years , what's wrong with it?
The code is not very good
An example:
You connected a Socket in constructor...
Offline
ZeroLuck wrote:
TRocket wrote:
ZeroLuck wrote:
You are new to Java, aren't you?
Because it looks so![]()
used it a bit for four years , what's wrong with it?
The code is not very good
![]()
An example:
You connected a Socket in constructor...
i made it to be simple to use since most people using scratch and java aren't as good/don't know it at all
Offline