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

#1 2013-01-02 05:55:28

mactro
New Scratcher
Registered: 2013-01-02
Posts: 4

BYOB - error when adding Morph to the World

Hello,

that's my first post here, so hi everybody  smile  I'm writing a small extension to BYOB that will talk to the Arduino board over serial. I want BYOB to receive data from Arduino every 100ms (exact timing is not critical), so I thought I'll go with Morph stepping to do that. If I'm correct, I have to add a morph to the World, to use stepping. Unfortunately, when I try to do that, VM crashes and goes to emergency evaluator. What am I doing wrong? The code for test class is below:

Code:

Morph subclass: #StepTest
    instanceVariableNames: 'c1 '
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Test'

StepTest>>initialization

Code:

initialize
    super initialize.
    c1 _ 0.
    World addMorphBack: self

It crashes when I call StepTest new. Oh, BTW, with normal Scratch it works just fine.

Of course, if there's a way to do some periodic activity without stepping, it will be ok also.

Offline

 

#2 2013-01-02 09:37:53

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: BYOB - error when adding Morph to the World

I think mactro accidentally hit report rather than quote  tongue  Here's what he said:

mactro wrote:

I have found a mistake - the code above was copied from working Scrach version - in BYOB it lacked "super initialize". After adding it, all works fine, so the topic can be deleted.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer