Web help 
Author Message
 Web help

In terms of programming arrow keys in MicroWorlds, it is simple
enough to combine both the PC and the Mac ascii codes into one
procedure.  I learned this from Michael Tempel when we were both
visiting OpenWorld Learning in Colorado last June.  But he used
different ascii numbers for the arrow keys on the PC than Jeff has
given. Here is what Michael uses.  (He adds a "go" button and
procedure to set the turtle in motion and activate the key
programming. The turtle's command is FD 1, set to many times.  With
today's faster computers, it might be better to give the turtle the
command FD 1 / 10 or another fraction, or if you have a slider named
speed then the turtle's command could be  FD SPEED / 10 and you'd
have to figure out an appropriate maximum for the speed slider).  The
first four ascii codes are for PC (different from Jeff's numbers);
the second four are the Mac codes which Jeff also uses:

to go
    forever [direct readchar]

to direct :key
if (ascii :key) = 37 [ seth 270]
if (ascii :key) = 39 [ seth 90]
if (ascii :key) = 38 [ seth 0]
if (ascii :key) = 40 [ seth 180]
if (ascii :key) = 28 [ seth 270]
if (ascii :key) = 29 [ seth 90]
if (ascii :key) = 30 [ seth 0]
if (ascii :key) = 31 [ seth 180]
if :key = "s [stopall]

Of course, another solution would be to use four letter keys instead
of using arrow keys.  That way, the same four commands work for PC or

In fact, if you program two sets of letter keys, you can have four
keys control one turtle and four control another turtle so that two
students can compete with each other to see which turtle can get
through the maze more quickly (or accomplish some other goal).  You
can use keys A, S, D, and W to control one turtle and keys J, K, L,
and I to control the other one.  (Of course, in that case you could
not use the S key to stop the procedure.  You could include
a "stopall" button or program a different key.) You need to designate
which turtle will respond to each key.  So a two-turtle control
procedure might look like this:

to direct :key
if :key = "a [t1, seth 270]
if :key = "s [t1, seth 180]
if :key = "d [t1, seth 90]
if :key = "w [t1, seth 0]
if :key = "j [t2, seth 270]
if :key = "k [t2, seth 180]
if :key = "l [t2, seth 90]
if :key = "i [t2, seth 0]

(If you really want to form a crowd around one computer, you could
program the arrow keys too, for a third student to control a third

Wendy Petti
MicroWorlds in Action

> one way around this could be to provide
> alternative procedures for Mac or Win users, to be selected and
invoked by
> the user with a Button or similar. here's how the alternates could
> look(the trick is in the different sets of ascii numbers for the 2
> different machines:

> *Mac
> TO Direction :Key
> IF (ASCII :Key) = 28 [ SETH 270]
> IF (ASCII :Key) = 29 [ SETH 90]
> IF (ASCII :Key) = 30 [ SETH 0]
> IF (ASCII :Key) = 31 [ SETH 180]
> IF :Key = "s [STOPALL]

> That's set for a Macintosh...for Windows the set of ASCII numbers
> if (ascii :key) = 72 [seth 0]
> if (ascii :key) = 77 [seth 90]
> if (ascii :key) = 80 [seth 180]
> if (ascii :key) = 75 [seth 270]

> These two procedures are made so that you could have a Turtle
> for Many Times. But the important part is the list of ascii
> numbers that are the codes for the arrow keys...note that the key
for the
> letter 'S', which I've programmed as an emergency stop, doesn't
need to be
> translated to ascii for MicroWorlds to recognise it.
> Your maze asks the user to click on the 'stop' icon in MWpro, which
is not
> displayed when the project is running over the www.

> cheers

> Jeff Richardson

> > I posted a MicroWorlds Pro project on the web.  some computers
get it
> > some don't.

> > The project is a maze.  Gary S. gave me info on how to change the
> > so that I can use the key board and not buttons on the page.  I
am on
> > a PC and it seems as though my friend (on a Mac) does not have
> > control.  Can anyone think of why?

> > If you would like to view the project...please do.  Any
> > are warmly welcome!

http://www.*-*-*.com/ ~lmcrupi/ed664/project/mwproject/indexmaze.

> > html

To unsubscribe from this group, send an email to:

LogoForum messages are archived at:

Your use of Yahoo! Groups is subject to http://www.*-*-*.com/

Tue, 25 May 2004 21:24:26 GMT  
 [ 1 post ] 

 Relevant Pages 

1. FTP downloading from web-Help?

2. Web help - more feedback on maze project

3. Web help

4. Web help for TASM

5. COBOL on the Web....HELP!


7. Web Services help needed please

8. Web Server - Need some help to start me off

9. Help: Multiple web connection images on same box?

10. Need help by VAST Web Connection

11. Help with VAST 5.0 Web Connect

12. Help with Web enabling


Powered by phpBB® Forum Software