User talk:Fred Gandt/Scripts/Continued 4

From Second Life Wiki
Jump to navigation Jump to search
Fredgandt icon 1024 jpg.jpg

Comments about the contents of Fred Gandt/Scripts/Continued_4

Please create a new section for comments made on a new subject by clicking the "+" tab rather than the "Edit" tab.

Please sign you comment by adding 4 tildes (these thingies ---> "~") at the end of your comment.

  • E.g. "Blah blah blah ~~~~"

When you save your edit/creation the wiki will automatically convert the 4 tildes into your signature.

Abusive, offensive or otherwise inappropriate comments will be removed and reported to Linden Labs.

Zippadeedoodah

It seems like that having the text conversion in the function limits how reusable the function is.

I've spotted a couple of bugs and race conditions. Nothing serious but potentially bothersome non the less.

  • It should be faster to gen the list outside the loop as it changes the operation into a simple copy.
  • It's possible that the dest position is unachievable and your script will hang (hence the distance check).
  • -1 is the value for LINK_SET, which will cause llSetLinkPrimitiveParamsFast to try to move the seated avatar to that local position as well as the root prim to the same global position.
  • The script could end up in a non-root prim, which would cause it to still end up in an infinite loop as llGetPos returns local+root position. Hence llGetRootPosition.

<lsl>Zippadeedoodah(string dest_s) {

   vector dest = ((vector)("<" + dest_s + ">"));
   list pos = [PRIM_POSITION, dest];
   while(llVecDist(llGetRootPosition(), dest) > 0.001)
       llSetLinkPrimitiveParamsFast(LINK_ROOT, pos);

}</lsl> Random rambling addressing nobody: Using PRIM_POSITION with LINK_SET only makes sense as a bit of cleverness and with limited real world application. Wonder if I should write a note about about this? It might be useful in a (HUD) attachment? In any case you would probably want to use LINK_ALL_CHILDREN instead. Mixing global and local coord frames is unlikely to be wise. hmmm -- Strife (talk|contribs) 06:18, 16 May 2010 (UTC)

A bee or wasp just stung the top of my head while I was walking my dog. *whimpers* -- Fred Gandt (talk|contribs) 07:32, 16 May 2010 (UTC)
I'll be honest (I always am), I can't see how the tiny measure of llVecDist(llGetRootPosition(), dest) > 0.001 could ever be an issue (but seriously my head feels bloated and poopy). I fully understand the LINK_THING verses LINK_THING thing (Thank you. Now under belt). I assume that storing list pos = [PRIM_POSITION, dest]; before using it makes the use of it faster or more efficient? We don't have to create the list fresh each call of llSetTheThingies? Tried it in-world and it seemed about the same performance wise (too poopy to get into it...oooh I know....erm....llGetTime). -- Fred Gandt (talk|contribs) 08:02, 16 May 2010 (UTC)
2.623372 (V1) against 2.400593 (V2) seconds. Obviously the same rout traveled. That was ground to 4000m almost directly up. So yours is slightly quicker (in one test) *smiles* Thanks for the heads up Strife. It's nice to know someone is watching my back. I do mention on my main user page that I try but can fail. "It takes a village" and all that. TY -- Fred Gandt (talk|contribs) 08:18, 16 May 2010 (UTC)
What's a race condition? -- Fred Gandt (talk|contribs) 08:56, 16 May 2010 (UTC)
OK. Wikipedia has answered that one but...oh never mind. Damn buzzy flying thing. My head feels like mush. -- Fred Gandt (talk|contribs) 09:03, 16 May 2010 (UTC)

llVecDist because of float rounding? True equality with dest being occasionally but then repeatedly missed? lolz llSetPosKindaSorta. I really do get the LINK_ROOT stuff btw (not just saying that to seem smarter). I hadn't realized before your comment that -1 would attempt to move each prim to dest, rather I thought (stupidly I now realize) that I was asking that the set be moved *grins*

Sorry about my own ramblings. That sting made my head pound a bit. Just watched "Scanners" all the way through for the first time. Interestingly (for me at least) watching other peoples head swell and explode made my own swelling go down. -- Fred Gandt (talk|contribs) 13:27, 16 May 2010 (UTC)
It's all cool. The position thing is annoying, there should be a caveat about that somewhere. -- Strife (talk|contribs) 20:24, 16 May 2010 (UTC)