Jump to content

Question about permission request when other avi click on item on my avi


dk201
 Share

You are about to reply to a thread that has been inactive for 2523 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi Everyone, I am new to LSL and here is my question:

I want to scripted an item attached to my avi all the time. This item needs to do 2 things:

1) Detect my avi's animation/move change. For example when avi is flying, this item need to know that. Except a while loop keeping check my avi's animation, is there a better implementation by using event or other machnisms?

2) When this item is clicked by other avis, I want to receive a request window ask me if I allow to run a function. Since this item is attached to my avi, and the click action is triggered by me, I cannot find a good way to have this done. Is there any built-in function allow me to make this happen?

Thanks in advance,

 

Link to comment
Share on other sites

Thanks for quick reply. I dont want to hire someone to do this for me. I would like to do scripting myself if anyone can just give me a quick answer if there is a built-in function that I missed.

Link to comment
Share on other sites

The quick answer to your first question is that the LSL function, llGetAgentInfo can tell you what the current state of your av is.  You'll have to run that in a reasonably fast timer to have continuous polling.  That's how AOs work, BTW.

The second operation you're asking about isn't clear to me.   You want someone else to be able to click on one of your attachments to do something.  That's easy enough.  I'm not sure what you mean by "the click action is triggered by me", though, so I can't really give you useful advice.

Link to comment
Share on other sites

To first question: Is timer a better option than a while loop? I implemented animation detection in a while loop, but wonder if timer is a better way to run scripts.

Let me rephrase my second question. I wanna have an item attached to my avi and everyone can click it. After someone click on it, I want this item send me a popout windonw to ask me if a function should run or not. I am doing it by using listener, but not sure is there any other way to do it.

Thanks for answers

Link to comment
Share on other sites

I would keep checking your animation state in a timer, firing at maybe once a second.    That's far better (and puts a lot less strain on the region) than does running an infinite loop, which I suspect is what you're contemplating.   Infinite loops are bad practice -- avoid them!

Depending on what you want to check, of course, I'd suggest you consider using llGetAnimation as an alternative to llGetAgentInfo.   I mention that simply because I find it's often more use to me than llGetAgentInfo, and a lot of people seem to overlook it.

As to your wanting to hav "a popout window," llDialog is the way to do it.   That involves having a listener, obviously, since you need a listener to know what the response is.

If you're worried about keeping an open listener, llLIstenRemove is what you need.

  • Like 1
Link to comment
Share on other sites

integer DISPLAY_ON = 1;
integer DISPLAY_OFF = 0;

default
{
state_entry()
{
string uuid = llGetOwner();

//6 stand
//134 walk
//4430 run
//22 sit on ground
//54 sit
// 263 hover/fly

integer buf = llGetAgentInfo(uuid);
while(1){
integer buf = llGetAgentInfo(uuid);

if(buf == 263) {
llSetAlpha(DISPLAY_ON, ALL_SIDES);
llSetLinkAlpha(LINK_SET, DISPLAY_ON, ALL_SIDES);
} else {
llSetAlpha(DISPLAY_OFF, ALL_SIDES);
llSetLinkAlpha(LINK_SET, DISPLAY_OFF, ALL_SIDES);
}
llSleep(3);
}
}

}

 

Here is my code to detect animation/status. Not sure if llSleep will be more helpful to reduce server stress than a timer, but it works well for me so far. If timer is a better choice, I would like to change to timer then.

Thanks for your answer to the second question. That helps a lot.

Link to comment
Share on other sites

llSleep is a lousy choice (almost always, unless you need to delay action for less than a second or so).  llSleep does exactly what it says.  It puts the entire script to sleep, makes it totally unresponsive so that it will not react to touches or sensor input or chat, or anything else.  Use a timer event.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2523 days.

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
 Share

×
×
  • Create New...