Using Sensors

On page 4 of your main notebook is a notebook full of sensors. These are great for making things respond to the mouse and keyboard. There are also sensors for measuring time, getting random numbers, and the address of the house. Some sensors are for bringing in pictures, sounds, text, and ToonTalk objects from the outside. Sensors work very much like the controllers for pictures.

The sensors in the notebook are:

Page 2 - Mouse's Right Speed
This sensor measures how fast the computer's mouse (not Bammer) is moving from left to right. If it is negative the mouse is moving from right to left. A speed of 1000 means the mouse can cross the screen in 1 second.
Page 4 - Mouse's Up Speed
This sensor measures how fast the computer's mouse is moving up. If it is negative the mouse is moving down. A speed of 1000 means the mouse can cross the screen in 1 second.
Page 6 - Mouse's Left Button Clicked
This sensor answers the question, "Was the left mouse button just pressed?" If you press the left mouse button it'll switch from "no" to "yes" and then back to "no" again very quickly. But a robot can catch it and react to it being "yes".
Page 8 - Mouse's Middle Button Clicked
This sensor answers the question, "Was the middle mouse button just pressed?" If you press the middle mouse button it'll switch from "no" to "yes" and then back to "no" again very quickly
Page 10 - Mouse's Right Button Clicked
This sensor answers the question, "Was the right mouse button just pressed?" If you press the right mouse button it'll switch from "no" to "yes" and then back to "no" again very quickly.
Page 12 - Mouse's Left Button Down
This sensor answers the question, "Is the left mouse button down right now?" If you press the left mouse button it'll switch from "no" to "yes" and stay that way until you release the mouse button.
Page 14 - Mouse's Middle Button Down
This sensor answers the question, "Is the middle mouse button down right now?" If you press the middle mouse button it'll switch from "no" to "yes" and stay that way until you release the mouse button.
Page 16 - Mouse's Right Button Down
This sensor answers the question, "Is the right mouse button down right now?" If you press the right mouse button it'll switch from "no" to "yes" and stay that way until you release the mouse button.
Page 18 - Key Just Pressed
This sensor shows the keyboard button that was just pushed. When you push a key, this sensor goes from blank, to showing the key, to blank again very quickly. A robot can be trained to catch the change.
Page 20 - Last Keystroke
This sensor answers the question "What was the last button on the keyboard to be pressed?" It shows the key until another button is pushed.
Page 22 - Shift Button Down
This sensor answers the question "Is the Shift button on the keyboard down right now?"
Page 24 - Control Button Down
This sensor answers the question "Is the Control button (often labeled Ctrl) on the keyboard down right now?"
Page 26 - Milliseconds since Last Frame
This sensor answers the question "How much time has passed since you last answered this question?". The answer is in milliseconds (one thousandths of a second). It is possible to build timers and clocks using this sensor.
Page 28 - Number between 0 and 999
This sensor answers the question "What is a number between 0 and 999?" It tries its best to be random, like flipping a coin or tossing dice. If you want a copy of this that doesn't change drop it on a zero.
Page 30 - To and from other Programs
This sensor connects ToonTalk to the clipboard of Microsoft Windows. If you drop something on this sensor when it is empty (black), then Bammer will smash what you dropped into the clipboard. You can now go to some other Windows program like a mail program or word processor and select Paste from its menu (usually its Edit menu). The text that is pasted can be saved in files, sent by email, or whatever. When you want to go the other direction and bring something into ToonTalk from the outside then just select the text that ToonTalk generated and select Copy from the menu. The ToonTalk clipboard sensor will now show the object that was copied. You can use Dusty to remove it from the clipboard and then spit it out. You can also copy text into ToonTalk this way. Control-c to copy and control-v to paste are convenient keyboard shortcuts.
Page 32 - Hand Visible?
This sensor answers the question, "Is your hand visible?". You can press the space bar while pointing to or holding this sensor and you'll make your hand invisible if its visible or visible if its invisible. When playing a game like Ping Pong (on page 24 of the samples notebook on page 6 of your main notebook) you usually want to hide your hand. This is a good way to let robots do that for you when the game starts. Pushing F9 also hides your hand. Pushing it again shows it.
Page 34 - File to Picture
This sensor converts file names into pictures. Just drop a text pad with the file name of a Windows BMP file onto the sensor and Bammer should smash it. If your picture file is in the ToonTalk "users" subdirectory or the FileSearchPath, then you can use just the short name of the file. You can then remove the picture using Dusty. You can make BMP files in lots of ways - the Paint Brush program included in Windows makes them. You can make the color black in your pictures transparent if you use the visibility controller for your picture. The file name can be a URL like http://www.toontalk.com/ghost.bmp. The file can be JPG, PNG, GIF, or DIB as well if the file name ends with ".jpg", ".jpeg", ".png", ".gif", or ".dib". If you load a picture with a transparent color (currently only GIF and PNG files support this), then that color will be invisible when the picture's visibility is set to 'See Some'. Some GIF files with transparency that display properly in a browser will display in ToonTalk areas as white instead of transparent. Various programs will save these GIF files correctly. For example, reading and writing them into Adobe Photoshop fixes the problem. Also, unfortunately, the Microsoft API being used also makes cyan (100% red, 0% green, and 100% blue) invisible as well. If you need cyan and transparency then don't use a transparent color but use black for transparency (and very near black for when you need black). Or use a color near cyan. You can also bring pictures into ToonTalk by running ToonTalk in a window and then pressing control-F8 to release the mouse and then dragging files into the ToonTalk windows. Pressing control-F8 again restores the mouse. Or by copying the file name in the Windows Explorer and pasting it into ToonTalk.
Page 36 - File to Sound
This sensor converts file names into sounds. Just drop a text pad with the file name of a Windows WAV (sounds) file onto the sensor and Bammer should smash it. The sound will play until finished or you use Dusty to vacuum it off. You can get a sound pad that you can use many times. Just vacuum it off the sensor and have Dusty spit it out. If your wave file is in the ToonTalk "users" subdirectory or the FileSearchPath, then you can use just the short name of the file. You can play a music file using the following MCI remote control. The file name can be a URL like http://www.toontalk.com/noteD.wav. You can also bring sounds into ToonTalk by running ToonTalk in a window and then pressing control-F8 to release the mouse and then dragging files into the ToonTalk windows. Pressing control-F8 again restores the mouse. Or by copying the file name in the Windows Explorer and pasting it into ToonTalk.
Page 38 - Media Control Interface
If you drop a text pad on this sensor, the text is sent to Microsoft Window's Media Control Interface (MCI). This is a general way to play different kinds of media. You can vacuum off the newly created sound pad and use it like any sound. For example, dropping "play c:\windows\media\canyon.mid" on this controller will create a pad for playing the "canyon.mid" MIDI file.
Page 40 - Text to Speech
If you drop a text pad on this sensor, the text is spoken. This creates a sound pad that you can vacuum off the sensor. As a shortcut you can just take the label on page 39 and edit it to be the text you want to hear.
Page 42 - Wall Decoration
This contains a picture of the wall of the room. You can drop pictures and text on top of it and the wall of the room you are in will look just like this sensor.
Page 44 - House Decoration
This contains a picture of the front of the house. You can drop pictures and text on top of it and the house you are in will look just like this sensor.
Page 46 - Roof Decoration
This contains a picture of the roof of the house. You can drop pictures and text on top of it and the roof of the house you are in will look just like this sensor.
Page 48 - My Address
On this page is a box with 2 sensors showing the address of the house it is in. The first sensor shows the avenue number and the second sensor the street number. Avenues run north and south. Streets run east and west. You can make new addresses from old ones. If you drop an address on a truck, then the crew will build a house as close as they can to that address.
Page 50 - Language
This displays the name of the language currently being used by ToonTalk. Some values are "English", "Brasileiro", "PortuguÍs", and "Swedish".
Page 52 - Foreign Bird
This contains a bird that can fly outside of ToonTalk and make connections with the operating system and other external services.
Page 54 - Joystick
A notebook of joystick sensors. This notebook will only appear if you have connected a joystick to your computer. You may need to tell Windows about your joystick or game controller. If you have more than one joystick connected to your computer the following pages will have notebooks for those joysticks. There are many joystick sensors. If the joystick is a force feedback device then an additional notebook will appear for using force effects.

home | search | purchase | manual | news | info | games | faq | support | downloads | endorsements | press | contact us