Jump to content

While retrieving a slurl from external database, the link is only half clickable.


oshea2000 Firelyte
 Share

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

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

Recommended Posts

Hello,

Basically I set up an external database for storing slurl links. When I call the database with the lsl script, it comes back through the http_response and the body is chatted out into local,   The problem is that the link that is chatted out is only half usable  with only the first half of the link in green and click-able and the other half in green and non click-able..

Has anyone else had this problem or know of a work around maybe?

I think I posted this in the right section, I apologize if I have not. ty

Link to comment
Share on other sites

Check for blank spaces in your string, such as you might get in the middle of a two=word sim name.  Those will break a SLURL unless you have used llEscapeURL to convert the spaces to %20 before storing them and then uploading them again.

  • Like 1
Link to comment
Share on other sites

What Rolig says is part of the truth - but, alas, SL is a bit trickier. If you have done all the URL escaping and unescaping on lets say http://maps.secondlife.com/secondlife/Dreamworld Pirate/143/221/800 you will get this back correctly. If you say that, you will get a link like Dreamworld (143, 221, 800) - just part of the name and the coordinates are not part of the link. 

That is because URL do not like spaces. You should think, doing an llEscapeURL would help, but it doesn't - the SLURL to work just wants the blank spaces to be escaped by %20. So in the example, http://maps.secondlife.com/secondlife/Dreamworld%20Pirate/143/221/800 would get you the right link

 

  • Like 1
Link to comment
Share on other sites

 

 Ty for the replys, i looked into the escaping but because im getting the slurls from the database they come back to the script and through the http_reponce in one piece.  So i cant add the +region+ to the slurl unless i intercept the random slurl (well it will be a random slurl when i add a frand) when it goes through the http_responce.

is that possible?

This is the open sorce script from aubreTEC Labs im using to get the data from the database.

 

//***********************************************************************// SLDB: Simple Database Storage for LSL (version 1.0)//***********************************************************************// Copyright © 2009 aubreTEC Labs// http://aubretec.com/products/sldb//// This program is free software. You can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License.//**********************************************************************//**********************************************************************// ABOUT THIS SCRIPT// This is a heavily-commented example script showing you how to store, // retrieve, and delete data from your SLDB installation. This assumes// you have already installed SLDB and are ready to begin storing data.//**********************************************************************//**********************************************************************// VARIABLES - These are necessary variables.//**********************************************************************// This is the direct URL to your installation (be sure to include the // data.php part)string url = "";  // This is the secret passphrase defined in your config.php string secret = "";// This is the character you want to use to separate lists.  For most // purposes, the pipe ("|") will work; you only need to change this if you // have a specific reason to (if you think your stored data might have pipes // in it, for instance).string separator = "|";     // These are the keys to which you'll assign your HTTPRequests(); the // http_response event will use this key to distinguish what kind of// request it's returning data for.key put_id;key get_id;key del_id;//**********************************************************************// FUNCTIONS - There is one custom function for each action (storing// data, retrieving it, and deleting it).  These functions are designed// to make these tasks much easier.  You should not change these unless// you really know what you're doing.//**********************************************************************// This function adds or updates the data in your database.  Send it the// list of fields you want update, followed by a list of values (one for// each field, in the same order as the fields.  The verbose variable// determines how detailed your response will be.  For most purposes, // FALSE is just fine.PutData(key id, list fields, list values, integer verbose){    string args;    args += "?key="+llEscapeURL(id)+"&action=put&separator="+llEscapeURL(separator);    args += "&fields="+llEscapeURL(llDumpList2String(fields,separator));    args += "&values="+llEscapeURL(llDumpList2String(values,separator));    args += "&secret="+llEscapeURL(secret);    put_id = llHTTPRequest(url+args,[HTTP_METHOD,"GET",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],"");}// This function retrieves the data from the database.  Send it the list// of fields you want to retrieve. If verbose = TRUE, you will get back// a string that looks like this: field1|value1|field2|value2. If// verbose = FALSE, you'll get back just the values: value1|value2|value3// To retrieve ALL of a user's data, use the list ["ALL_DATA"] in the fields// variable (though you should DEFINITELY use verbose = TRUE for this).GetData(key id, list fields, integer verbose){    string args;    args += "?key="+llEscapeURL(id)+"&action=get&separator="+llEscapeURL(separator);    args += "&fields="+llEscapeURL(llDumpList2String(fields,separator))+"&verbose="+(string)verbose;    args += "&secret="+llEscapeURL(secret);    get_id = llHTTPRequest(url+args,[HTTP_METHOD,"GET",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],"");}// This function deletes the data from the database.  Send it the list// of fields you want to delete. The verbose variable determines how // detailed your response will be.  For most purposes, FALSE is just fine.// To delete ALL of a user's data, use the list ["ALL_DATA"] in the fields// variable.DelData(key id, list fields, integer verbose){    string args;    args += "?key="+llEscapeURL(id)+"&action=del&separator="+llEscapeURL(separator);    args += "&fields="+llEscapeURL(llDumpList2String(fields,separator))+"&verbose="+(string)verbose;    args += "&secret="+llEscapeURL(secret);    del_id = llHTTPRequest(url+args,[HTTP_METHOD,"GET",HTTP_MIMETYPE,"application/x-www-form-urlencoded"],"");}    default{    state_entry()    {            //In this example, we're storing the owner's name and avatar size when the script first runs.       // PutData(llGetOwner(),["name","size"],[llKey2Name(llGetOwner()),llGetAgentSize(llGetOwner())],FALSE);    }    touch_start(integer total_number)    {        // In this example, we're fetching the owner's name and avatar size (stored above) on touch.        GetData("14",["object"],FALSE);    }          changed(integer change)    {        // In this example, we're deleting all of the owner's data if the box gets colored red.  I can        // think of no reason why you'd want to do this, but I needed SOMETHING to trigger it so I could        // give an example.        if((change & CHANGED_COLOR) && (llGetColor(ALL_SIDES) == <1,0,0>))        {            DelData(llGetOwner(),["ALL_DATA"],TRUE);        }    }         http_response(key id, integer status, list metadata, string body)    {                        body = llDeleteSubString( body, llSubStringIndex( body, "<!-- www.000webhost.com Analytics Code -->" ), -1 );        // In this example, we're simply spitting back the data we've gotten from the server as an llOwnerSay.                // First, make sure this request is one of the ones used in this script (as opposed to one being called        // by another script in the same object).                if((id != put_id) && (id != get_id) && (id != del_id)) return;                // If the status isn't 200, then there was a problem connecting to your server.  Maybe the URL isn't        // correct, or the server is offline.  Set the body to the server error so the final result is an        // accurate account of what happened.        if(status != 200) body = "ERROR: CANNOT CONNECT TO SERVER";                // And spit out the information we got.        llOwnerSay(body);    }}

 

Link to comment
Share on other sites

Replace the http_response event with this one:

  http_response(key id, integer status, list metadata, string body)    {                        body = llDeleteSubString( body, llSubStringIndex( body, "<!-- www.000webhost.com Analytics Code -->" ), -1 );        if((id != put_id) && (id != get_id) && (id != del_id)) return;        if(status != 200) {        	llOwnerSay("CANNOT CONNECT TO SERVER");        	return;        }                // And spit out the information we got.        list slurl = llParseStringKeepNulls(body, ["/"], []);        slurl = llListReplaceList(slurl, [llEscapeURL(llList2String(slurl, 4))], 4, 4);        llOwnerSay(llDumpList2String(slurl, "/"));    }

 That should do the trick.

Btw.: I followed the wisdom of the two ladies ;)

  • Like 1
Link to comment
Share on other sites

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