Spider Mycron Posted April 26, 2021 Share Posted April 26, 2021 (edited) Hello, i need please to assign different url for some faces (textures) on my prim and i think i need to use this llSetTextureURL but have no idea how to use it i get error when i try below line llSetTextureURL(1,llUrlEncode("https://www.ourchands.com= " + text + "&font=futura&rez=512x512"); llRefreshTextureURL(integer face); please help kindly Thanks Edited April 26, 2021 by Spider Mycron Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted April 26, 2021 Share Posted April 26, 2021 llSetTextureURL is not a real function. There's no function that can display arbitrary images from the internet on a prim. The only way to do that would be to use Media On A Prim to display a webpage with the image, but you cannot guarantee that everyone/anyone will see it due to their viewer settings. 4 Link to comment Share on other sites More sharing options...
Jenna Huntsman Posted April 26, 2021 Share Posted April 26, 2021 What are you trying to do *exactly*? Looking at that URL, are you looking to display a custom line of text on the prim? Or something else? Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 im tryig to create a board that have different faces (different textures) , so the board is made as one prim mesh and i assigned different colors to it so i want to have it clickable , and every click gives different action Thanks Link to comment Share on other sites More sharing options...
Jenna Huntsman Posted April 26, 2021 Share Posted April 26, 2021 34 minutes ago, Spider Mycron said: llSetTextureURL(1,llUrlEncode("https://www.ourchands.com= " + text + "&font=futura&rez=512x512"); The end of this line is what I picked up on, as I'm assuming what you're trying to do is have a string (text) be converted into an image (at 512px) which contains 'text' in the Futura font, then displayed on the face of that prim. Am I right in that line of thought? Link to comment Share on other sites More sharing options...
Quistess Alpha Posted April 26, 2021 Share Posted April 26, 2021 (edited) FWIW an example of setting a media texture: //-- from http://wiki.secondlife.com/wiki/LlSetLinkMedia#Useful_Snippets //-- expand media textures greater than 1024 pixel in a direction to fit the media face //-- does exactly what the "align" button does in the edit window //-- original by Edelman Linden (or Kate Linden), tweaked by Void Singer uExpandMediaTexture( integer vIntWidth, integer vIntHeight, integer vIntFace ){ integer vIntTemp; vector vSizScale; while (vIntWidth >> ++vIntTemp); vSizScale.x = vIntWidth / (float)(1 << vIntTemp); vIntTemp = 0; while (vIntHeight >> ++vIntTemp); vSizScale.y = vIntHeight / (float)(1 << vIntTemp); llSetLinkPrimitiveParamsFast( LINK_THIS, [PRIM_TEXTURE, vIntFace] + llListReplaceList( llGetLinkPrimitiveParams(LINK_THIS, [PRIM_TEXTURE, vIntFace] ), [vSizScale, ((vSizScale - <1.0, 1.0, 0.0>) / 2.0)], 1, 2 ) ); } default { state_entry() { integer link_number = 0; llSetLinkMedia(link_number, 0, // link number, face [PRIM_MEDIA_CURRENT_URL, "https://www.pngitem.com/pimgs/m/535-5359631_big-smiley-face-clipart-png-download-excited-smiley.png", PRIM_MEDIA_WIDTH_PIXELS, 860, // doesn't work as expected, which is why we need uExpandMediaTexture() PRIM_MEDIA_HEIGHT_PIXELS, 881, PRIM_MEDIA_PERMS_INTERACT, 0, PRIM_MEDIA_PERMS_CONTROL, 0 ]); uExpandMediaTexture(860,881,link_number); // x y link_number } } Edited April 26, 2021 by Quistessa fixed broken commented-out code. had an argument-order disagreement. 1 Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 3 minutes ago, Jenna Huntsman said: The end of this line is what I picked up on, as I'm assuming what you're trying to do is have a string (text) be converted into an image (at 512px) which contains 'text' in the Futura font, then displayed on the face of that prim. Am I right in that line of thought? yes i got that script line from sl wiki , but as i told you , all what i want is to set a different url for some different colors on my prim my prim have made as multi textures on one face so when someone click on these textures they get url script that load different link Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 26, 2021 Share Posted April 26, 2021 You may have run across a very old script that had the functions llSetPrimURL and llRefreshPrimURL, but those functions were depreciated years ago. They won't do anything today. As Wulfie says, you do that sort of thing today with Media On A Prim. See llSetPrimMediaParams in the LSL wiki. 1 Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 5 minutes ago, Rolig Loon said: You may have run across a very old script that had the functions llSetPrimURL and llRefreshPrimURL, but those functions were depreciated years ago. They won't do anything today. As Wulfie says, you do that sort of thing today with Media On A Prim. See llSetPrimMediaParams in the LSL wiki. thank you but i don't wish to set media as texture , i want to have different actions (load url for example) to every different color on my prim Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 26, 2021 Share Posted April 26, 2021 I don't understand what color has to do with it. If you want to activate some web link when a particular face is touched, just write touch_start(integer num) { if (llDetectedTouchFace(0) == iNumberOfMySpecialFace) { llLoadURL(llDetectedKey(0),"Yay!, you touched my face!", strMyFavoriteURL); } } Link to comment Share on other sites More sharing options...
Jenna Huntsman Posted April 26, 2021 Share Posted April 26, 2021 (edited) 36 minutes ago, Spider Mycron said: yes i got that script line from sl wiki , but as i told you , all what i want is to set a different url for some different colors on my prim my prim have made as multi textures on one face so when someone click on these textures they get url script that load different link If you're just looking to load a URL, then use llLoadURL which will bring up a prompt for the user to navigate to the website in their browser. Combine that with a touch event, and a stored variable (e.g. the key of the current texture on that face), so you can end up with: string g_URL2load = "https://www.google.com/"; vector g_URLcolour = <1,0,0>; //Give URL if face is red (255,0,0) //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB integer face = 0; //face of the Prim which will give the URL default { state_entry() { llSay(0, "Touch me to go to google.com!"); } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolour) //if the clicked face is Red { llSay(0, "Sending you the URL..."); llLoadURL(llDetectedKey(0), "Navigate to google.com", g_URL2load); //send the URL to whoever touched me } else llSay(0, "This face isn't Red, so I won't send you the URL"); } } Edited April 26, 2021 by Jenna Huntsman 1 Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 4 minutes ago, Jenna Huntsman said: If you're just looking to load a URL, then use llLoadURL which will bring up a prompt for the user to navigate to the website in their browser. Combine that with a touch event, and a stored variable (e.g. the key of the current texture on that face), so you can end up with: string g_URL2load = "https://www.google.com/"; vector g_URLcolour = <1,0,0>; //Give URL if face is red //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB integer face = 0; //face of the Prim which will give the URL default { state_entry() { llSay(0, "Touch me to go to google.com!"); } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolour) //if the clicked face is Red { llSay(0, "Sending you the URL..."); llLoadURL(llDetectedKey(0), "Navigate to google.com", g_URL2load); //send the URL to whoever touched me } else llSay(0, "This face isn't Red, so I won't send you the URL"); } } thanks so much for understand me , i colored a cube face in SL now with red but it is not touchable after i added your script wish you please give like 3 different colors that i can touch if possible and i appreciate your efforts guys Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 8 minutes ago, Rolig Loon said: I don't understand what color has to do with it. If you want to activate some web link when a particular face is touched, just write touch_start(integer num) { if (llDetectedTouchFace(0) == iNumberOfMySpecialFace) { llLoadURL(llDetectedKey(0),"Yay!, you touched my face!", strMyFavoriteURL); } } thanks a lot , wish you please give a real exmaple for strMyFavoriteURL like to set a google.com site if possible please Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 26, 2021 Share Posted April 26, 2021 (edited) strMyFavoriteURL = "https://community.secondlife.com/forums/topic/471088-llset-texture-url/?tab=comments#comment-2288867"; Edited April 26, 2021 by Rolig Loon Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 3 minutes ago, Rolig Loon said: strMyFavoriteURL = "https://community.secondlife.com/forums/topic/471088-llset-texture-url/?tab=comments#comment-2288867"; touch_start(integer num) { if (llDetectedTouchFace(0) == iNumberOfMySpecialFace) { llLoadURL(llDetectedKey(0),"Yay!, you touched my face!", strMyFavoriteURL="www.google.com"); } } im getting error, sorry Link to comment Share on other sites More sharing options...
Jenna Huntsman Posted April 26, 2021 Share Posted April 26, 2021 (edited) 15 minutes ago, Spider Mycron said: thanks so much for understand me , i colored a cube face in SL now with red but it is not touchable after i added your script wish you please give like 3 different colors that i can touch if possible and i appreciate your efforts guys This has 3 colours, and sets up the prim so that you can touch it and get a URL. string g_URL2loadRED = "https://www.google.com/"; string g_URL2loadGREEN = "https://www.duckduckgo.com/"; string g_URL2loadBLUE = "https://www.bing.com/"; vector g_URLcolourRED = <1,0,0>; //Give URL if face is red (255,0,0) //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB vector g_URLcolourGREEN = <0,1,0>; vector g_URLcolourBLUE = <0,0,1>; default { state_entry() { llSay(0, "Touch me to go to a search engine!"); llSetColor(g_URLcolourRED,0); //Set some faces on the prim to the correct colours for demo purposes llSetColor(g_URLcolourGREEN,1); llSetColor(g_URLcolourBLUE,2); llSetMemoryLimit(8000); //Optimization under Mono. Delete this line if you run into problems, or don't know what it does. } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourRED) //if the clicked face is Red { llSay(0, "Sending you to " + g_URL2loadRED); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadRED, g_URL2loadRED); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourGREEN) //if the clicked face is Green { llSay(0, "Sending you to " + g_URL2loadGREEN); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadGREEN, g_URL2loadGREEN); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourBLUE) //if the clicked face is Blue { llSay(0, "Sending you to " + g_URL2loadBLUE); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadBLUE, g_URL2loadBLUE); //send the URL to whoever touched me } else llSay(0, "I don't know what to do with the colour of that face!"); } } Edited April 26, 2021 by Jenna Huntsman Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 2 minutes ago, Jenna Huntsman said: This has 3 colours, and sets up the prim so that you can touch it and get a URL. string g_URL2loadRED = "https://www.google.com/"; string g_URL2loadGREEN = "https://www.duckduckgo.com/"; string g_URL2loadBLUE = "https://www.bing.com/"; vector g_URLcolourRED = <1,0,0>; //Give URL if face is red (255,0,0) //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB vector g_URLcolourGREEN = <0,1,0>; vector g_URLcolourBLUE = <0,0,1>; integer face = 0; //face of the Prim which will give the URL default { state_entry() { llSay(0, "Touch me to go to a search engine!"); llSetColor(g_URLcolourRED,0); //Set some faces on the prim to the correct colours for demo purposes llSetColor(g_URLcolourGREEN,1); llSetColor(g_URLcolourBLUE,2); llSetMemoryLimit(8000); //Optimization under Mono. Delete this line if you run into problems, or don't know what it does. } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourRED) //if the clicked face is Red { llSay(0, "Sending you to " + g_URL2loadRED); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadRED, g_URL2loadRED); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourGREEN) //if the clicked face is Green { llSay(0, "Sending you to " + g_URL2loadGREEN); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadGREEN, g_URL2loadGREEN); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourBLUE) //if the clicked face is Green { llSay(0, "Sending you to " + g_URL2loadBLUE); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadBLUE, g_URL2loadBLUE); //send the URL to whoever touched me } else llSay(0, "I don't know what to do with the colour of that face!"); } } wonderful love you guys it just work perfect Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 2 hours ago, Jenna Huntsman said: This has 3 colours, and sets up the prim so that you can touch it and get a URL. string g_URL2loadRED = "https://www.google.com/"; string g_URL2loadGREEN = "https://www.duckduckgo.com/"; string g_URL2loadBLUE = "https://www.bing.com/"; vector g_URLcolourRED = <1,0,0>; //Give URL if face is red (255,0,0) //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB vector g_URLcolourGREEN = <0,1,0>; vector g_URLcolourBLUE = <0,0,1>; default { state_entry() { llSay(0, "Touch me to go to a search engine!"); llSetColor(g_URLcolourRED,0); //Set some faces on the prim to the correct colours for demo purposes llSetColor(g_URLcolourGREEN,1); llSetColor(g_URLcolourBLUE,2); llSetMemoryLimit(8000); //Optimization under Mono. Delete this line if you run into problems, or don't know what it does. } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourRED) //if the clicked face is Red { llSay(0, "Sending you to " + g_URL2loadRED); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadRED, g_URL2loadRED); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourGREEN) //if the clicked face is Green { llSay(0, "Sending you to " + g_URL2loadGREEN); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadGREEN, g_URL2loadGREEN); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourBLUE) //if the clicked face is Blue { llSay(0, "Sending you to " + g_URL2loadBLUE); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadBLUE, g_URL2loadBLUE); //send the URL to whoever touched me } else llSay(0, "I don't know what to do with the colour of that face!"); } } i got another question if you may please how can i use texture UUID instead of colors for the above script please ? Thanks Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 26, 2021 Share Posted April 26, 2021 Use llGetTexture instead of llGetColor and look for the texture UUID instead of a color vector. Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 13 minutes ago, Rolig Loon said: Use llGetTexture instead of llGetColor and look for the texture UUID instead of a color vector. thanks for your time, i jst getting error at if statment not sure how to fix it string g_URL2loadRED = "https://www.google.com/"; string g_URL2loadGREEN = "https://www.duckduckgo.com/"; string g_URL2loadBLUE = "https://www.bing.com/"; // texture 1: key gTexture1 = "f2f807ce-c5f9-2156-eb03-f36a3c976a83"; // texture 2: key gTexture2 = "5a0538f5-23c7-b76c-7115-905cb4f8beb2"; // texture 3: key gTexture3 = "10522cbd-8d18-3ba0-0043-782018b086b1"; vector g_URLcolourRED = <1,0,0>; //Give URL if face is red (255,0,0) //Note that the colour has to be in LSL format, NOT traditional 8-bit RGB vector g_URLcolourGREEN = <0,1,0>; vector g_URLcolourBLUE = <0,0,1>; integer face = 0; //face of the Prim which will give the URL default { state_entry() { llSay(0, "Touch me to go to a search engine!"); //llSetColor(g_URLcolourRED,0); //Set some faces on the prim to the correct colours for demo purposes // llSetColor(g_URLcolourGREEN,1); //llSetColor(g_URLcolourBLUE,2); // texture 1 on face 1: llSetTexture(gTexture1,0); llSetMemoryLimit(8000); //Optimization under Mono. Delete this line if you run into problems, or don't know what it does. } touch_start(integer total_number) { if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourRED) //if the clicked face is Red { llSay(0, "Sending you to " + g_URL2loadRED); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadRED, g_URL2loadRED); //send the URL to whoever touched me } else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourGREEN) //if the clicked face is Green // texture 1 on face 2: llSetTexture(gTexture2,1); { llSay(0, "Sending you to " + g_URL2loadGREEN); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadGREEN, g_URL2loadGREEN); //send the URL to whoever touched me } //else if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourBLUE) //if the clicked face is Green // texture 3 on face 3: llSetTexture(gTexture1,2); { llSay(0, "Sending you to " + g_URL2loadBLUE); llLoadURL(llDetectedKey(0), "Navigate to " + g_URL2loadBLUE, g_URL2loadBLUE); //send the URL to whoever touched me } else llSay(0, "I don't know what to do with the colour of that face!"); } } wish you check if you get time please Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 sorry im messing the script not sure what should i do Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 26, 2021 Share Posted April 26, 2021 (edited) All of your if tests are still asking what the color of the detected face is. if(llGetColor(llDetectedTouchFace(0)) == g_URLcolourRED) //if the clicked face is Red You said that you wanted to have the if tests ask which texture is on the face, so the script should not ask about color now. Think carefully. You can figure this out. Edited April 26, 2021 by Rolig Loon Link to comment Share on other sites More sharing options...
Spider Mycron Posted April 26, 2021 Author Share Posted April 26, 2021 im done with colors perfectly but i wish to try same thing with texture instead it is just another option i wish to achieve Link to comment Share on other sites More sharing options...
panterapolnocy Posted April 26, 2021 Share Posted April 26, 2021 (edited) I've read your original post and noticed, that you want to assign URLs to faces, actually - not necessarily detect touch by UUID itself. I don't know if this thing would be helpful, but you may give it a try. // Format: Face, Link URL, Texture UUID (only used on script boot) list gData = [ 0, "https://www.google.com", "f2f807ce-c5f9-2156-eb03-f36a3c976a83", 1, "https://www.duckduckgo.com", "5a0538f5-23c7-b76c-7115-905cb4f8beb2", 2, "https://www.bing.com", "10522cbd-8d18-3ba0-0043-782018b086b1" ]; list gIndexes; default { state_entry() { // Set some faces on the prim to the correct textures integer dataLength = llGetListLength(gData); integer index; while (index < dataLength) { llSetTexture(llList2String(gData, (index + 2)), llList2Integer(gData, index)); index += 3; } // Build index list for faster lookups gIndexes = llList2ListStrided(gData, 0, -1, 3); // Optimization under Mono. Delete this line if you run into problems, or don't know what it does. llSetMemoryLimit(llGetUsedMemory() + 5120); // Say hello llOwnerSay("Touch me to go to a search engine!"); } touch_start(integer total_number) { key toucherKey = llDetectedKey(0); integer indexPosition = llListFindList(gIndexes, (list)llDetectedTouchFace(0)); if (~indexPosition) { // Get the URL from data list, by index position multiplied by stride length and added 1 string url = llList2String(gData, (indexPosition * 3) + 1); // Send the URL to whoever touched me llRegionSayTo(toucherKey, 0, "Sending you to " + url); llLoadURL(toucherKey, "Navigate to " + url, url); } else { llRegionSayTo(toucherKey, 0, "I don't know what to do with that face!"); } } on_rez(integer sp) { llResetScript(); } } If you want to do an actual detection by touched texture UUID and apply all textures manually, then you may take a look at this simplified version, with shuffled data table. // Format: Texture UUID, Link URL list gData = [ "f2f807ce-c5f9-2156-eb03-f36a3c976a83", "https://www.google.com", "5a0538f5-23c7-b76c-7115-905cb4f8beb2", "https://www.duckduckgo.com", "10522cbd-8d18-3ba0-0043-782018b086b1", "https://www.bing.com" ]; default { state_entry() { llOwnerSay("Touch me to go to a search engine!"); // Optimization under Mono. Delete this line if you run into problems, or don't know what it does. llSetMemoryLimit(llGetUsedMemory() + 5120); } touch_start(integer total_number) { key toucherKey = llDetectedKey(0); string touchedTexture = llGetTexture(llDetectedTouchFace(0)); integer indexPosition = llListFindList(gData, (list)touchedTexture); if (~indexPosition) { // Get the URL from data list, by texture uuid position with added 1 string url = llList2String(gData, indexPosition + 1); // Send the URL to whoever touched me llRegionSayTo(toucherKey, 0, "Sending you to " + url); llLoadURL(toucherKey, "Navigate to " + url, url); } else { llRegionSayTo(toucherKey, 0, "I don't know what to do with that face!"); } } on_rez(integer sp) { llResetScript(); } } Edited April 26, 2021 by panterapolnocy 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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