User talk:Fred Gandt/Scripts/Continued 4
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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)