Jump to content

Viewer 2.x search helper (repost)


Cerise1488303085
 Share

You are about to reply to a thread that has been inactive for 4733 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

(This ia a repost from the archive. The original was one of the scripts corrupted by the transition from Jive to Lithium.)

This only works in Viewer 2.0 or later. It lets you search in Places, People etc. without having to search for All first.  This page has the URL documentation.

 

As an aside: If your computer is set up to favor a single processor core (or it has a single core), you could be able to make search, profiles and other pages load much faster with a debug setting. This works well on Windows and OS X for me, your mileage may vary.

  1. Press Ctrl+Alt+D to reveal the Advancd menu.
  2. Go to Advanced>Show Debug Settings
  3. Type PluginInstancesCPULimit in the drop down menu.
  4. The default value is 0.9, change it to 0.5. Lower is not always better, in particular 0 disables this feature, so don't use that value.

 

// viewer 2 search helper
//
// put this in a prim and wear.
// Type the commands on chat.
//
// can use /4search or /4find, they are the same
//
// Show all the events:
//
// /4 find events
//
// Find something in all:
//  /4 find all "paper airplanes"
//
// Find something in places --
//  /4 find places blue skirt
//  /4 find places "tiny avatars"
//
// Pick a search category from a dialog --
//  /4 find 
//
// If the second word on your command is not in
// gSearchTypes you get an "all" search.

// put link in chat if FALSE or in a dialog if TRUE
// the dialog is nice if you are in a busy place
integer gUseDialog = TRUE;
integer gCmdListenChannel = 4; // take commands on this channel


integer gDlgListenChannel = -54738920;

integer gCmdListener;
integer gDlgListener;
integer gDlgPending = FALSE;
list gSearchTypes = ["all", "people", "places", "events", "groups",
                     "wiki", "destinations", "classifieds"];

Setup()
{
    // to run in no script places
    llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS);
    llListenRemove(gCmdListener);
    llListenRemove(gDlgListener);
    gCmdListener = llListen(gCmdListenChannel, "", llGetOwner(), "");
    gDlgListener = llListen(gDlgListenChannel, "", llGetOwner(), "");
    llListenControl(gDlgListener, FALSE);
}


SearchDialog(string where, string what)
{
    if (what == "")
        what = "*";

    string message =
        "Click below to search in " + where + " for " + what + " :\n" +
        "secondlife:///app/search/" + where + "/" + llEscapeURL(what);

    if (gUseDialog)
    {
        llDialog(llGetOwner(), message, ["Close"], -346738479);
    }
    else
    {
        llOwnerSay(message);
    }
}

default
{
    state_entry()
    {
        if (llGetAttached())
            Setup();
    }

    attach(key id)
    {
        if (id)
            Setup();
    }

    listen(integer channel, string name, key id, string str)
    {
        if (channel == gCmdListenChannel)
        {
            list words = llParseStringKeepNulls(str, [" "], []);
            if (llListFindList(["search", "find"], [llList2String(words, 0)]) == -1)
                return; // it is not for me

            integer wordCount = llGetListLength(words);

            if (wordCount == 1)
            {
                llListenControl(gDlgListener, TRUE);
                gDlgPending = TRUE;
                llSetTimerEvent(0.);
                llSetTimerEvent(30.);
                llDialog(llGetOwner(), "Search where?", gSearchTypes, gDlgListenChannel);
            }
            else
            {
                if (llListFindList(gSearchTypes, [llList2String(words, 1)]) == -1)
                {
                    SearchDialog("all",
                        llDumpList2String(llDeleteSubList(words, 0, 0), " "));
                }
                else
                {
                    SearchDialog(llList2String(words, 1),
                        llDumpList2String(llDeleteSubList(words, 0, 1), " "));
                }
            }
        }
        else if (channel == gDlgListenChannel)
        {
            llSetTimerEvent(0.);
            gDlgPending = FALSE;
            llListenControl(gDlgListener, FALSE);
            SearchDialog(str, "*");
        }
    }

    timer()
    {
        llSetTimerEvent(0.);
        if (gDlgPending)
        {
            llOwnerSay("Find category dialog timed out");
            llListenControl(gDlgListener, FALSE);
        }
    }

    run_time_permissions(integer p)
    {
        if (p & PERMISSION_TAKE_CONTROLS)
            llTakeControls(CONTROL_FWD, FALSE, TRUE);
    }
}
Link to comment
Share on other sites

 


Canoro Philipp wrote:

i have PluginInstancesCPULimit, PluginInstancesLow and PluginInstancesNormal set to -2147483.750

it made Second Life faster, and everything is working fine. i made that number by writing 999999999999999 as the value.

can you explain what this fields do?

 

 

If you set the values out of range, they will generally be clamped, but it is better to stick to the "real" ranges so you don't have to fish in the source to see what you are really getting.

PluginInstancesCPUlimit looks at system load. If plugin use is above the number in there, SLPlugins will be "niced" or made to run at a lower priority.  The only "real values" are between 0.0 and 1.0, 0.0 disables and the lower the nonzero number, the less piggy the plugins will try to be.  I picked 0.5 to make sure that SL itself can get a good chunk of the CPU.

PluginInstancesLow can be however high you like, but I don't think it will get an opportunity to do much if you don't let them run at high priority to start. PluginInstancesNormal should be ok at 0 if you want to prevent those.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4733 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...