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: Re: Does key? tell whether keyboard buffer is non-empty?
From: "Daniel Ajoy" <da.ajoy@xxxxxxxxx>
Date: Fri, 29 Dec 2006 21:19:28 -0500

Hi,

I would use just readchar instead of "key?" (project attached).

--------------------------------------------------
On 29 Dec 2006 at 12:20, Don Stone wrote:

> 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.

The page is:

"C:\Program Files\LCSI\MicroWorlds Pro\Help\MWVoc\primitiv\keyp.htm"

The code of that page says:

<embed src="getpage.mw2" width="120" height="120"  ....

The project is at:

"C:\Program Files\LCSI\MicroWorlds Pro\Help\MWVoc\primitiv\getpage.mw2"

the code says:

to flip
let [list pagelist]
make "list se bf :list first :list
forever [if key?
   [turn first :list
    make "list lput first :list bf :list]]
end

to turn :page
let [a readchar]
getpage :page
end

to startup
flip
end


> I am interpreting the MW documentation
> to be saying that key? is true when the keyboard buffer is
> non-empty; is this correct?

I think there is no buffer. key? only reports wheather a key
is being pressed.

> 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
>
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.

   ---- File information -----------
     File:  ReadChar.mw2
     Date:  29 Dec 2006, 21:09
     Size:  23747 bytes.
     Type:  Unknown

Attachment: ReadChar.mw2
Description: Binary data


  • Previous by thread: Does key? tell whether keyboard buffer is non-empty?
  • 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