Alana Eberhardt Posted January 5, 2020 Share Posted January 5, 2020 Hi guys. I do afk sex work a lot and I have been searching for something like a proximity sensor that can trigger a few things (like project arousal triggers, sounds, maybe a short animation) if someone is say 1 meter from me, something else if they are closer, etc. But I am new to scripting (I know html & a little php and that is it) and getting very confused by it all. Been searching like crazy and found I can do a float range for the first part but then have no idea how to say trigger a sound and/or an animation if someone is in range. Can anyone help with the basic format? Is there an "if/then/else" sequence for lsl? I know I can do float range - .5; float howoften = 2.0; but then what do I need to do so that if someone is in that range it does x and if they are in a second range area it does y or does nothing if no one is in range? If they are right next to me, I want to do a small series (like moans, arousal levels, etc). Thanks for the help! Link to comment Share on other sites More sharing options...
Mollymews Posted January 5, 2020 Share Posted January 5, 2020 llDetectedKey(0) gives us the first agent found by the sensor http://wiki.secondlife.com/wiki/LlDetectedKey llGetObjectDetails(llDetectedKey(0), [OBJECT_POS]) gives us the region position of the detected agent http://wiki.secondlife.com/wiki/LlGetObjectDetails llVectDist() gives us the distance between the agent's position and our position on the region http://wiki.secondlife.com/wiki/LlVecDist our position on the region is llGetPos() http://wiki.secondlife.com/wiki/LlGetPos Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted January 5, 2020 Share Posted January 5, 2020 (edited) Have a look at llSensor in the LSL portal wiki, and also look at no_sensor, because that is going to be how you drop back to idle mode, when there's nobody near. llSensor will give you a count of how many avatars it has found within the range. You step through a for loop 0 to num_detected - 1, and do some checking on each avatar that is found. llDetectedPos(index) will give you the place where that avatar is, so llVecDist(llDetectedPos(index). myPos) will then tell you how far away they are. myPos is going to be where you are as given by llGetPos(), but as you aren't going to be moving around much it makes sense to only read this once, say inside the llSensor event (you might end up getting bumped around a bit during your adventures so it makes sense to regularly refresh it, just not every iteration through the loop) And I bet Molly has just said everything I'm saying only better Edited January 5, 2020 by Profaitchikenz Haiku Link to comment Share on other sites More sharing options...
Mollymews Posted January 5, 2020 Share Posted January 5, 2020 2 minutes ago, Profaitchikenz Haiku said: And I bet Molly has just said everything I'm saying only better i only answered the first part of the question "what do I need to do so that if someone is in that range it does x and if they are in a second range area it does y " you answered the second part: " or does nothing if no one is in range?" 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.