Rayne McAndrews Posted August 29, 2012 Share Posted August 29, 2012 is there a way to determine via hud attached to avatar if the avatar sits on something?This something could be anything scripted or non and may or may not be owned by the avatar itself. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted August 29, 2012 Share Posted August 29, 2012 If you mean: Is there a way to detect if ab avatar sits (one always sits 'on' something), you can use llGetAgentInfo. Link to comment Share on other sites More sharing options...
Rayne McAndrews Posted August 30, 2012 Author Share Posted August 30, 2012 thanks, i played with that a while and still couldnt get it to determine if and when the avatar wearing the hud is sitting. Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted August 30, 2012 Share Posted August 30, 2012 I'm not too sure, what you really want - but tis simple example will tell you if the agent is sitting - on touch, that is default { touch_end(integer num_detected) { if (llGetAgentInfo(llGetOwner()) & AGENT_SITTING) { llSay(0, "Agent is sitting"); } }} Link to comment Share on other sites More sharing options...
Rayne McAndrews Posted August 30, 2012 Author Share Posted August 30, 2012 yes i was trying to not use it on touch. it will be inside an avatar hud i pretty much need to know each time the avatar sits and stands. without touch Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted August 30, 2012 Share Posted August 30, 2012 In that case, you will have do poll the state of the ava with a timer - there is no event that tells you, that an ava change inti a 'sitting state' Link to comment Share on other sites More sharing options...
Kaya Kiyori Posted July 19, 2017 Share Posted July 19, 2017 (edited) What's about an event? Is there also a event to check if the avatar sit or doesn't sit anymore on a object? (without an timer?) Edited July 19, 2017 by Sarah Lunardi Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 19, 2017 Share Posted July 19, 2017 No. The only events you have to work with in SL are the ones that are built into LSL. You can't invent new types of events. As Darkie said in this ancient thread, you can always run a timer event that polls llSetAgentInfo periodically to find out whether AGENT_ON_OBJECT is TRUE. You can't do it without some kind of timer. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted July 19, 2017 Share Posted July 19, 2017 A script in the object can use the changed event to know if someone has sat down on it or stood up, and can send a message to that avatar's HUD to tell it what's happened. But, other than that, you need to use a timer to check if the avatar is sitting or not. Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 19, 2017 Share Posted July 19, 2017 22 minutes ago, Innula Zenovka said: A script in the object can use the changed event to know if someone has sat down on it or stood up That is quite correct. To be clear, though, that will work only if the script is in the object that the avatar is sitting on. It depends on testing if (change & CHANGED_LINK){ if (llAvatarOnSitTarget() ){ //Avatar is sitting on this object } } The question that the OP asked in this thread was more general. On 8/29/2012 at 0:14 PM, Rayne McAndrews said: is there a way to determine via hud attached to avatar if the avatar sits on something? This something could be anything scripted or non and may or may not be owned by the avatar itself. When the question is "Is my avatar sitting on anything?", you have no choice to but to poll llGetAgentInfo, and that implies some sort of timer. 2 Link to comment Share on other sites More sharing options...
Lucia Nightfire Posted July 19, 2017 Share Posted July 19, 2017 You can also satisfy both the questions of "Am I sitting on an object?" and "What object am I sitting on?" with OBJECT_ROOT for llGetObjectDetails(): default { state_entry() { llSetText("",ZERO_VECTOR,1.0); llSetTimerEvent(1.0); } on_rez(integer i) { llResetScript(); } timer() { key k = llList2Key(llGetObjectDetails(llGetOwner(),[OBJECT_ROOT]),0); llSetText("You are " + llList2String(["sitting on an object named, '" + llKey2Name(k) + "'","NOT sitting on an object."],k == llGetOwner()),<1.0,1.0,1.0>,1.0); } } 3 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