help with key bindings
by deepscratch · in Torque 3D Professional · 07/07/2009 (2:34 am) · 17 replies
hi all,
I'm having trouble with key bindings.
mouse0 is fire, fine, mouse1 is altFire, ok,
but it actualy does jump as well, so does space,
with the swarm gun, mouse1 jumps and fires alt projectile at the same time. WTF?
try as I may, I cant get mouse1 to bind to anything else, there is always the jump.
help?
I am trying to get mouse2 (wheel button on press, not scroll) to be the alt fire, space, and space only, to be jump,
and mouse1 to be able to remap to something else that I have (iron sights), and only that, no jump.
anyone?
I'm having trouble with key bindings.
mouse0 is fire, fine, mouse1 is altFire, ok,
but it actualy does jump as well, so does space,
with the swarm gun, mouse1 jumps and fires alt projectile at the same time. WTF?
try as I may, I cant get mouse1 to bind to anything else, there is always the jump.
help?
I am trying to get mouse2 (wheel button on press, not scroll) to be the alt fire, space, and space only, to be jump,
and mouse1 to be able to remap to something else that I have (iron sights), and only that, no jump.
anyone?
About the author
email me at medan121@gmail.com
Recent Threads
#2
Trigger images -- If you have a secondary mounted image then send the second trigger to it. Else give it to the first image as an alt fire.
mvTrigger0 = mousefire - button0
mvTrigger1 = altTrigger - button1 This one can either trigger a 2nd mounted image (if there is one) or it will simply be used for alt-fire. And... yep, will cause jump jetting to happen too.
jump
mvTrigger2 = jump = space (will also dismount you from vehicle if mounted)
A problem lies in jumpJet (mvTrigger1)
if (move->trigger[1] && !isMounted() && canJetJump())
So if your player datablock is set up for jump jetting then this will cause interference when you are also using weapons that are setup for altFire. Possible oversight? Alt-fire is new -- I had wondered how jetting would function with that, but never tested. Now we know. This could be considered a bug.
Player stance/poses
mvTrigger3 = CrouchPose
mvTrigger4 = PronePose
With a little forethought in setting up your keybinds you can actually use different key maps for different player types, or when mounted, gametypes, etc so that you can over-ride certain mvTrigger based keybinds with others that aren't. For example, you can actually setup player controls such that SPACE can be used as the brake on a vehicle instead of dismounting, yet still be used to jump when not in a vehicle. $mvTriggerCount[3] can also be used to give vehicles a turbo boost.
How to resolve the jetting and alt-fire issue? Hmm, now that can be tricky. Don't give alt-fire enabled weapons to players who can jump jet is the easy solution.
Personally I would get rid of the current jetting code and replace it with a different implementation and then rework/reorder the mv trigger array in the source such that jetting and alt-fire don't conflict with each other.
07/07/2009 (4:06 am)
Look in player.cpp for the various move "triggers", these are your various $mvTriggerCount[n]. They have several pre-defined purposes in the source. Trigger images -- If you have a secondary mounted image then send the second trigger to it. Else give it to the first image as an alt fire.
mvTrigger0 = mousefire - button0
mvTrigger1 = altTrigger - button1 This one can either trigger a 2nd mounted image (if there is one) or it will simply be used for alt-fire. And... yep, will cause jump jetting to happen too.
jump
mvTrigger2 = jump = space (will also dismount you from vehicle if mounted)
A problem lies in jumpJet (mvTrigger1)
if (move->trigger[1] && !isMounted() && canJetJump())
So if your player datablock is set up for jump jetting then this will cause interference when you are also using weapons that are setup for altFire. Possible oversight? Alt-fire is new -- I had wondered how jetting would function with that, but never tested. Now we know. This could be considered a bug.
Player stance/poses
mvTrigger3 = CrouchPose
mvTrigger4 = PronePose
With a little forethought in setting up your keybinds you can actually use different key maps for different player types, or when mounted, gametypes, etc so that you can over-ride certain mvTrigger based keybinds with others that aren't. For example, you can actually setup player controls such that SPACE can be used as the brake on a vehicle instead of dismounting, yet still be used to jump when not in a vehicle. $mvTriggerCount[3] can also be used to give vehicles a turbo boost.
How to resolve the jetting and alt-fire issue? Hmm, now that can be tricky. Don't give alt-fire enabled weapons to players who can jump jet is the easy solution.
Personally I would get rid of the current jetting code and replace it with a different implementation and then rework/reorder the mv trigger array in the source such that jetting and alt-fire don't conflict with each other.
#3
will try some of this,
and I dont need jump jetting at all.
07/07/2009 (5:08 am)
awesome Michael,will try some of this,
and I dont need jump jetting at all.
#4
07/07/2009 (7:33 am)
This is only slightly related, but if I want to bind a function to the side mouse buttons in script, what are they called? button4 and button5?
#5
07/08/2009 (6:32 am)
I am actually trying to remove the Yaw and Pitch mouse bindings as well, and i find that even though I commented them out they keep coming up every time I run it. Unfortunately I am away from my development machine to check player.cpp, so I thought I ask if any of you know if those bindings are hard-coded as well or if they are repeated in more than one place along the script base
#6
too frustrating for now,
but I believe its a bit of both, William.
07/08/2009 (6:45 am)
I've gotten no further trying to remap,too frustrating for now,
but I believe its a bit of both, William.
#7
Most of the keybinds you will find in "scripts/client/default.bind.cs". If you make any changes here and you don't notice any effects then you need to delete your existing prefs.cs and config.cs (actually I don't think config.cs files even exist anymore) -- these script files are automatically generated for you depending on the various "defaults" (variables, preferences, and keybinds) throughout the code and override any default setting the game has previously loaded.
Make sure that you look in the core and tools scripts as well as inside your game package for the default key maps -- although the core and tools shouldn't interfere at all. You should get in the habit of removing the old prefs file(s) should you change your defaults.
On a side note, setting keybinds though the Options screen has been busted for a while now -- I don't know if this was ever resolved.
07/08/2009 (11:11 am)
I wasn't implying that certain keybinds where hard-coded, I was only trying to point out how the different mv "triggers" are set up in player.cpp. Most of the keybinds you will find in "scripts/client/default.bind.cs". If you make any changes here and you don't notice any effects then you need to delete your existing prefs.cs and config.cs (actually I don't think config.cs files even exist anymore) -- these script files are automatically generated for you depending on the various "defaults" (variables, preferences, and keybinds) throughout the code and override any default setting the game has previously loaded.
Make sure that you look in the core and tools scripts as well as inside your game package for the default key maps -- although the core and tools shouldn't interfere at all. You should get in the habit of removing the old prefs file(s) should you change your defaults.
On a side note, setting keybinds though the Options screen has been busted for a while now -- I don't know if this was ever resolved.
#8
Deleting config.cs and prefs.cs did the trick....Now that I unbinded the mouse, how can I restore the mouse icon in the screen?
07/08/2009 (4:49 pm)
Hello Michael and Deepscratch: Deleting config.cs and prefs.cs did the trick....Now that I unbinded the mouse, how can I restore the mouse icon in the screen?
#9
07/09/2009 (12:06 pm)
The onscreen cursor is controled by the guiControl "noCursor" field. So you might set that to be false on the PlayGui, for example.
#11
$mvTriggerCount2++
Then find all references to the method that contains it. Follow the trail!
07/09/2009 (1:19 pm)
Search for this line in script.$mvTriggerCount2++
Then find all references to the method that contains it. Follow the trail!
#12
EDIT:
If jump jetting then make sure your player datablock doesn't have these fields:
07/09/2009 (1:45 pm)
Quote:"jumping" or "jump jetting"?
I still cant unbind the right mouse from jump
EDIT:
If jump jetting then make sure your player datablock doesn't have these fields:
airControl = 0.3; jetJumpForce = 8.3 * 10; jetJumpEnergyDrain = 0.6; jetMinJumpEnergy = 0;
#13
cant unbind it.
I'm happy with the space bar for jumping, infact its what I want, but I have space as jump, right mouse as jump and alt fire at the same time.
I want to rebind mouse2(center mouse) to alt fire, and have mouse1(right mouse free of everything except what I want to bind to it,(which is iron sights).
07/09/2009 (2:33 pm)
no, just plain old jumping,cant unbind it.
I'm happy with the space bar for jumping, infact its what I want, but I have space as jump, right mouse as jump and alt fire at the same time.
I want to rebind mouse2(center mouse) to alt fire, and have mouse1(right mouse free of everything except what I want to bind to it,(which is iron sights).
#14
I've not been able to successfully bind the center mouse button to anything -- only the wheel z-axis.
07/09/2009 (3:51 pm)
The right mouse should not be bound to jump, only space in the default scripts (except for gamepads). If your player is setup with those jetting fields then that will interfere because of the conflict in the source, but you say you're not using the jetting functionality. Email or show me your default.bind.cs, evidently you've got something strange going on. Make sure you haven't inadvertantly added keybinds elsewhere.I've not been able to successfully bind the center mouse button to anything -- only the wheel z-axis.
#15
Thank you for the hint. I found the variable as $cursorControlled in ./core/scripts/client/cursor.cs
However, that triggered an unintended side effect. When I hit ESC I can't click the buttons in the dialog, or when I go to the WorldEditor I have a lot of problem expanding elements in a tree (I have to look for the upper left corner of the icon box) or selecting some toolbar buttons....do you know what might be triggering that behaviour?
07/09/2009 (4:02 pm)
James:Thank you for the hint. I found the variable as $cursorControlled in ./core/scripts/client/cursor.cs
However, that triggered an unintended side effect. When I hit ESC I can't click the buttons in the dialog, or when I go to the WorldEditor I have a lot of problem expanding elements in a tree (I have to look for the upper left corner of the icon box) or selecting some toolbar buttons....do you know what might be triggering that behaviour?
#17
I've looked through your binds and don't see anything that should be conflicting and causing you to jump.
All else I can think of is to do a search for $mvTriggerCount1 in your files and make sure that only the altTrigger is using it, and do a search in all files for $mvTriggerCount2 and make sure that only jump (space) is using it.
It's beginning to boggle my mind ;D
07/09/2009 (6:08 pm)
@deepscratchI've looked through your binds and don't see anything that should be conflicting and causing you to jump.
All else I can think of is to do a search for $mvTriggerCount1 in your files and make sure that only the altTrigger is using it, and do a search in all files for $mvTriggerCount2 and make sure that only jump (space) is using it.
It's beginning to boggle my mind ;D
Torque Owner JesseL
Pyrotronics-Games
function jump(%val) { $mvTriggerCount2++; } moveMap.bind( keyboard, space, jump );In the engine code it appears that there are some $mvTriggerCountX that are hard coded. Jump & Jet happen to be a couple of examples.