Suzanna Soyinka
Slinky Slinky Slinky
Join date: 25 Nov 2005
Posts: 292
|
01-27-2006 02:38
I need to know how to keep two objects with the same script that communicate on the same channel from activating each other. Basically the objects animate their user, but if two users with the same object are within the same area, one person activating the Dialog menu for themselves ends up activating the dialog menu for the other user too..and a choice on the menu by either user animates both users.
I've tried llGetPermissionsKey and that doesn't seem to do what I want, right now I'm using llRequestPermissions for the animations and llGetOwner...but for some reason the object doesn't just affect its owner, it affects other avatars with the same item in range of it.
I'm sorry if the solution to this seems stupidly obvious but I'm not a programmer like...at all..and I've been teaching myself LSL via the Wiki.
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
01-27-2006 06:41
OK, there are a couple of ways to do this. If the object is supposed to only listen to it's owner then declare the listen statement to your dialog box (menu) with llListen(channel, "", llGetOwner(), ""  ; (obviously with the right number in the channel declaration. Then each obejct will only listen to it's owner so will ignore other people hitting their controls. Also, if you're opening and closing the listeners (which is usually accepted as good practise) you could set a random channel on each listen so you're much less likely to get the channels confused - this will not be 100% (but can be 1:5 million or so) but will let you have systems where others can override the animation if appropriate.
|
Suzanna Soyinka
Slinky Slinky Slinky
Join date: 25 Nov 2005
Posts: 292
|
01-27-2006 07:15
Thank you, I'll give that a try, it sounds like it should work just fine. Appreciate the time you took to answer  .
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
01-27-2006 07:51
Use llListen(channel, "", llGetOwner(), "" ; to limit the listen to your owner. If the dialog is on another avatar, then use the key you used in the llDialog() call in a new listen. integer listen_handle = 0; post_dialog_and_listen(key avatar, string message, list buttons, integer channel) { if(listen_handle) llListenRemove(listen_handle); listen_handle = llListen(channel, "", avatar, ""); llDialog(avatar, message, buttons, channel); }
time_out_dialog() { if(listen_handle) llListenRemove(listen_handle); listen_handle = 0; }
You should probably call time_out_dialog() from a timer event after a couple of minutes, to cut down lag, unless you have the listen up for other reasons.
|