11-10-2006 09:06
Hi all,

Sorry if this is a common question, but couldn't find a reference to my problem.

I have the following script to simulate a hot tub filling with water after it is rezzed from a 'Water Button'. The rezzing and derezzing works perfectly, however, the movement or filling 'illusion' code only works one time when I save the script in edit mode. It works by bumping it up x number of increments (in this case 10 times).

If I take the object, and place it back on the ground, there is no movement. Similarly, when I inlcude it as part of the water tap, the water rezzes to the set point, but doesn't rise.

Why would it only work when I compile and save the script, and never again?

NB. It's currently 3am and my first script ever, am I missing something very obvious? :)

CODE

MoveUp(integer numMoves)
{
integer counter = 0;
vector tempTargetPos;

tempTargetPos = llGetPos() + <0.0, 0.0, 0.1>;

while(counter < numMoves)
{
llSetPos(tempTargetPos);
tempTargetPos = llGetPos() + <0.0, 0.0, 0.1>;
counter++;
}
}

default {
state_entry() {

MoveUp(10);

//rest of code is just waiting for button to be pressed again to empty the water
llListen( -906, "Water Button", NULL_KEY, "" );
}

listen(integer channel, string name, key id, string message) {
if (message == "derez") {
llDie();
}
}
}