# wandering uhu

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

Hi everyone I wonder if you could help I came across this delighful page which i though might solve all of my problems http://wiki.secondlife.com/wiki/Wanderer only to implement a version of :

```vector nextCoordinates(integer TYPE) {
float driftRange = llFrand(MOVEMENT_RANGE);
float a = llFrand(TWO_PI);
float b = llFrand(TWO_PI);
float c = llFrand(PI);
if(TYPE == 2) return <iPos.x + driftRange, iPos.y + llFrand(MOVEMENT_RANGE), iPos.z>;
if(TYPE == 4) return <iPos.x + driftRange * llCos(a), iPos.y + driftRange * llSin(b), iPos.z>;
if(TYPE == 8) return iPos + <driftRange * llCos(a) * llCos(b), driftRange * llCos(a) * llSin(b), driftRange * llSin(a)>;
if(TYPE == 16) return iPos + <driftRange * llCos(a) * llCos(b), driftRange * llCos(a) * llSin(b), driftRange * llSin(c)>;
if(TYPE == 32) return iPos + <driftRange * llCos(a) * llCos(b), driftRange * llCos(a) * llSin(b), -driftRange * llSin(c)>;
if(TYPE == 64) return iPos + <driftRange * llCos(a) * llCos(b), llFrand(MOVEMENT_RANGE) * llCos(a) * llSin(b), driftRange * llSin(a)>;
if(TYPE == 128) return iPos + <driftRange * llCos(a) * llCos(b), llFrand(MOVEMENT_RANGE) * llCos(a) * llSin(b), driftRange * llSin(c)>;
if(TYPE == 256) return iPos + <driftRange * llCos(a) * llCos(b), llFrand(MOVEMENT_RANGE) * llCos(a) * llSin(b), -driftRange * llSin(c)>;
return iPos;
}

by the wanderer```

Does anyone have a neater solution please like llWanderWithin( uses?

Thanks for looking Denise

Edited by VirtualKitten
##### Share on other sites

On 2/7/2021 at 3:14 AM, VirtualKitten said:

Does anyone have a neater solution please like llWanderWithin( uses?

given that nextCoordinates is a lookup for different math calculations then the way this code is written is the most efficient. Is not elegant but it is efficient

##### Share on other sites

This is what it does really slowely
https://gyazo.com/817c0d8023c35918775b125b6154d535

Its going round but flame does not point the same direction i am