Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Raising tubwater problem.

Margot Schnyder
Generalsekretärin
Join date: 20 Feb 2007
Posts: 14
03-08-2007 04:20
Hi all, i'm trying to get some tubwater (single prim, 2.5 x 2.5 x 0.010 meters) raise smooth, first i tried to do it with a for-loop which contained a sleep() and the llSetPos()-function, but that didn't worked at all, it just acted as the sleep()-function where outside the loop and that it moved the water to it's top position in just one loop revolution...

Then i found a script on the net, one that makes the prim physic, that i modified a bit, and... it allmost works... Problem is, when i touch the water (initiates the script), the water drops a bit before it starts to climb even though i have made it weightless with llSetBuoyance(), and it never reaches it's destination. If i lower the "llMoveToTarget( destination, 60 );" to 10 or something, it reaches it's destination, but it goes way to fast. I need to have a smooth steady climb that lasts in about 60 second.


CODE
integer targetID;

default
{

touch_start( integer total_number )
{
llSetStatus(STATUS_PHYSICS, 0);
llSetStatus (STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, FALSE);
llSetBuoyancy(1);

// Become a physical object
llSetStatus(STATUS_PHYSICS, TRUE);
llWhisper( 0, "we're on our way" );

// destination is ten meters above our current position
vector destination = llGetPos() + <0, 0, 1.611>;

// how close is close enough
float range = 0.5;

// Ask to be informed whether we're there or not
targetID = llTarget( destination, range );

// Start moving towards the destination
llMoveToTarget( destination, 60 );
}

not_at_target()
{
// We're not there yet.
llWhisper(0, "Still going");
}

at_target( integer number, vector targetpos, vector ourpos )
{
vector arrived = llGetPos();
llSay(0, "We've arrived!");

// Stop notifications of being there or not
llTargetRemove(targetID);

// Stop moving towards the destination
llStopMoveToTarget();

// Become non-physical
llSetStatus(STATUS_PHYSICS, FALSE);
llSetPos(arrived);
}
}


Does anyone have any ideas?
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
03-08-2007 04:39
Okay I wrote something like that to make a fountain spout slowly, another variation opens doors slowly... all use for() loops

So something like this should work, haven't tested sorry:

Simply send Pos() the starting vector position of the prim and increase "integer steps" to slow it down.

No physics needed, just put this on any regular prim

CODE

Pos(vector original)
{
integer i;
integer steps = 5;

vector adding = original / steps;

for(i=0;i< steps;++i)
{
vector add = original + adding;
llSetPrimitiveParams([PRIM_POSITION, add]);
}
}


SL Main: Laronzo Fitzgerald
Margot Schnyder
Generalsekretärin
Join date: 20 Feb 2007
Posts: 14
03-08-2007 05:40
Thanks! I tried now, but i cannot make it work, first of all i'm a total newbie and n00b in SL and LSL, so i dont even know how to send Pos the starting vector... :|

All i get is syntax error when i paste your code in the script.

Tried to do a "vector original = llGetPos();" prior to your script, but that didn't help me, it allso generated syntax error. My guess is that Pos() in your script should be called as a function, am i right?

I tried to just run just this part:
CODE
default
{

touch_start( integer total_number )
{
vector original = llGetPos();

integer i;
integer steps = 5;

vector adding = original / steps;

for(i=0;i< steps;++i)
{
vector add = original + adding;
llSetPrimitiveParams([PRIM_POSITION, add]);
}


}
}

But then it just dissapeared of the world and was returned to my lost and found. How is direction of motion and the distance it should move controlled? I dont get it... :/
Diego Pannotia
Laronzo Fitzgerald
Join date: 14 Nov 2006
Posts: 37
03-08-2007 09:27
Take out the script, position your object in it's "start position", move your object upwards manually to the position you want it to end up in and note down the position x,y,z coordinates that you can see in the edit menu.

Not really too sure but try this - will test when I'm back in flat

NOTE: replace vector new with "end position"

direction of movement is controlled by one of the x,y,z coordinates, note the coordinates for starting position and ending, one of them (probably z) will have changed.

default
{

touch_start( integer total_number )
{
vector original = llGetPos();

integer i;
integer steps = 5;

vector new = <0,0,0>;

vector original2 = new - original;

vector adding = original2 / steps;

for(i=0;i< steps;++i)
{
vector add = original + adding;
llSetPrimitiveParams([PRIM_POSITION, add]);
}


}
}
Margot Schnyder
Generalsekretärin
Join date: 20 Feb 2007
Posts: 14
03-18-2007 06:09
Many thanks for the help, much appreciated. :)