Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Using keys for animating avatar

Masai Taringa
Registered User
Join date: 23 Oct 2006
Posts: 12
03-12-2007 15:01
Hi,
I would try to do a simple thing (well, I hope it could be simple!): I have an object full of animations, and I want to assign some key of the keyboard to a different avatar animation. So, when I push 'z' key I want to start the 'say_hello' animation, when I push 'x' I want to start the 'kick' anim, and so on. Is it possible with LSL ??

Thanks a lot
Masai
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
03-12-2007 19:40
There's a couple ways to go about it.

The first and most common is to make a gesture, put the animation in it, and assign a hotkey (a combination of one of the F1-F12 keys and/or Ctrl/Shift/Alt). This doesn't require scripting.

The second way is to use llTakeControls to capture some (very few, actually) of the keys with a script. This way is fraught with issues, as the only keys which can be captured are the arrow keys, PageUp/Down, Home, and a few others. You can't capture the alphanumeric keys. In addition, it can conflict with various other items which want to take controls, like vehicles, for instance.

So, I would say that, unless you just cannot use the function keys with a gesture, use that method.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
03-13-2007 02:24
From: Talarus Luan
There's a couple ways to go about it.

The first and most common is to make a gesture, put the animation in it, and assign a hotkey (a combination of one of the F1-F12 keys and/or Ctrl/Shift/Alt). This doesn't require scripting.

The second way is to use llTakeControls to capture some (very few, actually) of the keys with a script. This way is fraught with issues, as the only keys which can be captured are the arrow keys, PageUp/Down, Home, and a few others. You can't capture the alphanumeric keys. In addition, it can conflict with various other items which want to take controls, like vehicles, for instance.

So, I would say that, unless you just cannot use the function keys with a gesture, use that method.



A third way would be to just have it listening on a channel (NOT 0 though!) and reacting to what you type.
Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
03-13-2007 02:40
a 4th way is to have your gestures that speak commands on a hidden channel, and your attachment listens for those commands that can be typed by hand or by the gesture keys
Masai Taringa
Registered User
Join date: 23 Oct 2006
Posts: 12
03-13-2007 03:44
Thank you to all for your answers!
My problem is that I want to do a fighting game, so I need an immediate reaction with pressed keys, and the method of printing letters in chat and than press 'enter' is not a solution.
I think that the only solution is to make a HUD with buttons for actions....

Masai
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
03-13-2007 03:59
From: Masai Taringa
Thank you to all for your answers!
My problem is that I want to do a fighting game, so I need an immediate reaction with pressed keys, and the method of printing letters in chat and than press 'enter' is not a solution.
I think that the only solution is to make a HUD with buttons for actions....

Masai


Which is exactly the reason that Gestures was proposed. A HUD may be your answer but that requires your mouse as opposed to an F-key.
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Masai Taringa
Registered User
Join date: 23 Oct 2006
Posts: 12
03-13-2007 04:36
Thank you nand,
but, is it possible to configure the F-keys from LSL ?? I suppose I can only set these keys from the Gestures menu... And, I need to program some 'combo' actions, like 2 or more keys that doing a particular action...
Tyann Toll
It went... where?!
Join date: 17 Dec 2006
Posts: 37
03-13-2007 04:40
You can capture several keypresses at once, although the keys that can be captured seem to be limited. If you take a look at the LSL wiki, I think you might find some useful examples.