Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Using CONTROL_FWD out of Mouselook?

Ramus Overlord
Builder & Beach Bum
Join date: 27 Nov 2005
Posts: 52
03-15-2008 17:12
Stupid question here, I have an object that you sit on. Basically, what I am trying to do is a test script is make it say "Hello" whenever I am sitting on it and clicking W. However, I can not seem to do it unless I am in mouse look. I have a swing I purchased that allows me to just sit on it, and press up or down without being in mouselook and it works just fine. Any tips?
_____________________
Don't Panic
Visit www.secondlifetraveler.com
Your Travel Guide to the Metaverse!
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
03-16-2008 11:30
Just use CONTROL_LBUTTON without mouselook.

such as:

if(level & (CONTROL_LBUTTON)){
llOwnerSay("WooHoo!! We're flyin' NOW!";);
state plane;
}


I use this as a qualifier in one of my vehicles - I use it to change states between flying vehicle or driving vehicle via clicking anywhere on the screen (that doesn't have a touch item in the way. ;) )
Ramus Overlord
Builder & Beach Bum
Join date: 27 Nov 2005
Posts: 52
03-16-2008 12:07
From: Haplo Voss
Just use CONTROL_LBUTTON without mouselook.

such as:

if(level & (CONTROL_LBUTTON)){
llOwnerSay("WooHoo!! We're flyin' NOW!";);
state plane;
}


I use this as a qualifier in one of my vehicles - I use it to change states between flying vehicle or driving vehicle via clicking anywhere on the screen (that doesn't have a touch item in the way. ;) )


Thanks for the response, CONTROL_LBUTTON actually works like you said. But I was hoping to use the up key for the script. And that only seems to work in mouselook. I may just end up using LBUTTON if theres no other choice, but hoping there is a way to get the other keys to work outside of mouselook.
_____________________
Don't Panic
Visit www.secondlifetraveler.com
Your Travel Guide to the Metaverse!
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
03-16-2008 12:26
I am a little confused reading this thread.

"W" as mentioned in the first post is forward, not up, hence CONTROL_FWD - this should be the same in mouselook or out of mouselook. Up is CONTROL_UP, again, the same. The differences in mouselook are that (a) left click is CONTROL_ML_LBUTTON rather than CONTROL_LBUTTON and (b) left and right, A and D, are mapped to linear movement rather than turning, so they are CONTROL_LEFT rather than CONTROL_ROT_LEFT.

But those should be the only difference really.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Ramus Overlord
Builder & Beach Bum
Join date: 27 Nov 2005
Posts: 52
03-16-2008 19:21
From: Ordinal Malaprop
I am a little confused reading this thread.

"W" as mentioned in the first post is forward, not up, hence CONTROL_FWD - this should be the same in mouselook or out of mouselook. Up is CONTROL_UP, again, the same. The differences in mouselook are that (a) left click is CONTROL_ML_LBUTTON rather than CONTROL_LBUTTON and (b) left and right, A and D, are mapped to linear movement rather than turning, so they are CONTROL_LEFT rather than CONTROL_ROT_LEFT.

But those should be the only difference really.


Ok, yea im getting pretty confused also. Basically, all I want to do is be able to press a button out of mouselook, while sitting on a box.

Heres my code so far, maybe you can tell me what im doing wrong!

----------------------------
default
{
touch_start(integer total_number)
{
llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS);
llTakeControls((CONTROL_FWD), TRUE, TRUE);
}

control(key id, integer level, integer edge)
{
if (level & (CONTROL_FWD)) {
llSay(0, "Sup";);
}
}
}
----------------------------

Now, when I go into mouse look and I press W or arrow key up, it works! When im not in mouselook, it does not. I know I must be doing something horribly wrong here. (Also im making sure it takes controls before I do it, its in touch just cause im testing it)
_____________________
Don't Panic
Visit www.secondlifetraveler.com
Your Travel Guide to the Metaverse!
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
03-16-2008 21:43
To do that, you need to take controls on sit. Like follows:

CODE

default
{
touch_start(integer total_number)
{
//llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS);
//llTakeControls((CONTROL_FWD), TRUE, TRUE);
}
state_entry()
{
llSitTarget(<0.0, 0.0, 0.5>, ZERO_ROTATION);
}
control(key id, integer level, integer edge)
{
if (level & (CONTROL_FWD))
{
llSay(0, "Sup");
}
}
run_time_permissions(integer perm)
{
if (perm)
{
llTakeControls(CONTROL_FWD, TRUE, FALSE);
}
}
changed (integer change)
{
if (change & CHANGED_LINK){
key agent = llAvatarOnSitTarget();
if (agent)
{

llRequestPermissions(agent, PERMISSION_TAKE_CONTROLS);

}
else
{
llReleaseControls();
}
}
}

}


try that out in any cube... and you'll be set.

Take care,
- Hap
Ramus Overlord
Builder & Beach Bum
Join date: 27 Nov 2005
Posts: 52
03-17-2008 00:58
From: Haplo Voss
To do that, you need to take controls on sit. Like follows:

CODE

...


try that out in any cube... and you'll be set.

Take care,
- Hap


That was exactly what I was missing. Thanks a lot, works perfectly. :)
_____________________
Don't Panic
Visit www.secondlifetraveler.com
Your Travel Guide to the Metaverse!