Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

state change, take controls, apply impulse problem

Johnny Melnitz
A Skydiving Fool... D.B.
Join date: 31 Mar 2006
Posts: 7
01-14-2007 18:45
I've written this script that goes into an attachment (sorry for not posting it here - planning on selling a product based on this script soon).

Well, here's a break down of what happens:

1: It script sits idle waiting on a command from another script. When it receives this command, it switches to another state... we'll call this state one.

2: On entering state one, it gets permissions and takes controls. The controls and impulse while in state one, work fine - when you press either the E or C keys - it switches to one of two other states ( call them two and three ).

3: The other states do basically the same thing. I have them asking permissions and taking controls. Press either W or S and its supposed to apply an impulse just like in state one. The controls work ( 'cause the animations work ), but the impulses no longer work.

I don't know if I explained it very well, but essentially there are 3 states that need to take controls and apply impulses when W or S is pressed. The first state works fine, switching to either of the other two causes the impulse to stop working...

The formula I'm using for the impulses are exactly the same. I've tried releasing the controls on state changes, but nothing has worked so far.

any ideas?
mucho gracias in advance for any help...
_____________________
****************
Actually, we should be discussing what this guy's secret is. God tried to kill him at least four times, and only managed to break a leg. --ManBird
****************
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
01-14-2007 19:56
Use lots of llOwnerSay messages to keep you informed wrt the flow of your script. Hope I am not trying to tell you how to suck eggs, but that is always the first line of attack.

At the top of your script you write something like:
CODE

integer DEBUG = TRUE; // set to FALSE when not required


Then at the start of wherever you expect things to happen, something like:

CODE

if (DEBUG)
llOwnerSay ("State xxxx: got to xyz, var1 = " + (string) var1);
Johnny Melnitz
A Skydiving Fool... D.B.
Join date: 31 Mar 2006
Posts: 7
01-14-2007 20:25
yep... thats what I always do when something doesn't go as expected :)

In this case, I set it up to say when either the W or E keys were pressed inside either of the two states that I don't get an impulse. I get the feedback when I press the keys, but still don't get any impulse. So there shouldn't be any problems with the controls, they work as expected.

ah.. did another test... this time I disable the buoyancy change. Everything works fine now :rolleyes: I should have figured...

Looks like I've got some more testing to do with llSetBuoyancy... apparently when I changed the buoyancy, I made the mass too much for the impulse to move.
_____________________
****************
Actually, we should be discussing what this guy's secret is. God tried to kill him at least four times, and only managed to break a leg. --ManBird
****************
Woopsy Dazy
Registered User
Join date: 12 Nov 2006
Posts: 173
01-14-2007 23:17
From: ed44 Gupte
Use lots of llOwnerSay messages to keep you informed wrt the flow of your script. Hope I am not trying to tell you how to suck eggs, but that is always the first line of attack.

At the top of your script you write something like:
CODE

integer DEBUG = TRUE; // set to FALSE when not required


Then at the start of wherever you expect things to happen, something like:

CODE

if (DEBUG)
llOwnerSay ("State xxxx: got to xyz, var1 = " + (string) var1);


I usually do like this, a bit more handy perhaps:

integer debugging = TRUE; //Turns debugging on and off

debug(string msg)
{
if (debugging == TRUE)
llOwnerSay(msg);
}

then simply type in code everywhere u need it (example):

touch_start(integer something)
{
debug("Touched.";);
}