View Full Version : POV in Battlefield 2
Ghost Rider
21-07-2005, 05:06 AM
Hi all I have a fighterstick USB and Throttle Pro.
In Battlefield 2 I want the POV on the joystick to be used as the check view around the cockpit when I fly the jets. The key is LCTL + mouse movement
Right now I have program the chase view (F9, F10,F11,F12)
But I also want to have the POV button to check all around the cockpit
How can I do this in Control Manager ? CMS scripting ? Well I know nothing about CMS scripting.
Can someone make a script for me (if necessary) and also give an explanation of the script lines so i can understand it.
Thanks a lot !
MichaelCHProd
21-07-2005, 05:36 PM
Have you had a look at the two maps that I implemented that in for Bf 1942 and BF V?
HERE.. http://www.ch-hangar.com/forum/index.php?showtopic=99
and
HERE.. http://www.ch-hangar.com/forum/index.php?showtopic=320
This is the script I used...
// Mouse look on the POV
IF( JS1.B25 OR JS1.B26 OR JS1.B27 OR JS1.B28 OR JS1.B29 OR JS1.B30 OR JS1.B31 OR JS1.B32 ) THEN
テつ* テつ*CMS.B1 = TRUE; テつ* テつ* テつ* テつ* テつ*//Turns on Mouse look
ELSE
テつ* テつ*CMS.B1 = FALSE; テつ* テつ* テつ* テつ* テつ*//Turns on Mouse look
ENDIF
// Mouse movement on the POV Hat
IF( NOT XRELATIVE ) THEN
テつ* テつ*cms.a1 = 128;
テつ* テつ*cms.a2 = 128;
テつ*IF( js1.b32 or js1.b25 or js1.b26 ) THEN テつ*ツ*ツ*ツ*ツ*
テつ* テつ* テつ*cms.a2 = 72;
テつ* テつ*ENDIF
テつ*IF( js1.b26 or js1.b27 or js1.b28 ) THEN
テつ* テつ* テつ*cms.a1 = 184;
テつ* テつ*ENDIF
テつ*IF( js1.b28 or js1.b29 or js1.b30 ) THEN
テつ* テつ* テつ*cms.a2 = 184;
テつ* テつ*ENDIF
テつ*IF( js1.b30 or js1.b31 or js1.b32 ) THEN テつ*
テつ* テつ*cms.a1 = 72;
テつ* テつ*ENDIF
ENDIF
CMS.A1 was set to be mouse as was CMS.A2.
CMS.B1 was set to send the Left Control key.
MichaelCHProd
21-07-2005, 05:37 PM
It will be in my BF 2 map when I post it.
Ghost Rider
22-07-2005, 09:32 AM
Originally posted by MichaelCHProd@Jul 21 2005, 04:37 PM
It will be in my BF 2 map when I post it.
<div align="right">14191
[/quote]
Yes I have tried the CMS scripting above and it don't work !
I'm doing something wrong and i'm sure it is something very easy i didn't understand.
Does CMS.B1 = mean to press the button 1 on the joystick ?
In control manager their is also a TAB with CMS Control. Do I need to configure things in there too ?
As far as the CMS scripting it is the same as here in the forum.
UPDATE:
So far when I used the POV on the joystick it act as the CTRL button but I cannot move the view but if I move my mouse it will work.
Now I just have to figure out how to make the POV use as mouse. But I setup the device as mouse for CMS.A1 and CMS.A2
Also for the POV do I let it as Directx or as POV ?
What else i need to do to make the POV move like a mouse ?
Thanks
Thanks for help !
Bob Church
22-07-2005, 05:40 PM
Hello Ghost Rider
>> Does CMS.B1 = mean to press the button 1 on the joystick ? <<
No. CMS.B1 is the first "Button" on the CMS Controls tab (B1). Setting CMS.B1 TRUE turns it ON, setting it FALSE turns it OFF. That in itself doesn't really do anything, but if you then program CMS.B1 to go the perhaps CM Device 1, Button 2 (the second button on the virtual device CM Device 1 which is seen by Direct X) then that button will track the TRUE/FALSE settings and can be seen by the sim. You can also set CMS.B1 to send characters in which case a TRUE setting will cause the button to be pressed and a FALSE will cause it to relese. Note that you have to explicitly set TRUE to turn it on and then FALSE to turn it off. If you just set it TRUE, it will stay on.
>> In control manager their is also a TAB with CMS Control. Do I need to configure things in there too ? <<
That is where you go to assign the function that CMS.B1 is going to perform. The CMS script only turns it on or off. What happens as a result of that depends on what you have programmed for B1 on the CMS Controls tab.
>> As far as the CMS scripting it is the same as here in the forum. <<
UPDATE:
>> So far when I used the POV on the joystick it act as the CTRL button but I cannot move the view but if I move my mouse it will work.<<
Michaels script will do that. The the mouse accepts values of 0 through 255 on it's X and on it's Y axes. A value of 128 causes it to stop. Values less than 128 cause it to move Left (X Axis) or Up (Y Axis). Values greater than 128 cause it to move right or down. The relevant part of Michaels script is this:
// Center the mouse so it's not moving
//
cms.a1 = 128;
cms.a2 = 128;
// If it's in the forward quadrant, send
// Y value of 72.
//
IF( js1.b32 or js1.b25 or js1.b26 ) THEN ツ*
ツ* ツ* cms.a2 = 72;
ENDIF
// If it's in right quadrant, send an X value
// of 184.
//
IF( js1.b26 or js1.b27 or js1.b28 ) THEN
ツ* ツ* cms.a1 = 184;
ENDIF
// If it's in the rear quadrant, send a Y value
// of 184.
//
IF( js1.b28 or js1.b29 or js1.b30 ) THEN
ツ* ツ* cms.a2 = 184;
ENDIF
// If it's in the left quadrant, send an X value
// of 72.
..
IF( js1.b30 or js1.b31 or js1.b32 ) THEN ツ*
ツ* cms.a1 = 72;
ENDIF
He's using the POV on the first controller, probably the joystick, and setting movement values of 72 and 184. First, he clears both the X and Y values to 128 (mouse not moving). Then he looks at the hat position. If the hat his in the forward quadrant, e.g. hat Up/Left, hat Up, or hat Up/Right, then js1.b32, js1.b25, or js1.b26 will be on. Those are the ids that the script references for those hat positions. When they're on, he's setting the Y value to 72 that goes to the mouse. That causes the mouse to move Up. Likewise for the other three quadrants, one each to move the mouse Down, Left, or Right.
Once it's generating those values then, again on the CMS Controls tab, you need to assign the CMS.A1 and CMS.A2 axes to Mouse X and Mouse Y so that the values will get fed to the Direct X mouse and cause it to move.
>> Now I just have to figure out how to make the POV use as mouse. But I setup the device as mouse for CMS.A1 and CMS.A2 <<
That's correct.
>> Also for the POV do I let it as Directx or as POV ? <<
No, you just want the mouse to move, I think. You wouldn't use POV anyway since there's no way to shut that off. You could use characters if you only wanted the mouse move in particular modes, but POV would probably interfere with what you're trying to do.
>> What else i need to do to make the POV move like a mouse ? <<
Just make the CMS.A1 and CMS.A2 assignments to Mouse X and Mouse Y on the CMS Controls tab, then set the script up to send values as Michael is doing. The further from 128 the values are, the faster the mouse will move.
Hope this helps!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
10-10-2005, 09:25 PM
In BF2 I use the PT mouse control for movement instead of the A,D,S,W keys or the ackward mouse. I don't belive this script can be implemented and still use the PT mouse controller for movement. Is that a correct assumption?
Bob Church
11-10-2005, 02:14 AM
Hi TheRealOmegaMan,
I'm not sure how you want to mix them, but you should be able to. There'd need to be some way to differentiate whether you wanted it to track the PT ministick (I think that's what you mean by "mouse") or the POV switch. The most likely thing would be to check if the PT ministick were off center, maybe values less than 120 or greater than 136, something like that. If it were off center, then you'd want to pick up the ministick values and put them into the registers that control the mouse velocity in the above script. If the PT mouse were centered, you'd ignore it and just use the POV switch to control the values.
Is that what you were asking?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
11-10-2005, 01:33 PM
Hey Bob, Thanks for the response.
Your on target here with what I am doing. Sorry for the "mouse" reference, not the best choice. As I stated, I use the PT Mini Stick to control movement. This instead of the A,S,D,W keys. This movement is 'default" DX Mode as the game defaults to the mouse causing movement. I would love to also to use the Mini Stick to act as the mouse "look" while in aircraft. My point is, I do not believe I can have both right? That would mean using a GUI, cms or cmc command for the Mini Stick and NOT using the DX Mode default mode. You guys are great with work arounds and I can't believe after all these years I finally find this forum, but if you can come up with something better here I would be very grateful. Keep in mind, if worse comes to worse, I can program a button on the PT or Combat Stick as the "Ctl" key and hold that down while using the Mini Stick or mouse as the MOUSE LOOK. Even better would be a cmc or cms script which will keep the button TRUE until I click again making it FALSE. Any thoughts?
Thanks!
Bob Church
11-10-2005, 02:20 PM
Hi TheRealOmegaMan,
>> Your on target here with what I am doing. Sorry for the "mouse" reference, not the best choice. As I stated, I use the PT Mini Stick to control movement. This instead of the A,S,D,W keys. This movement is 'default" DX Mode as the game defaults to the mouse causing movement. I would love to also to use the Mini Stick to act as the mouse "look" while in aircraft. My point is, I do not believe I can have both right? <<
You couldn't program the ministick axis directly to be both, but you could bring it out to two sets of axes with a CMS script easily enough. The only thing you'd need would be some way for the Map to know which way it should be working - modes, shift, axis position, something that would tell the script "do the mouse" or "do the view". If you can figure that out then it's easy enough. Assume there's a bit called "mouse_mode" that's TRUE if you're using it as a mouse and FALSE if it's being used as a view (generating the mouse_mode bit is the part that you'd need to sort out). Once that's available (assuming the throttle is js2), then:
script
if( mouse_mode ) then
cms.a1 = js2.a1;
cms.a2 = js2.a2;
cms.a3 = 128;
cms.a4 = 128;
else
cms.a1 = 128;
cms.a2 = 128;
cms.a3 = js2.a1;
cms.a4 = js2.a2;
endIf
endScript
You'd program cms.a1 and cms.a2 to move the mouse, presumable just assigning them wherever the the ministick goes now. The cms.a3 and cms.a4 axes would set the view. You'd have one set of axes for the mouse and another for the view, the unused set would be centered when the other set was in use. Can you generate the mouse_mode bit somehow?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
11-10-2005, 02:36 PM
Can you generate the mouse_mode bit somehow?
http://www.stickworks.com
[/b]
Now here is where I get lost. How would I switch the mode in the game from Mouse View to movement? Bob, I think the easy way out is CTL key. What I would need to do is place a HOLD on the key while using the the Mouse View. When finnished click again. Could I do that with CMC? Is this correct - "HOLD LCTL" would this command work in my BF2 CMC file?
Thanks for all the help.
Nick
AKA..TheRealOmegaMan
TheRealOmegaMan
11-10-2005, 09:33 PM
Got another question for ya Bob and all others. Always start with simplicity I always say..
I want to crouch/kneel every time I fire my weapon. Assuming the FIRE button on the Combat Stick is JS1.B1 and the kneel/prone button is JS1.B2will this script work? I think I am close here but I am missing JS1.B2 and don't know whre to add it. Do I need to use a virtual button (CMS."")? Can you say I am lost here??? :huh:
//Fire and Kneel at same time
IF( JS1.B1 ) Then ;
CMS.B1 = True;
Else;
CMS.B1 = False;
ENDIF
Bob Church
13-10-2005, 01:47 PM
Hi Nick,
>> Now here is where I get lost. How would I switch the mode in the game from Mouse View to movement? Bob, I think the easy way out is CTL key. What I would need to do is place a HOLD on the key while using the the Mouse View. When finnished click again. Could I do that with CMC? Is this correct - "HOLD LCTL" would this command work in my BF2 CMC file? <<
Sure, you could do that. If you just wanted to hold a button in while you did it, just program it up in the GUI to send LCTL, you wouldn't need the HOLD on it for a single key like that. If you want Click On/Click you would need to go to script and set up a toggle, something like:
script
toggle( d1 ) = js1.b4;
cms.b1 = d1;
endScript
I used js1.b4, but specify whatever button you want to use. Then program button 1 on the CMS Controls tab to send the LCTL. The only problem might be you'd end up with the CTL tagged on to everything so you'd need to remember to switch it back when you were done or all the key commands would have the CTL command tacked on to them.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Hi Nick,
>> Got another question for ya Bob and all others. Always start with simplicity I always say..
I want to crouch/kneel every time I fire my weapon. Assuming the FIRE button on the Combat Stick is JS1.B1 and the kneel/prone button is JS1.B2will this script work? I think I am close here but I am missing JS1.B2 and don't know whre to add it. Do I need to use a virtual button (CMS."")? Can you say I am lost here?? <<
Yeah, that's basically right if you just need a second button. You can simplify it by just writing:
script
cms.b1 = js1.b1
endScript
Then cms.b1 will just track js1.b1 and you can program it up in the GUI to send whatever character or button that you need it to send.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
13-10-2005, 02:25 PM
Bob,
Thanks for the info. Still, more questions. Can you tell where I can find variable names? You use "toggle" and I had no idea about that or others for that matter. Any doc or sheet with those listed would be a Godsend. Lastly, what is "(d1)" in your script? I am trying to understand what that refers to.
Question once more, I can set a CMS control button to do any action and have any button on the controller point to do that action right? Eg. -> JS1.B14 = CMS.B1 and I have CMS.B1 set to LCTL OR in this case
IF( JS1.B1 ) Then ;
CMS.B1 = True;
In this example I would have CMS.B1 set to LCTL. Is this making sense??? I hope so. Remember, learning how to walk here Bob :blush:
Thanks for all.
Nick
AKA..
TheRealOmegaMan
13-10-2005, 02:58 PM
Bob,
Solved the D1 delima. Left mouse button right? If so, do I need that?
AND,
How bout this then? Assume CMS.B1 is LCTL in CMS Controls GUI. If I click the js1.b4, then the Mouse Look should become active and I can use the mini stick (Direct Mode) to move my view. Then click js2.b4 again to turn it off right?
script
toggle( js1.b4 );
cms.b1 = js1.b4;
endScript
Bob, maybe you should open a phone support line :P
Bob Church
13-10-2005, 03:01 PM
Hi Nick,
>> Thanks for the info. Still, more questions. Can you tell where I can find variable names? You use "toggle" and I had no idea about that or others for that matter. Any doc or sheet with those listed would be a Godsend. Lastly, what is "(d1)" in your script? I am trying to understand what that refers to. <<
D1 (through D256) are just the output bits for the logical devices (timers, the PULSE and TOGGLE things). Look in CMS Programming Guide section of the Users Guide, find the section on Logical Devices. The line:
toggle( d1 ) = js1.b1;
will just cause bit D1 to change state each time js1.b1 is clicked. Then you transfer that to a CMS button with:
cms.b1 = d1;
and you can do anything up in the GUI with CMS Button 1 that you like. The difference between it and just copying the button is that one click will stick the LCTL down, the next click will release it. Anyway, it doesn't really have anything to do with the mouse per se, though you could connect cms.b1 to Mouse Button 1 up in the GUI if that would be of any help.
>> Question once more, I can set a CMS control button to do any action and have any button on the controller point to do that action right? Eg. -> JS1.B14 = CMS.B1 and I have CMS.B1 set to LCTL OR in this case
IF( JS1.B1 ) Then ;
CMS.B1 = True;
In this example I would have CMS.B1 set to LCTL. Is this making sense??? I hope so. Remember, learning how to walk here <<
It makes sense, but as I mentioned it's just easier to copy the bit:
cms.b1 = js1.b1;
Then the one will follow the other. If you really want to use the IF/THEN block, then you need to put an ELSE on it and turn it off if js1.b1 isn't pressed, otherwise cms.b1 just turns on the first time you click the button and stays on forever. It won't turn off just because the IF isn't satisfied. You need to explicitly clear it.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
13-10-2005, 04:29 PM
http://www.stickworks.com[/url]
[/b]
Yes, the ELSE is a must. Didn't include that in my example for sake or writing...lazy.
I now understand some now...many thanks. I did look at the logical devices and that has the listing I'm looking for.
Thanks for the script. Certainly will try that out. You've been a big help her Mr. Bob and that is much appreciated.
Nick
TheRealOmegaMan
17-10-2005, 07:18 PM
Hey Bob,
Just to let you know the script works great and many thanks. Now I have another quest. Is there a way to set the Pro Throttle to 50% regardless of what position the actual throttle is resting? Hopefully, this can be a toggle set to a button or hat which activates this. Clicking again would return the throttle to it's original state. I will use this for hovering which requires 50% throttle in the choppers in BF2. Ideas?
Many thanks!
Nick
AKA..
Bob Church
18-10-2005, 01:38 PM
Hi Nick,
>> Just to let you know the script works great and many thanks. <<
Great! I'm glad it's all working for you!
>> Now I have another quest. Is there a way to set the Pro Throttle to 50% regardless of what position the actual throttle is resting? Hopefully, this can be a toggle set to a button or hat which activates this. Clicking again would return the throttle to it's original state. I will use this for hovering which requires 50% throttle in the choppers in BF2. Ideas? <<
Sure. Dead center on any axis when you reference it in a script si 128, so you basically just need to switch the throttle from the Z axis on the Pro Throttle to a constant 128. Something like:
script
// If some bit is TRUE, select the constant. Otherwise select the throttle
// axis. Assuming JS2 is the PT and you want to use button 2 on that. When
// button 2 is pressed, it centers, when released it just tracks the throttle
// handle. It will "jump" to the handle position when the button is released.
//
if( js2.b2 ) then
cms.a1 = 128;
else
cms.a1 = js2.a3
endIf
endScript
You'd need to unassign the Pro Throttle slider up in the GUI, and then assign CMS.A1 to wherever it had been going on the CM Device, but otherwise it's straightforward. All you need to do is to get something that does what you want ot replace JS2.B2 in the above script, could be a TOGGLE or a hat button or whatever you wanted to use.
Another thing that works depending on the situation is to tag the Pro Throttle slider as a "Centered" axis up in the GUI and then set a wide deadzone on it. The will give you a wide center zone that always puts out 128, then outside of that zone it will go to 255 fully back and 0 fully forward. Used to be a handy trick with games that had throttles that reversed when you pulled back, went forward when they were forward of center since it made the "stop" position fairly easy to find.
Is that what you were looking for?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
TheRealOmegaMan
18-10-2005, 02:04 PM
Is that what you were looking for?[/b]
Hello Bob! And yes, absolutely this is what I am looking for. Would you believe I was on the same lines but made it MUCH more complex than necessary. These scripts from you I reference so hopefully I won't have to nag you constantly.
But as always your help is well appreciated!
Thanks again Bob,
Nick
AKA...
TheRealOmegaMan
18-10-2005, 02:57 PM
cms.a1 = js2.a3[/b]
Bob,
Sorry, quick answer needed. Can you explain this line? What is js2.a3?
DonULFonso
18-10-2005, 09:52 PM
"Assuming JS2 is the PT" (as Bob assumed, see the comments in his script), then all buttons and axes on this device (JS2 means joystick 2) are referenced as "JS2.Bn" (n being the number of the button) respectively "JS2.An" (n being the number of the axis). IIRC the microstick's axes are the axes (JS2.A)1 and (JS2.A)2, so I take (JS2.A)3 must be the throttle itself.
The line "cms.a1 = js2.a3" simply means that this 'physical' axis (JS2.A)3 (the throttle on the PT) is assigned to the 'logical' axis (CMS.A)1 (you'll find this on the "CMS Controls"-tab if you have scripting enabled; if not, just add it by simply clicking on the "add"-button and selecting the last item, "CMS Controls"). You need to clear the 'physical' axis (JS2.A)3 of any assigned output and assign the desired output to the 'logical' axis (CMS.A)1 instead since you'll be using this one to control the other one via the script (the main difference between using the GUI's controller-tabs and the CMS-tab plus scripting is that the controller-tabs only allow static assignments: every time you press a button, the assinged output is generated, while a script allows you to freely and flexibly specify custom conditions that must be matched for an assigned output to get sent). Bob explained it all in his post, just re-read it.
TheRealOmegaMan
18-10-2005, 10:12 PM
Thanks DonUlFonso, I appreciate the clarity. I did understand the use of the CMS controls from the help and much help from Bob. After looking closely and by your explanation, I had a light come on with the Js2.A1. I never used the Axis buttons and just didn't think about them. I also forgot to use my brain and realize that js2.a3 was the PT axis. Again, never programmed that. Always left that one in Direct mode. Thanks to all. I am up to speed.
chaos49
01-02-2006, 01:08 PM
hi all.
Iam new to progarm the ch stuff. and would be glad if some will share a map for bf2. with all the nice things in this tread.
I have just get a fighterstick with throttle and pedals.
thanks for the help.
TheRealOmegaMan
03-02-2006, 03:58 PM
Iam new to progarm the ch stuff. and would be glad if some will share a map for bf2. with all the nice things in this tread.
[/b]
Chaos,
You would most likely be better off with a "Command" file for BF2. This makes assigning actions to keys a breeze. Basically, this is a .txt file that can be pointed to by the Control Manager (this is done in Program Settings->Command File). The notepad file consists of a command name with a comma delimited keyboard key name, eg. "FIRE tab_tab ENTER". This simple example is a command to fire using the ENTER key. I believe Bob Church can point you to where to get this. Somewhere in this forum he directed me, so I suggest doing a forum search. Once you plop it in the Control Manager directory and point to it, you basically left click in the Action feilds and select "Command" and this will open the .txt file you pointed to and where you can see the name of a command and select it to perform that action. Easy stuff!
If Bob can't direct you I'll try to remember tonight to attach it to this thread.
Hope that helps!
chaos49
04-02-2006, 09:57 AM
thanks for the anweser, iテつエll look for a command file then. and try to progarm my gear to my needs :)
TheRealOmegaMan
06-02-2006, 02:26 PM
Chaos,
I got a major allergy attack this weekend which kept me away from the PC. If you having trouble finding the key assignment file let me know and I will attach it.
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.