Example Home Alarm System (version 0.4)
Ruben Kleiman (SomeScripter)
The code is licensed under LGPL: that is, you can use it for any purpose, but
you should acknowledge the author in the sources.
This code teaches you how to monitor your Second Life home using a web browser. A server is not
In addition, as people ask me questions, I will add information on useful variations on this code
in the Variations On The Theme
section at the end of this page.
Pre-requisites: Basic familiarity with LSL language and with DHTML.
The code for this tutorial consists of two files:
I provide you with (read Instructions
below to access them):
- A ready-to-run, SL script that you can attach to any SL object in your Second Life property.
- An HTML page that communicates with the SL script.
read the instructions in this page before asking me any questions.
This is not a trivial application. Thanks!
: Until version 1.0 is released, some of the
functionality will be turned on or off, but the main system will function. Documentation will be
available in version 1.0. Until then, the code documentation are
meaningful variable and function names and some comments.
Please do not contact me unless you have carefully
the instructions in this page (thanks!).
: This works only in Internet Explorer right now. An ActiveX
object is used
to communicate via XML-RPC: you must unblock it if your IE browser blocks it (the default).
I'll change it to work with other browsers when I have the time; the only issue is
the different way Mozilla-based browsers handle certification.
Follow these steps in order:
1. Copy the contents of the following LSL script to an object located in your property:
2. Enable the script by touching the object (follow object's instructions); disable it by touching it again.
The alarm object in SL should acknowledge that it started (chat message).
3. When the alarm starts, you will get a chat message with the alarm's monitoring channel key. Copy and
paste it so that you can use it in step 6, below.
4. Copy the contents of the html code in http://home.earthlink.net/~kleiman/examples/home_alarm04_html.txt
into a text file in your computer, save it with an .html extension,
and open it in Internet Explorer
. Save it in Notepad (Windows),
but not in a word processing program like Word.
5. Open the HTML page.
5.a If the Internet Explorer
banner at the top of the page asks you whether
to allow an ActiveX
control to run, click on the banner message and select
"Allow Blocked Content..." I use a standard ActiveX
component that lets your
browser communicate with the Second Life server (and thus to your script).
5.b Ensure that cookies are enabled in your browser or else accept cookies from the page.
I use a cookie to save your configuration information.
6. Enter the alarm system key (see step 3, above) into the "Channel Key"
field in the "Alarm Configuration Settings" sections of the page.
The setting will take effect once you out of the field.
(Right now, the only way to go back to the default settings is
to remove the alarm system's cookie.)
7. On the web browser, click on the "Start" button to start monitoring from your browser location.
Your should immediately see status information and you will get results in a few
seconds. Wait 20 seconds. In version 0.4, the browser will poll the home alarm system every 20 seconds
This is a configurable setting.
(being nice to the poor little overworked SL servers out there).
Some debugging information from your SL alarm object may from time to time show up as chat.
8. Until the 1.0 release,
I urge you not to change the configuration settings
other than the alarm's monitoring channel key, as necessary.
If you change any settings, some may not work as expected or your alarm
system might crash due to problem described in Known Problems
1. Have you followed the steps in the instructions in the right order?
2. Are you sure that you started the alarm? The alarm will give
you a message when it starts. Touch it again if you are not sure.
3. Are you sure that the alarm key that you entered in your
browser is the same as the home alarm's key?
4. Have you limited your monitoring to one browser at a time?
5. Are you not sure that your Internet Explorer
properly initialized? Start Internet Explorer
delete all cookies (Tools -> Internet Options); then open
the alarm system page again and enter the monitoring channel key.
(If you want to manually delete just the alarm system cookie, its
name starts with _rk_.)
6. Nothing happens? Make sure that you have started the alarm system object in SL
and that you have clicked the "Start Monitoring" button in the web browser page.
Look at your chat messages in SL to make sure that your alarm object is healthy
(it will tell you if/when it crashes).
1. If the number of sensed objects is large, you will get a stack heap crash.
The default configuration settings will minimize but
not necessarily eliminate this possibility.
2. Changing configuration settings may precipitate problem #1.
Variations On The Theme
Is it possible to send binary data to the SL server?
In theory, yes. In practice, you need to be aware that:
(1) Data is marshalled in XML, which is based
on a character set rather than on a binary format.
(2) The file size of an XML file accepted by the SL server
is arbitrary; we have no control over it.
(1) Binary format: Pack and unpack your binary file data into a format that will
survive the network and transport layers. One such format is Base64
into a Base64
string. Similarly, on the SL script side, change it
to convert the received (Base64
) string into binary
using llBase64ToInteger. What you do with the binary data
is up to you from here on.
(2) File size: experiment with increasingly large file sizes until you get an error.
That will tell you the actual maximum file size.
Examples Jasa SEO Murah Jasa SEO Jasa Google Adwords Jasa Adwords Google Adwords Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Govr Edo Ziedo Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Penumbuh Rambut Kursus SEO Jam Tangan Casio Grosir Baju Bisnis Online Kerupuk Kulit Social Bookmark Kumpulan Puisi WBC Wonogiri Penumbuh Rambut Jam Tangan Murah Jam Tangan Murah Jam Tangan Casio Penumbuh Rambut Kerupuk Kulit Alat Kantor Laku.com Belanja Online Grosir Eceran Murah dan Aman Jasa SEO Model Jilbab Fine Tableware Permanent Hair Removal island investment development professional makeup artist bali private villa sewa mobil jakarta murah Jual rumah Jakarta Contact Lens Technology