Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llTargetOmega() Fun!

Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
03-22-2003 22:31
Nexus and I were working with llTargetOmega() for a windmill and waterwheel and ran into some problems.

The base of the problem is that once we started llTargetOmega() there seemd to be no way to change it - it's speed, direction or to just get it to stop.

Here is my "diagnostic" code:
CODE
 default
{
state_entry()
{
integer speed = (integer)llFrand(10);
llTargetOmega(<1,0,0>, speed, 1);
llWhisper(0,(string)speed);

llWhisper(0,"This code gets here");
llSleep(15);
llSetTimerEvent(10);
llWhisper(0,"This code even gets here");
}

timer()
{
llWhisper(0,"Timer event called");
llResetScript();
llWhisper(0,"This is after the llResetScript() call");
}
}


The output from this is:
CODE
Water Wheel whispers: 6
Water Wheel whispers: This code gets here
Water Wheel whispers: This code even gets here
Water Wheel whispers: Timer event called


And thats it, no matter how long I wait. I think this shows the worst of the problem because the TargetOmega script call seems to be preventing llResetScript() from working. We have also tried ones that call llTargetOmega() with different numbers durring a timer event. The event gets called but the spin isn't changed.

Also, llTargetOmega() won't actually spin an object if anyone is editing it (good!) but if you let the script run while still editing the object, then the errors do not occur. At least with regards to llResetScript(). The problems only seem to be when the object is actually spinning.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
03-23-2003 01:58
umm. whenever you reset the script basically it clears the values in all variables, and then starts from the top again. And the reset script call immediately resets it, so it doesn't execute any code that follows that.

So given that your targetomega is in the state_entry, everytime you reset the script, it exits the default state, and then immediately re-enters the state, causing the state_entry event to go off, which then leads to the timer, then to the reset, and then the process starts again. you basically created an infinite loop

i am not sure if this is the answer to your question cause i just went an rered your post, and wasn't entirely sure what your question was :D
_____________________
i've got nothing. ;)
Nexus Nash
Undercover Linden
Join date: 18 Dec 2002
Posts: 1,084
03-23-2003 10:14
Nada... The problem is if we simply call llSetTargetOmega again with a different value... it does not change.
_____________________
BuhBuhCuh Fairchild
Professional BuhBuhCuh
Join date: 9 Oct 2002
Posts: 503
03-23-2003 11:21
I think this is client side. I have noticed something like this - the spin won't start unless something is done to update the viewer, such as editing the object slightly, or flying into the next sim, and coming back. here is my snippet:

CODE

float spinrate = 0;
default
{
touch_start(integer total_number)
{
spinrate += 1;
llTargetOmega(<0,0,1>, spinrate, 2);
}
}


and at first, it doesn't seem to work, you can touch it all you want and it won't start to spin, but if you fly into the next sim, and come back, you will see that it IS spinning, and faster.

BBC
_____________________

START!
Make your own movie in Second Life for
The Take 5 Machinima Festival
Films due Dec 4, screening Dec 7!
http://www.alt-zoom.com/take5.htm

Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
03-23-2003 11:27
Nada:
The problem is that it isn't doing what you describe. I never expected the "This is after the llResetScript() call" message to show, if it did that would have been bad. However the code I posted does not repeat. It runs through once and then freezes, essentially. The wheel still spins (but this may be illusion from what BBC says), but none of the messages are repeated and the speed doesn't change.


BBC:
Ah ok, that makes some sense, but should be classified as a bug, yes? I should't have to leave the sim and come back to notice a change in speed....
BuhBuhCuh Fairchild
Professional BuhBuhCuh
Join date: 9 Oct 2002
Posts: 503
03-23-2003 11:49
yeah...bug
_____________________

START!
Make your own movie in Second Life for
The Take 5 Machinima Festival
Films due Dec 4, screening Dec 7!
http://www.alt-zoom.com/take5.htm

Andrew Linden
Linden staff
Join date: 18 Nov 2002
Posts: 692
03-24-2003 18:26
Yes, I was able to verify this bug. It seems the llResetScript() sometimes doesn't cause the script to re-enter the default entry state. I filed a bug.

However, BBC's touch-based script was working fine for me in the development branch so that will definitely be fixed by the next release.