Note

Quick script that detects an object called Well Sample Bottle when it comes in a 1m range. Once it does, the script switches to the display state and sets the texture to sample. It then pauses for 5 minutes, sets the texture to 0f0d3af1-f8fb-d2e9-d9a7-98ab76724e0c and goes back to the default state.

This was used to create a camera-enabled microscope.

Code

object_detector.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
default {
    state_entry() {
        llSensorRepeat("Well Sample Bottle", "", ACTIVE|PASSIVE, 1, TWO_PI, 1);
    }
    sensor(integer num) {
        state display;
    }
}
 
state display {
    state_entry() {
        llSay(0, "You put a sample on a slide and the microscope displays the collected sample on the screen.");
        llSetTexture("sample", 3);
        llSetTimerEvent(300);
    }
    timer() {
        llSetTexture("0f0d3af1-f8fb-d2e9-d9a7-98ab76724e0c", 3);
        state default;
    }
}