Etoys Tips and Tricks


Jump to: navigation, search

Just a few tips and tricks to overcome a few common hurdles your average Etoys beginner (that would be me) might run into.



when image hangs: alt-.

recover from hang on smalltalk level: world-leftclick > changes > recently logged changes. Select all the relevant changes and file them in.

Text input box hacks

the Etoys input box is a bit flaky and basic at the moment. One of the OLE Nepal guys is working on a general fix, but for now we can tweak it with a few hacks:

Textboxes change size, depending on whether there is text in there or not. We can fix this by opening an inspector on an instance and execute:

self beAllFont: (StrikeFont familyName: 'BitStreamVeraSans' size: 24)

Or whatever font you want it to be of course.

To let the box respond with a function on a carriage return, define an etoys script (or squeak function) with, say, name #myOwnFunction, open an inspector on the appropriate instance and execute: self crAction:(MessageSend receiver: self player selector: #myOwnFunction)

To obtain keyboard focus on the textbox of your choice, you can use the following function:

	ActiveHand keyboardFocus: self costume renderedMorph.
	self costume renderedMorph editor selectAll

The last line perhaps doesn't give you what you want, cause it selects the whole text every time focus is lost and regained again, but you can always take it away of course.

Installing Monticello on your Etoys image

At the moment you hit upon a bug when you want to install Monticello in an Etoys image through Squeakmap.

Before installing you must execute:

MczInstaller clearVersionInfo

You can also try this procedure:

First download MonticelloBackport.8.cs and (or, if you want to install monticello as part of the Epaati image customization procedure, go to the monticello-hack-files dir in etoys-migration-files)

Load the MonticelloBackport.8.cs file into your image and then load the file. While loading the latter you will hit upon an error about a key not being found. Push 'debug' -> 'full stack' and find MCWorkingCopy class>>initialize in the stack trace. Return 'nil' from it by middle-clicking on the text, selecting 'return entered value' and accepting. Press 'Proceed'. Then open a workspace or something and execute 'MCWorkingCopy registerForNotifications'. This should provide you with a working Monticello of sorts.

Others have reported difficulties with their setup. In our Epaath-activity setup there's only one major tweak to be done: revert SystemProgressMorph>>label:min:max: to the version labelled 'yo 9/18/2006 21:47'.

There might be another way around this bug, which we have yet to try. There's a compatibility layer called 'level playing field' (levelPlayingField/ which tries to smoothen out the differences between different image forks (at time of writing (13 aug. 08), LPF didn't yet work with the latest Etoys release. According to info from mailinglist/irc the maintainer didn't seem so concerned about possible difficulties with supporting it.) Or we could fix the bug of course!!

Profiling in Smalltalk

From Luke Gorrie's mail on the Etoys list:

In this case what I did was find the guts to project loading (ProjectLoading>>openName:stream:fromDirectory:) and wrap most of the method body up like this:

TimeProfileBrowser onBlock: [
... original code ...

and that popped up a window with excellent time profile information. An alternative way to do this, which doesn't interact so well with project loading specifically, is to use WorldMenu->debug->'Start message tally' and then drag the mouse to the top of the screen to finish profiling.

Now when I'm looking at memory usage I'm using:

SpaceTally new printSpaceAnalysis

and then running its output (STspace.txt) through e.g.:

awk '$5 > 1 { print }'

to see classes accounting for >= 1% of memory usage. Then individually I can do something like:

(Bitmap allInstances select: [:b | b size > 100000]) explore

and use the inspector's 'chase pointers' command to get some idea of why each one exists.

Positioning of players

You've been there right?: You have 34 objects in your etoys window and you want to position them evenly. So you measure the space you want to cover, do a quick calculation, open the viewer for every player and adjust the x and the y accordingly. Tedious, boring and mind-numbing. So much so that you stopped developing with Etoys altogether. If this is your story, then rejoice! Cause there is a better way!:

One can group different player objects by pressing shift and the left mouse button (forgot which color that is) while mousing around. This will create a rectangle which selects every player which it wholly contains (much like your favorite RTS). Letting go will keep the rectangle in place.

And now the fun begins. Cause by clicking the halo-menu-icon you'll be presented with a couple of align commands at the bottom of the option pane. You can for example align them horizontally, or at the top edge of your rectangle.

How's that for an easter egg!!

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
OLPC wiki