Difference between revisions of "No Limit Teleporter"
Jump to navigation
Jump to search
(Added to category LSL Examples — even though the example is not a good one, the critique by @BETLOG Hax is precise and to the point!) |
m (→Simple Teleporter - No Limitation: I have no idea what I changed because I lost the session lol) |
||
Line 1: | Line 1: | ||
== Critique to the above script by [[User:BETLOG Hax|BETLOG Hax]] == | == Critique to the above script by [[User:BETLOG Hax|BETLOG Hax]] == | ||
Line 68: | Line 19: | ||
// This an inherently bad approach; given 6 decimal places on 3 floats in a vector its | // This an inherently bad approach; given 6 decimal places on 3 floats in a vector its | ||
// very UNlikely the equivalency will be precisely equal even if its VERY close, this | // very UNlikely the equivalency will be precisely equal even if its VERY close, this | ||
// will become especially evident at high altitude. It'll look | // will become especially evident at high altitude. It'll look like its stopped, | ||
// but the llSetPos() will be still thrashing away. Possibly for quite some time/forever. | // but the llSetPos() will be still thrashing away. Possibly for quite some time/forever. | ||
// | // | ||
Line 79: | Line 30: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
And a system that has a user function call itself from within itself is probably not good. | And a system that has a user function call itself from within itself is probably not good. | ||
This is MUCH | This is '''MUCH''' better: ['''MUST''' be compiled in [[mono|MONO]]] | ||
<syntaxhighlight lang="lsl2"> | <syntaxhighlight lang="lsl2"> | ||
teleports(vector dest) | teleports(vector dest) |
Revision as of 10:19, 24 September 2022
Critique to the above script by BETLOG Hax
The above example is a really bad approach to use for many reasons. Not least of which is that lag is precisely what it will generate.
An equivalency check that respects SLs somewhat wiggly precision system, and isn't trying to match a movement to EXACTLY 6 decimal places of precision is needed.
if(llGetPos() != dest)
//is bad
if(llVecDist(llGetPos(),dest)<0.001)
//is MUCH better
ie:
teleports(vector dest)
{
// if(llGetPos() != stapos)
// This an inherently bad approach; given 6 decimal places on 3 floats in a vector its
// very UNlikely the equivalency will be precisely equal even if its VERY close, this
// will become especially evident at high altitude. It'll look like its stopped,
// but the llSetPos() will be still thrashing away. Possibly for quite some time/forever.
//
// the below will stop in a timely manner.
if(llVecDist(llGetPos(),dest) <= 0.001)
{ llSetPos(dest); //corrected variable
teleports(dest); //corrected variable
}
}
And a system that has a user function call itself from within itself is probably not good. This is MUCH better: [MUST be compiled in MONO]
teleports(vector dest)
{ list l=[PRIM_POSITION,dest];
l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;l+=l;
llSetPrimitiveParams(l);
}