GloriaGlitter Posted April 2, 2020 Share Posted April 2, 2020 Is it possible to detect when a user's mouse points at a prim? I want to be able to change the texture of a prim when a mouse points at it. I couldn't find a detection event for this but It should be possible since the cursor changes shape when pointing at an object with a sit pose in it for instance. Thanks. Link to comment Share on other sites More sharing options...
Mollymews Posted April 2, 2020 Share Posted April 2, 2020 am pretty sure there is no mouse_over equivalent in LSL. We only have mouse_down, mouse_press and mouse_up in llTakeControls CONTROL_LBUTTON http://wiki.secondlife.com/wiki/LlTakeControls Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted April 2, 2020 Share Posted April 2, 2020 (edited) I can confirm there's no way to detect if someone's mouse is hovering over something, but there is a way to detect if someone is aiming at something in mouselook, or looking at it in free view. It requires regularly doing a raycast check according to their camera's position and rotation. http://wiki.secondlife.com/wiki/LlCastRayhttp://wiki.secondlife.com/wiki/LlGetCameraPoshttp://wiki.secondlife.com/wiki/LlGetCameraRot This requires that the thing that's doing the checking has permissions from the avatar in question. Altarnatively, you can detect other avatars' mouselook remotely (no attachment/permissions required) if you just get their current rotation. Edited April 2, 2020 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 2, 2020 Share Posted April 2, 2020 Molly's right.. There is no mouse_over function in LSL. However, if you own the object that you want to texture, you can certainly fake it. Use llCastRay to detect the UUID of whatever the user has clicked on while in mouselook, and then send a message to the object that contains the color vector or the texture UUID that you want to apply. A script in the receiving object can do the work of actually changing the color or texture. Of course, the simpler solution (without llCastRay) would simply mean clicking on the object and having its script send you its UUID. Link to comment Share on other sites More sharing options...
GloriaGlitter Posted April 2, 2020 Author Share Posted April 2, 2020 This is my project - I'm making a TP board for a store elevator - if you click on say 'Floor 3' button then you go to floor 3. Just thought it would be neat to glow the button as the mouse hovered over it so the user could be sure of clicking the right button. 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 2, 2020 Share Posted April 2, 2020 Aha. That would be neat. Sadly, there's no way to do it that doesn't involve some rather complicated shenanigans that would not be practical for the average visitor. Link to comment Share on other sites More sharing options...
GloriaGlitter Posted April 2, 2020 Author Share Posted April 2, 2020 Pity such a function not available but thanks for considering the question Link to comment Share on other sites More sharing options...
Mollymews Posted April 3, 2020 Share Posted April 3, 2020 3 hours ago, GloriaGlitter said: Just thought it would be neat to glow the button as the mouse hovered over it so the user could be sure of clicking the right button. i think it would be great to have this as well Link to comment Share on other sites More sharing options...
Amelia Venus Posted March 20 Share Posted March 20 This can be done via experience. If they are in the experience you can always know their camera parameters. Link to comment Share on other sites More sharing options...
Amelia Venus Posted March 20 Share Posted March 20 well nevermind .. not so much where their mouse is Link to comment Share on other sites More sharing options...
Amelia Venus Posted March 20 Share Posted March 20 Could do a touch and hold though .. and release to choose .. then you can read where their mouse is .. Link to comment Share on other sites More sharing options...
Quistess Alpha Posted March 20 Share Posted March 20 (edited) As long as we're bringing up the dead, you can also do it with a media face. Media 'knows' where you're touching if you've touched it once to let it grab your mouse. I know I posted a demo long time passing. . . but easier to find it in my inventory than on the forums so. . . Quote script in a 0.5x0.5x0.01 sized cube as the root prim, with a 0.0625 sized cube as a child prim: key ghRequestURL; string gsURL; string gsMain_header = "<!DOCTYPE xhtml> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head><style> .grid-container { display: flex; flex-wrap: wrap; background-color: teal; width: 1000px; height: 1000px; margin: 12px auto; } .grid-container div { background-color: rgba(255,255,255, 0.8); border: 1px solid rgba(0,0,0, 0.6); width: 123px; height: 123px; } .grid-container div:hover { background-color: rgba(255, 128, 128, 0.4); } </style></head> <body>"; string gsMain_body; string gsMain_footer = " <script type=\"text/javascript\"> //<![CDATA[ function postB(val) { var xhttp = new XMLHttpRequest(); xhttp.open(\"POST\",val+\"button\"); xhttp.send(); } //]]> </script> </body> </html>"; generate_page(string page, key ID) { //llOwnerSay("Debug: "+":"+page+":"+llGetHTTPHeader(ID,"x-remote-ip")); if(llGetSubString(page,0,0)=="/") { page = llDeleteSubString(page,0,0); } if(page=="home") { llSetContentType(ID,CONTENT_TYPE_XHTML); llHTTPResponse(ID,200, gsMain_header+ gsMain_body+ gsMain_footer); }else if(llGetSubString(page,-6,-1)=="button") { integer button = (integer)page; integer row = button/8; integer col = button%8; vector scale = llGetScale(); float inc_X = scale.x/8; float inc_Y = -scale.y/8; float off_X = -3.5*inc_X; float off_Y = -3.5*inc_Y; vector setPos = <off_X+(col*inc_X),off_Y+(row*inc_Y),inc_X/2+0.005>; llSetLinkPrimitiveParamsFast(2,[PRIM_POS_LOCAL,setPos]); llHTTPResponse(ID,204,"No Content."); } else { llSay(0,"Unknown page: "+page); llHTTPResponse(ID,404,"Not found."); } } default { state_entry() { ghRequestURL = llRequestURL(); gsMain_body = "<div class =\"grid-container\">"; integer i; for(i=0;i<64;++i) { gsMain_body+="<div onmouseover=\"postB("+(string)i+")\">"+ /*"button_text"+*/"\</div>\n"; } gsMain_body+="</div>"; llOwnerSay((string)llGetFreeMemory()); } on_rez(integer i) { llReleaseURL(gsURL); ghRequestURL = llRequestURL(); } changed(integer c) { if(c&(CHANGED_REGION_START|CHANGED_REGION)) { llReleaseURL(gsURL); ghRequestURL = llRequestURL(); } } http_request(key ID, string Method, string Body) { if(ID==ghRequestURL) { llOwnerSay("Got URL: "+Body); // debug if (Method == URL_REQUEST_DENIED) { llOwnerSay(Method); }else //if (Method == URL_REQUEST_GRANTED) { gsURL=Body; llSetLinkMedia(LINK_THIS,0, [ PRIM_MEDIA_HOME_URL, gsURL+"/home", PRIM_MEDIA_CURRENT_URL, gsURL+"/home", PRIM_MEDIA_AUTO_PLAY, TRUE, PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE, // don't show nav-bar. PRIM_MEDIA_PERMS_INTERACT, PRIM_MEDIA_PERM_NONE // * when an in-world MoaP does not have 'interact' permissions, their // browser will immediately request the 'current URL' after navigation // to a ' new page' after it recieves a response, if that response // does not have status 204 (no content). // * if the in-world MoaP ~Does have interact perms, navigation to a // valid page (not status 204) will cause the CURRENT_URL to change // to the new page and other MoaP instances in range should // avigate to that URL as well. ]); } }else { string path = llGetHTTPHeader(ID,"x-path-info"); generate_page(path,ID); } } } Too complicated for a simple use-case like in the OP, but it's a fun proof-of-concept. Edited March 20 by Quistess Alpha Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now