Jump to content

Name2Key - vwrsearch workaround


MartinRJ Fayray
 Share

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

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

Recommended Posts

Vwrsearch (a wide-spread workaround for Name2Key scripts, using the official Second Life database) has been broken for almost 2 weeks.

I just helped someone creating a workaround, and decided to share it here.

EDIT Please use the version here: http://pastebin.com/ABhtrnJH because the forum-software automatically shortens the url of my code-example, if you like to copy-paste the code.

string sUrl = "http://anonymouse.org/cgi-bin/anon-www.cgi/http://search.secondlife.com/client_search.php?s=people&session=00000000-0000-0000-0000-000000000000&mat=7&q=";
string sSearchString = "http://world.secondlife.com/resident/";
integer iKeyLength = 36;
string sMessage = "Please say the name in chat!";
string sMessageSearching = "Searching for: ";
string sMessageResult = "Result: ";
float fTime = 20;
integer iListen;
default
{
    touch_start(integer total_number)
    {
        llSetTimerEvent(fTime);
        iListen = llListen(PUBLIC_CHANNEL, "", llDetectedKey(0), "");
        llSay(PUBLIC_CHANNEL, sMessage);
    }
    timer()
    {
        llListenRemove(iListen);
        llSetTimerEvent(0);
    }
    listen(integer channel, string name, key id, string message)
    {
        if(llToLower(llGetSubString(message,-8,-1)) == "resident")
        {
            message = llGetSubString(message,0,-9);
        }
        llListenRemove(iListen);
        llSay(PUBLIC_CHANNEL, sMessageSearching + message);
        llSetTimerEvent(0);
        llHTTPRequest(sUrl + llEscapeURL(message), [HTTP_BODY_MAXLENGTH,16384], "");
    }
    http_response(key request_id, integer status, list metadata, string body)
    {
        string sResultKey = "";
        integer iResultPos = llSubStringIndex(body, sSearchString);
        if (iResultPos != -1)
        {
            iResultPos = iResultPos + llStringLength(sSearchString);
            sResultKey = llGetSubString(body, iResultPos, iResultPos + iKeyLength-1);
        }
        llSay(PUBLIC_CHANNEL, sMessageResult + sResultKey);
    }
}

 

 I hope this helps:)

  • Like 2
Link to comment
Share on other sites

That does not seem to work. The problem is the limit of body in http_response(key request_id, integer status, list metadata, string body) : 1024 or 2048 characters maximum. The information you want is beyond this limit; add llOwnerSay(body) just after http_response() to understand what i mean. That won't work either from outside SL for example in a google application because the google application will only have access to the contents rated "General". And some avatars have their profile rated Mature or even Adult.

Link to comment
Share on other sites

@Dahlia:

the llOwnerSay() function truncates the chat message at 1024 characters, the chat output doesn't reflect what gets sent to the http_response. The body of the http_response is truncated at 2048 characters, which is sufficient.

 

Also note that I set the maturity rating to mat=7, which means ALL results: http://anonymouse.org/cgi-bin/anon-www.cgi/http://search.secondlife.com/client_search.php?s=people&session=00000000-0000-0000-0000-000000000000

&mat=7&q=

Give it a try:)

 

I've successfully tested it numerous times.

Link to comment
Share on other sites

if the name is input as " something Resident" it fails to find the key, so add this to the listen.

listen(integer channel, string name, key id, string message)
{
if(llToLower(llGetSubString(message,-8,-1)) == "resident")
{
message = llGetSubString(message,0,-9);
}
llListenRemove(iListen);

Link to comment
Share on other sites

I am pretty sure that you're not hitting the limit, but instead you are looking up profiles of residents who hide their info from search.

You will not be able to find someone who chooses to hide their profile from search, with this script.

Can you show me an example where it fails?

Link to comment
Share on other sites

You can change the default max bodylength of the http-request (see also https://wiki.secondlife.com/wiki/HTTP_BODY_MAXLENGTH ).

This works, even with the advertisings on that page:

EDIT Please use the version here: http://pastebin.com/ABhtrnJH because the forum-software automatically shortens the url of my code-example, if you like to copy-paste the code.

string sUrl = "http://anonymouse.org/cgi-bin/anon-www.cgi/http://search.secondlife.com/client_search.php?s=people&session=00000000-0000-0000-0000-000000000000&mat=7&q=";string sSearchString = "http://world.secondlife.com/resident/";integer iKeyLength = 36;string sMessage = "Please say the name in chat!";string sMessageSearching = "Searching for: ";string sMessageResult = "Result: ";float fTime = 20;integer iListen;default{    touch_start(integer total_number)    {        llSetTimerEvent(fTime);        iListen = llListen(PUBLIC_CHANNEL, "", llDetectedKey(0), "");        llSay(PUBLIC_CHANNEL, sMessage);    }    timer()    {        llListenRemove(iListen);        llSetTimerEvent(0);    }    listen(integer channel, string name, key id, string message)    {        if(llToLower(llGetSubString(message,-8,-1)) == "resident")        {            message = llGetSubString(message,0,-9);        }        llListenRemove(iListen);        llSay(PUBLIC_CHANNEL, sMessageSearching + message);        llSetTimerEvent(0);        llHTTPRequest(sUrl + llEscapeURL(message), [HTTP_BODY_MAXLENGTH,16384], "");    }    http_response(key request_id, integer status, list metadata, string body)    {        string sResultKey = "";        integer iResultPos = llSubStringIndex(body, sSearchString);        if (iResultPos != -1)        {            iResultPos = iResultPos + llStringLength(sSearchString);            sResultKey = llGetSubString(body, iResultPos, iResultPos + iKeyLength-1);        }        llSay(PUBLIC_CHANNEL, sMessageResult + sResultKey);    }}

 

Link to comment
Share on other sites

Hmm.  I tried it for my own name,  and the names of some friends, and it just kept saying "Result" and nothing more.

So I put in llOwnerSay(body) to see what was being returned and got:

[10:58] Object: Please say the name in chat![10:58] Innula Zenovka: Innula Zenovka[10:58] Object: Searching for: Innula Zenovka[10:58] Object: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Second Life Search [Anonymoused]</title><link rel="stylesheet" href="http://anonymouse.org/cgi-bin/anon-www.cgi/http://wac.4C00.edgecastcdn.net/804C00/slsearch/slsearch/1.2.265672/css/client.css" type="text/css" media="screen, projection" /></head><body id="search-home"><div class="search-blurb"><h1>Search Second Life</h1>         <p>The <strong>All tab</strong> searches Second Life for people, places, groups, or items for sale. Type something into the box above and click the <strong>"Search" button</strong>        <p>Results are <strong>sorted by relevance</strong>. Things that are most related to your search will be at the top.</p></div>    <div class="classifieds">        <h2>Top Classifieds (paid ads)</h2>            <div class="cls-list"> [10:58] Object: Result: 

 

Link to comment
Share on other sites

Hello,

this is (I explained that earlier in this thread) because the max-body-length is set to 2048 by default, so sometimes when LL posts advertisements on the results page, the result is not received, because it's not in the first 2048 bytes of the page.

Therefore I updated my example yesterday, to allow longer body-lengths.

 

Also (I also explained that earlier) the llOwnerSay output doesn't reflect what gets sent to the http_response, because output from llOwnerSay is capped at 1024 bytes.

 

Please use the updated version of the function (see my first post). I can find your key with it.

Link to comment
Share on other sites

I don't know why you'd start assaulting me,

I didn't post faulty code, and in fact it's still the same code now as the original code, just with a view improvements due to feedback from other forum members.

Please let's try not to attack each other in the forums.

 

Btw. this was just meant as a guide for a workaround to the vwrsearch issue, not as a working program.

I think everyone who needs to program his own Name2Key script will have the resources to solve issues and glitches himself.

 

If this code offends you, I can delete it, and share it only with friends.

Thank you.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

it works if the avatar is public on the search.

If the avatr have hidden his profile the script pick up the KEyUUID of not correct avatar

 

example if i search my name, in the html i'll found this line:

<h3 class="result_title"><a href="http://world.secondlife.com/resident/1b9a0d96-8041-4bf5-ba52-b1dc62bd7ad1" >Hart (hart.larsson)</a></h3>

 the search string now is limited to:

string sSearchString = "http://world.secondlife.com/resident/";

 

you need to implement instead a search that pick up the first string between:

<h3 class="result_title">THE LINE TO PROCESS</h3>

 picked up the LINE you need to see if the avatar name is the avatar name you search:

Hart (hart.larsson)

 

so name.surname or name only must be there if not you need to return NULL_KEY

 

I've implemented this system in my .NET service and works.

I think you can mod your LSL script to accomplish it too :)

 

i've made a MOD version that support also name.surname input http://pastebin.com/MpZN7e9B 

 

I hope this help

Hart

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4023 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...