Thankyou for you post, a few comments though.
You don't need a "Loop", the whole idea of KEYBOARDON is that
an "action" (an event) will be called *when* any key is hit.
Now MSWLogo will be idle (until a key is hit) instead of
spinning its wheels on the loop (chewing up the CPU). It's
also now free to program other "events" like the MOUSEON command.
Your "baby" routine now just "sets up" your keyboard-action-handler.
and "babydone" (new routine) "shuts down" your handler. When a key
is hit the code in the list following KEYBOARDON will be executed,
which in turn calls your action.
Notice the "shut down" of the handler is now simply another case
of your existing handler, rather than a condition to exit the
loop.
You could also do some other neat baby stuff like drag a square
block over a square hole with the mouse, round block over round
hole etc... Play a little MIDI or WAVE jingle on success.
to action :opt
if memberp :opt [ 70 102 ] [ babydone stop ] ; "fF"
if memberp :opt [ 65 97 ] [ fd 20 stop ] ; "aA"
if memberp :opt [ 73 105 ] [ bk 20 stop ] ; "iI"
if memberp :opt [ 83 115 ] [ lt 45 stop ] ; "sS"
if memberp :opt [ 68 100 ] [ rt 45 stop ] ; "dD"
if memberp :opt [ 84 116 ] [ home stop ] ; "tT"
if memberp :opt [ 67 99 ] [ clean stop ] ; "cC"
if memberp :opt [ 82 114 ] [ setpencolor [ 255 0 0 ] stop ] ; "rR"
if memberp :opt [ 86 118 ] [ setpencolor [ 0 255 0 ] stop ] ; "vV"
if memberp :opt [ 66 98 ] [ setpencolor [ 0 0 255 ] stop ] ; "bB"
if memberp :opt [ 78 110 ] [ setpencolor [ 0 0 0 ] stop ] ; "nN"
if memberp :opt [ 71 103 ] [ setpencolor [ 255 255 10 ] stop ] ; "gG"
if equalp :opt 48 [ pu stop ] ; "0"
if and :opt > 48 :opt < 58 [ ~
pd ~
make "size :opt - 48 ~
setpensize list :size :size stop ] ; "1-9"
end
to baby
icon [ Commander ]
setfocus [ MSWLogo Screen ]
keyboardon [ action keyboardvalue ]
end
to badydone
keyboardoff
unicon [ Commander ]
end
-- =============================================================== George Mills email: mills@softronix.com http://www.softronix.com The www page contains some very powerful educational software. Our single most important investment is our kids.--------------------------------------------------------------- Please post messages to the Logo forum to logo-l@gsn.org. Mail questions about the list administration to logofdn@gsn.org. To unsubscribe send unsubscribe logo-l to majordomo@gsn.org.