02-13-2007 04:04
Im currently building a waterwheel (ancient machine for extracting power from the flow of water - wiki). In the default entry the wheel is turning but with one click i want to make it stop. A second click makes it turn again. This works but when its stopped it spins back to its default position. Is there a way to make it stop and start from its current position?

CODE

default
{
state_entry()
{
state water_on;
}
}

state water_on
{
state_entry()
{
llSay(0, "The water is flowing");
llTargetOmega(<-1,0,0>,1,1);
rotation llGetRot;
}


touch_start(integer total_number)
{
state water_off;
}
}

state water_off
{
state_entry()
{
llSay(0, "The water stopped flowing");
llTargetOmega(<0,0,0>,1,1);
}

touch_start(integer total_number)
{
state water_on;
}
}