Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llKey2Name working across sims

Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
01-26-2006 10:00
I have a multi-sim dance machine that uses llKey2Name to know whether the avatar is on the other side of the dance floor (in the other sim). It used to return "" but now it returns the avatar name. I guess this could be considered a fixed bug but it means a useful hack is gone.

My problem is that whenever my timer trips I want to do an llStartAnimation for the new dance. llStartAnimation doesn't work across sims so if llKey2Name returns "" I pass control to an object in the other sim to control the avatar. But now that llKey2Name succeeds I'm getting "Script trying to trigger animations but agent not found." And of course LSL doesn't let us trap errors like real programming languages do (burn!!). When the avatar touches the dance machine from the other sim I can use llDetectedPos to know they're in the other sim, but not for the timer event.

Anyone see a fix for my problem?
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
01-26-2006 10:13
Looking at wiki, you could try llGetAgentSize(their_key) - if it's NULL_VECTOR they've left the sim.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
01-26-2006 10:17
There are some other functions that return known zero values when they are called with a key of an avatar not in the current sim. llGetAgentSize, llGetBoundingBox, llGetObjectMass are some I can name offhand.

LL needs to understand that a development environment needs to remain stable for SL to become a viable platform. Programming in LSL becomes worthless if the behavior of the underlying API can dramatically change between minor versions - we're stuck in a neverending loop performing regression testing on each and every one of our creations, desperately trying our best to fix every little glitch changes bring to our products as fast as possible. You *have* to be addicted to this "game" in order to keep up - casual users cannot maintain products like this.

Its this way that scripters get screwed over - texture creators have the upload fee, modelors have the prim limit - but at least their creations are more protected against version-damage, as changes to the platform that negatively impact their creations are immediately apparent and so often grapple with intense community response. When the same happens to a scripter, the customer places blame on the scripter rather then the platform.

Shit like this is what's driving me to sift through the sourcecode of the Open Source Metaverse Project, in an attempt to learn C++ and make some serious progress.
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Iron Perth
Registered User
Join date: 9 Mar 2005
Posts: 802
01-26-2006 10:26
API versioning is probably the only soution I can think of here.

Default parameters ala C++ is one way of doing this without making too big a mess of things.

eg, llKey2Name(key k, integer multisim=FALSE)

This way you could maintain the previous behaviour but if people wanted the new approach they could make a call to llKey2Name(k,TRUE)
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
01-26-2006 10:36
From: sky Honey
Anyone see a fix for my problem?
Three more possibilities:

1. Have the timer trigger a sensor for the avatar's key rather then changing the animation directly, and have the change in the sensor event? If you have a bunch of avs to monitor, then have a sensor for AGENT instead of a bunch of sensors for specific keys.

2. Put a transparent volume-detect wall at the sim border, and have it keep track of which sim the avatar is in.

3. Volume-detect floor sensors to keep track of which sim the avatar is in.
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
01-26-2006 10:48
Thanks Yumi and Christopher, llGetAgentSize is working for me, until the next update anyway.

llKey2Name is behaving inconsistently now. I made an object that IM's me my name every few seconds and flew away from it to various distances. It does not have a consistent range - sometimes it works from a few hundred meters and sometimes it doesn't. It can be relied on in the same sim still, but it has not become a grid-wide function.

Argent, nice ideas! The sensor event would be nice except it's not working across the sim border for me now even though I'm standing 2 meters away! I was using the sensor to detect that the avatar had left the event without stopping the animation so I could free up the script. I think I need more communication between the master dance machine in one sim and the slave in the other to find out if the avatar is actually gone, but i'll think about the volume-detect ideas too.

Fixes and good ideas in just a few minutes. I love this forum :)
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
01-26-2006 10:51
From: Christopher Omega
LL needs to understand that a development environment needs to remain stable for SL to become a viable platform. Programming in LSL becomes worthless if the behavior of the underlying API can dramatically change between minor versions ...
Although, using llKey2Name as an Is-Av-In-Sim function probably falls into the realms of a "clever" hack - like changing states within a function - that we should expect to change at any time as LL improve the system. (After all, having a cross-sim llKey2Name is definitely an improvement).

Now, had they broken llIsAvInSim, for example, I'd be agreeing with you. :)
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
01-26-2006 10:57
Good point Ben, but if they kept up with the Wiki and what scripters are doing, they could have added llIsAvInSim in one release and improved llKey2Name in the next. Also, as I posted just a couple of minutes before you, llKey2Name is not actually more useful because it's not grid wide.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-26-2006 12:43
Having read this thread I wonder if it's a child agent thing? There's that time after you leave a sim before the sim lets you go, even if you tp away - llDialog and llGiveInventoryList IIRC both show odd behaviour thanks to it.

This strikes me as the sort of thing that could also be in that category, but I don't know how to check.