|
Mortus Allen
Registered User
Join date: 28 Apr 2007
Posts: 528
|
07-19-2008 15:46
I am looking for a way to extract or convert an avatars key into an integer to use as a unique/qusi-unique listener channel for an auto-synchronizing teleporter I am making. Lets just say of all the ones I have been able to get my hands on or try out, none of them are just right for me so I am making my own. What functions should I be looking at to quickly and easily achieve this?
Thanks in advance.
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
07-19-2008 17:10
You'd need 4 integers to store a UUID key - there's just no way to squeeze the whole thing into a single integer. A UUID key looks like this: ABCDEF01-2345-6789-ABCD-EF0123456789. I'd convert the first 8 hex characters to an integer and just use that. It's not going to be totally unique within SL but will likely be unique for everybody in a region at any given time.. See also: http://wiki.secondlife.com/wiki/Hex
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
07-19-2008 17:21
Yes, what Sindy said. For a similar thing I've got
integer channel = -((integer) ("0x" + llGetSubString((string) llGetOwner(), 0, 6)));
This really only helps to help cut down on the likely number of listen events each script has to handle, something like llGetOwnerKey should still be in there to deal with crosstalk.
|
|
Sindy Tsure
Will script for shoes
Join date: 18 Sep 2006
Posts: 4,103
|
07-19-2008 18:06
Oh.. I never knew you could cast like that..
Pretty sleazy trick, Viktoria!! /me likes it!!
edit: and I wonder if doing that way is actually faster. Seems like it might be..
edit edit: why 0,6 instead of 0,7 ?
|
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
07-19-2008 18:42
From: Sindy Tsure edit edit: why 0,6 instead of 0,7 ? Oh, because I'm lazy. I wanted to use a negative number to leave avatar-usable space alone, and didn't think it was worth trying to squeeze every last bit out of the signed int space.
|
|
Mortus Allen
Registered User
Join date: 28 Apr 2007
Posts: 528
|
07-20-2008 09:07
Thanks alot! Think between that and having it only listen to other objects/teleporters of the same name a lot of CrossTalk should be eliminated if not all.
|