This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-02-02 09:15:29

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Enabling Remote Sensors in Scratch.image

I want to have the remote sensors enabled when Scratch starts.
Does anybody now how to edit Scratch.image (I know how to open it), so that the remote sensors are enabled on startup?

Offline

 

#2 2013-02-02 11:47:49

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Enabling Remote Sensors in Scratch.image

remote sensors is basically mesh. So you want to host a mesh session.

You want to run "Scratch-Networking>ScratchServerV1>server>openServerSocket" I belive, so goto "Scratch-UI-Panes>ScratchFrameMorph>startup>startup" and add this line under 'ScratchFrameMorph readShareServerEntry.": "ScratchNetworking ScratchServerV1 server openServerSocket."

It should work, i'm not exactly sure  tongue
EDIT: Okay, it didn't work. So don't use that method.

Last edited by DigiTechs (2013-02-02 11:49:39)


I'm back.
Maybe.

Offline

 

#3 2013-02-05 13:14:12

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

@DigiTechs: Thanks for the effort.

Somebody else a solution?

Offline

 

#4 2013-02-06 10:13:04

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Enabling Remote Sensors in Scratch.image

sdmeijer wrote:

@DigiTechs: Thanks for the effort.

Somebody else a solution?

There is a way to change the default project that opens up (I forgot how) but if you look around you may be able to find it. If you enable remote sensors in the default project and then save it, it should automatically enable remote sensors every time you open Scratch.

Last edited by Magnie (2013-02-06 10:13:49)

Offline

 

#5 2013-02-06 10:38:54

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Enabling Remote Sensors in Scratch.image

the method to enable it is enableRemoteSensors at ScratchFrameMorph, you can add it to its initialize method

Offline

 

#6 2013-02-06 10:43:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Enabling Remote Sensors in Scratch.image

roijac wrote:

the method to enable it is enableRemoteSensors at ScratchFrameMorph, you can add it to its initialize method

I'm not quite sure whether it will definitely work in the initialize method. To be sure I would personally put it in ScratchFrameMorph's startup method.

Offline

 

#7 2013-02-06 11:33:31

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

Thank you for the replies.
I'm not that good with SquakVM.
@roijac and/or LS97, is it possible to write a small how-to for me? I know how to get into the image, but what code should I put at which place?

Offline

 

#8 2013-02-08 16:04:13

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

Ok, solved it.
I've added the code from enableRemoteSensors to startup.
Then in startup-startup I've added the line
     self enableRemoteSensors.

after the line
     self updateProjectName.

Offline

 

#9 2013-02-08 16:23:11

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

sdmeijer wrote:

Ok, solved it.
I've added the code from enableRemoteSensors to startup.
Then in startup-startup I've added the line
     self enableRemoteSensors.

after the line
     self updateProjectName.

Should be:

I've added the code from enableRemoteSensors to startup.

Offline

 

#10 2013-02-08 17:38:14

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

Please, ignore my last two posts.

Offline

 

#11 2013-02-08 17:42:48

sdmeijer
New Scratcher
Registered: 2012-12-31
Posts: 15

Re: Enabling Remote Sensors in Scratch.image

I've enabled remote sensors through scratch.ini:

Add the following to scratch.ini

Code:

    remote=1 (or 0)

Add the following to [Scratch-UI-Panes] - [ScratchFrameMorph] - [startup]

Code:

enableRemoteSensorsStartup
    | t1 |
    workPane scratchServer
        ifNil: 
            [t1 _ ScratchServer new userName: 'Scratch'.
            t1 stage: workPane.
            workPane scratchServer: t1].
    workPane scratchServer startHosting

Add the following to [Scratch-UI-Panes] - [ScratchFrameMorph] - [startup] -> [processSettingsFile]:

Code:

    t3 = 'remote'
        ifTrue: [t4 value = '1' ifTrue: [self enableRemoteSensorsStartup]].

Offline

 

Board footer