Shortnote

This script is responsible for listening to search queries on channel -183456 from a primitive named Oracle and sending back search results on channel -183457. This is later used in the Oracle script that allows avatars to quickly locate documents in the bookshelves (please see video on the Project Alexandria page).

Code

This script was tested and works on OpenSim version 0.7.4!

search.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - 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() {
        llListen(-183456, "Oracle", "", "");
    }
    listen(integer channel, string name, key id, string message) {
        // search object description
        if(llSubStringIndex(llToLower(llGetObjectDesc()), llToLower(message)) == -1) jump name;
        llRegionSay(-183457, "@pos=" + (string)llGetPos() + ";" + llGetObjectDesc());
@name;
        // search name
        if(llSubStringIndex(llToLower(llGetObjectName()), llToLower(message)) == -1) jump cards;
        llRegionSay(-183457, "@pos=" + (string)llGetPos() + ";" + llGetObjectDesc());
@cards;
        // search notecard name
        integer i = llGetInventoryNumber(INVENTORY_NOTECARD)-1;
        do {
            if(llSubStringIndex(llToLower(llGetInventoryName(INVENTORY_NOTECARD, i)), llToLower(message)) == -1) jump next;
            llRegionSay(-183457, "@pos=" + (string)llGetPos() + ";" + llGetObjectDesc());
            return;
@next;
        } while(--i>-1);
    }
 
}

opensim/project_alexandria/search.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.