Home
Project Folders
Teacher Resources
Student Resources
How Do I?
Literacy
MWForum
Site Map
Search
Our Team

MWForum Message [Date Index] [Threads] [Authors] [Attachments] [Subscribe]

[Thread Prev] [Thread Next]

To: mwforum@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: Does key? tell whether keyboard buffer is non-empty?
From: Don Stone <don.stone@xxxxxxxxxxx>
Date: Fri, 29 Dec 2006 12:20:59 -0500

Hello, All,

I am a retired computer science professor who many years ago taught a Logo course for liberal arts students. My Logo now is somewhat rusty, but I am trying to work with my nephew (an 8th-grade student) on a MicroWorlds game. (He took a special MicroWorlds course at school.)

{The following is an updated version of a one-time-only question I submitted yesterday as a non-subscriber.}

In our game each player's piece (a turtle) moves every quarter-second or so. (The time interval between moves is specified by the variable :interval.) What we want to do is collect all the keystrokes typed during that interval and set heading variables from them. The key? demo in the MicroWorlds Vocabulary documentation page looks like it has the elements we need, but unfortunately we can't see all the code behind it. I am interpreting the MW documentation to be saying that key? is true when the keyboard buffer is non-empty; is this correct? Our attempt (below) based on this interpretation doesn't work. What are we doing wrong? Thanks for any assistance! (We have MicroWorlds Pro 1.1.)

 -- Don Stone

to getcommands
wait :interval
forever [
 ifelse key? [
   make "move readchar
   if :move = "a [make "dir1 270]
   if :move = "w [make "dir1 0]
   {etc.}
   ]
   [stop]
 ]
end


  • Previous by thread: MIA, Ask an Expert: show the ASCII code for '?'
  • Next by thread: Re: Does key? tell whether keyboard buffer is non-empty?

  • To save an attachment to your computer, PC users should right-click (Mac users, click and hold the mouse button) on the link and then choose 'save target as' from the pop-up menu. A window will then pop up in which you can choose a location for the file.


    © copyright 2001 - 2008