How could I implement an LM2SLURL-type function?
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
12-07-2009 10:21
Could someone nudge me in the right direction on this one please... How do I generate an SLURL string for an LM stored in a prim's inventory? I'd like to be able to go directly from selecting an LM from a dialog to calling llLoadURL without involving the user: avoiding using llMapDestination, the copy SLURL to clipbord button, a manual swith to the browser, a paste into the browser and an "enter". I'm OK doing this for the current location, but I can't seem to find, and think I need, a way of extracting the region name from an LM. It's probably the lack of sleep... Thanks 
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
12-07-2009 10:40
It's a little messy but possible. The beginnings of such a script are in this thread:  The Google proxy used in there stopped proxying plain text a while ago, so you will need to work out some other arrangement for the access problem.
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
12-07-2009 11:01
Thanks, Viktoria. I can make sense of the code.
But I've never knowingly used a proxy server before in my life. Does anyone have any suggestions where I might start?
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-07-2009 13:23
if you know the LM will be unmodified, you can get the sim name from it's name, and do a little math on the return from llRequestInventoryData ( mod 256 on the x and y axis'), then format it nicely
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
12-07-2009 14:00
Umm... I am modifying the names of the LMs to use as dialog button labels. I guess I could change things to give them names consisting of a button label and a region name and parse them out. I need to think about that.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-07-2009 14:43
well if you are already rewritng them.... may I suggest storing all the relevant data on read? (assuming you are pre reading them all for the button list). oh and for the heck of it, something to play with... Dynamic pagination sample for dialogs
list gLstBtn = ["00","01","02","03","04","05","06","07","08","09", "10","11","12","13","14","15","16","17","18","19", "20","21","22","23","24","25","26","27","28","29", "30","31","32","33","34","35","36","37","38","39" ];
list uDlgBtn( integer vIdxBeg ){ integer vIdxMax = (gLstBtn != []); vIdxMax -= ((vIdxMax % 10) + 10 * !(vIdxMax % 10) * (vIdxMax > 9)); list vLstRtn = llListInsertList( llList2List( gLstBtn, vIdxBeg, vIdxBeg + 9 ), (list)(" <<---(" + (string)((vIdxMax + 10) * (vIdxBeg < 10) + vIdxBeg - 10) + ")"), -1 ) + (list)(" (" + (string)((10 + vIdxBeg) * (vIdxBeg < vIdxMax)) + ")--->>"); return llList2List( vLstRtn, -3, -1 ) + llList2List( vLstRtn, -6, -4 ) + llList2List( vLstRtn, -9, -7 ) + llList2List( vLstRtn, -12, -10 ); }
listen( integer vInt, string vStr, key vKey, string vStrMsg ){ if (!llSubStringIndex( vStrMsg, " " )){ llDialog( llGetOwner(), " ", uDlgBtn( (integer)llGetSubString( vStrMsg, llSubStringIndex( vStrMsg, "(" ) + 1, -1 ) ), -1 ); } }
I don't remember if I ever finished it... I think so, but I can't test (obviously you need to plug in the default state and open a listen, and add an else for the actual buttons, since I only have response in there for the page swapping)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-07-2009 14:44
well if you are already rewritng them.... may I suggest storing all the relevant data on read? (assuming you are pre reading them all for the button list). oh and for the heck of it, something to play with... Dynamic pagination sample for dialogs
list gLstBtn = ["00","01","02","03","04","05","06","07","08","09", "10","11","12","13","14","15","16","17","18","19", "20","21","22","23","24","25","26","27","28","29", "30","31","32","33","34","35","36","37","38","39" ];
list uDlgBtn( integer vIdxBeg ){ integer vIdxMax = (gLstBtn != []); vIdxMax -= ((vIdxMax % 10) + 10 * !(vIdxMax % 10) * (vIdxMax > 9)); list vLstRtn = llListInsertList( llList2List( gLstBtn, vIdxBeg, vIdxBeg + 9 ), (list)(" <<---(" + (string)((vIdxMax + 10) * (vIdxBeg < 10) + vIdxBeg - 10) + " " , -1 ) + (list)(" (" + (string)((10 + vIdxBeg) * (vIdxBeg < vIdxMax)) + " --->>" ; return llList2List( vLstRtn, -3, -1 ) + llList2List( vLstRtn, -6, -4 ) + llList2List( vLstRtn, -9, -7 ) + llList2List( vLstRtn, -12, -10 ); }
listen( integer vInt, string vStr, key vKey, string vStrMsg ){ if (!llSubStringIndex( vStrMsg, " " )){ llDialog( llGetOwner(), " ", uDlgBtn( (integer)llGetSubString( vStrMsg, llSubStringIndex( vStrMsg, " " ) + 1, -1 ) ), -1 ); } }
I don't remember if I ever finished it... I think so, but I can't test (obviously you need to plug in the default state and open a listen, and add an else for the actual buttons, since I only have response in there for the page swapping)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
12-07-2009 15:29
 Beat you to it with that one I think: I've already done a script that handles all the dialogs for the other scripts - just send a link message with the dialog text, the buttons to be used, any buttons that need to be repeated on each page and a key to identify the "callback" link message. This really makes it so much easier to write the actual feature scripts without having to burden each one with all the duplicated code for the dialog itself, timeouts, pagination and so on. And yes, the script I'm thinking of adding the SLURL feature to does already pre-build a list of buttons on reset and changed inventory.
|
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
|
12-09-2009 06:39
Just to round this thread off, what I've done is to take the name of an LM I've created myself and replace the parcel name part of its name with an abbreviated dialog-button-friendly name like so: from "Parcel Name part of LM name, Region Name (128, 128, 20)" to "Short name, Region Name (128, 128, 20)". This is only slightly fiddlier that changing the whole LM name to just the button label, and needs to be done only once, and has the advantage of not relying on an external proxy server. Parsing out the components and creating a list of button labels and a parallel list of SLURL formatted locations is then simple enough. I'm using this function to do this... list landmarks; list locations;
GetLandmarks () { landmarks = []; locations = []; integer index = 0; integer number_of_landmarks = llGetInventoryNumber (INVENTORY_LANDMARK); while (index < number_of_landmarks) { list elements = llParseString2List (llGetInventoryName (INVENTORY_LANDMARK, index++), [", ", " (", ")"], []); landmarks += llList2String (elements, 0); integer number = llGetListLength (elements) - 1; if (number > 0) { elements = llListReplaceList (elements, [llEscapeURL (llList2String (elements, 1))], 1, 1); locations += llDumpList2String (llList2List (elements, 1, number), "/"); } else locations += ""; } }
... which seems to work ok, though I am wondering if using a list function call as a paramater to another list function call is such a good idea in terms of stack usage.
|