Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Quick Vehicle Question

Johnny Mann
Registered User
Join date: 1 Oct 2005
Posts: 202
07-09-2006 10:02
Hi,

Building a ship.

Left and right arrows (also A & D) strafe in mouselook but don't strafe out of mouselook.

What am I doing wrong?

Thanks!
Johnny Mann
Registered User
Join date: 1 Oct 2005
Posts: 202
07-10-2006 05:52
Hi Well basically what happens is while im in mouselook, Left and Right strafe.. but when I am out of mouselook, left and right do nothing and I can only go FWD BACK UP DOWN. I am not sure why or what in the script makes different operations in MOUSELOOK and out.
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
07-10-2006 06:23
I'm not a scripting expert, but I know you have to script for both left and right as well as strafe left and right. basically same thing except it uses SHIFT plus the key.
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
07-10-2006 06:33
From: Johnny Mann
I am not sure why or what in the script makes different operations in MOUSELOOK and out.

http://secondlife.com/badgeo/wakka.php?wakka=mouselook

"When using the llTakeControls function and the control event it is important to remember that the values returned by the same buttons can be different depending on if the avatar is in mouselook mode or not. For example, by default A will turn the avatar left in normal mode and trigger CONTROL_ROT_LEFT in the control event. However, in mouselook mode, A will cause the avatar to strafe left (move left without turning) and trigger CONTROL_LEFT."
Johnny Mann
Registered User
Join date: 1 Oct 2005
Posts: 202
07-10-2006 09:03
From: Joannah Cramer
http://secondlife.com/badgeo/wakka.php?wakka=mouselook

"When using the llTakeControls function and the control event it is important to remember that the values returned by the same buttons can be different depending on if the avatar is in mouselook mode or not. For example, by default A will turn the avatar left in normal mode and trigger CONTROL_ROT_LEFT in the control event. However, in mouselook mode, A will cause the avatar to strafe left (move left without turning) and trigger CONTROL_LEFT."


Yes that makes sense, but on the script (which is the CCC mouselook script) why does the L&R do nothing when not in mouselook?

I understand that default is ROT but why does it just sit there anotherwords. Why does the L&R become completely disabled. Is there something I can add to the take control functions?
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
07-10-2006 10:38
From: Johnny Mann
Yes that makes sense, but on the script (which is the CCC mouselook script) why does the L&R do nothing when not in mouselook?

I understand that default is ROT but why does it just sit there anotherwords. Why does the L&R become completely disabled. Is there something I can add to the take control functions?

Well, the thing isn't that keys become disabled, but rather that depending on what mode you're in, pressing the same key is interpreted in two different ways. Either as say, CONTROL_LEFT or CONTROL_ROT_LEFT

Now if your script in its control() handler only pays attention to one of these events, going into or out of mouselook will have the effect you experience. I.e. keys working in one mode and being ignored in the other.

The simplest way to deal with it would probably be, have your script to react in the same way to both CONTROL_ and CONTROL_ROT_ keys. E.g.
CODE

control( key id, integer held, integer change ) {

integer pressed = held & change;
integer down = held & ~change;
integer released = ~held & change;
integer inactive = ~held & ~change;

if(pressed & CONTROL_LEFT ) { // strafe left }
if(pressed & CONTROL_LEFT_ROT ) { // strafe left, too }
// etc
}

more elegant would be to take note if player is in the mouselook or not, and check for relevant controls only o.O;
Johnny Mann
Registered User
Join date: 1 Oct 2005
Posts: 202
07-11-2006 05:12
Ok so is there a way to strafe while in mouselook but ROT while out of mouselook?