PDA

View Full Version : Repeating Keys?? Cant get it


Rawles
17-12-2004, 02:49 AM
I am trying to get my FOV Increase and Decrease to Keep Zooming in and out as i hold the key down.
I am trying to get repeating key strokes.
I tried the Script that Abe Beson did but it is not working..Hear is what i have.
I Have the FS,PT,PP in that order.
The Key commands are as follows.as in my CMC.File
(Increase_FOV)=Key_KBPGUP_b7on Pro Throttle
(Decrease_FOV)=Key_KBHOME_b5 on Pro Throttle
I also have combined the controllers to CM Device 1



// CMS Script File
//
// Game Title: Forgotten Battles_Pacific Fighters
// Written By: Louis"Tuxedo"Rawles
// Date: 12-14-2004
//
// Controller buttons used,
%define incFovIn js2.b7
%define decFovIn js2.b5

// CMS buttons used,
%define incFovOut cms.b7
%define decFovOut cms.b5
script
// Increase field of view
sequence
while(incFovIn);
incFovOut=true;
delay(2);
incFovOut=false;
delay(2);
endSequence
//decrease field of view
sequence
while(decFovIn);
decFovOut=true;
delay(2);
decFovOut=false;
delay(2);
endSequence
endScript

Hear is Abe Beson's Script


// Controller buttons used,
// change js1.b2 and js1.b3 to the buttons you want to use!!!
%define incFovIn js1.b2
%define decFovIn js1.b3

// CMS buttons used,
%define incFovOut cms.b1
%define decFovOut cms.b2
script
// Increase field of view
sequence
while(incFovIn);
incFovOut=true;
delay(2);
incFovOut=false;
delay(2);
endSequence
//decrease field of view
sequence
while(decFovIn);
decFovOut=true;
delay(2);
decFovOut=false;
delay(2);
endSequence
endScript


Just copy this script into the script editor, put your increase and decrease fov buttons into CMS button 1 and 2 respectively, modify the %defines for controller buttons in the script to what you like, and download the whole thing. The script is needed since IL2 only generates 1 keypress no matter how long you hold the increase and decrease buttons down.

Good luck!
/Abe

EDIT:
I forgot to tell you to remove the script/endscript that is in the script editor from scratch. Alternatively copy the %defines before those and the content inside the script endscript above to inside script endscript in your script.
/Abe

What ami i doing wrong?

abe_beson
17-12-2004, 01:50 PM
After taking a quick glance at your script everything seems right. I will need your entire map (the files: *.cmc, *.map and *.cms) for further analysis. Could you post it here?

/Abe

Rawles
17-12-2004, 11:35 PM
Hey Abe hear is my Profile i hope you can help

531_Ghost
17-12-2004, 11:52 PM
"Tuxedo"? :blink:

abe_beson
18-12-2004, 12:44 AM
Hi!
You have simply forgotten to assign the commands to buttons 5 and 7 on your cms controls tab. Use the "insert command" to insert "Increase_FOV" and "Decrease_FOV" on respective button.

/Abe

Rawles
18-12-2004, 01:07 AM
:yahoo: Abe You Are the Man!!!!!!
Thank you..!
And Ghost Check Your PM.

531_Ghost
04-01-2005, 04:51 AM
I'd like to do something similuar here only in Falcon 4. I'd like to use the POV hat on the ProThrottle for my antenna tilt up, down, center. I have it mapped that way now but it only gives single keystrokes. I see that a JS.B... needs to be assigned for the repeating keys. Is there a way to assign the POV UP, DOWN, RIGHT to do this repeating keys thingie? My MiniJoystick moves my radar cursor all over the place as I'd like it.

Bob Church
04-01-2005, 06:21 AM
Hi Ghost,

Yes. Just reference JSx.B25 (Hat Up) through JSx.B32 (Hat Up/Left), it runs around the hat clockwise from the Hat Up position as the button ID increases.

- Bob

The StickWorks
http://www.stickworks.com

531_Ghost
04-01-2005, 05:47 PM
Thanks Bob! So, as I understand what you've replied with, leave the POV in Direct X and the "buttons" are numbered starting at 12:00 25 going clockwise to 32. So with that tidbit of info this is what I came up with...

// CMS Script File
//
// Game Title: Falcon 4
// Written By: Ken "Ghost" King
// Date: 1/4/2005
//
script
CMS.B1 = [JS2.A1 < 55]; // TDC CURSOR LEFT
CMS.B2 = [JS2.A1 > 180]; // TDC CURSOR RIGHT
CMS.B3 = [JS2.A2 > 180]; // TDC CURSOR DOWN
CMS.B4 = [JS2.A2 < 55]; // TDC CURSOR UP
CMS.B5 = [JS3.A5 < 55]; // Tail Hook Up
CMS.B6 = [JS3.A5 > 180]; // Tail Hook Down

%define radarantup js2.b25
%define radarantdn js2.b29

// CMS buttons used,
%define radarantup cms.b7
%define radarantdn cms.b8
sequence
while(radarantup);
radarantdn=true;
delay(2);
radarantup=false;
delay(2);
endSequence
sequence
while(radarantdn);
radarantdn=true;
delay(2);
radarantup=false;
delay(2);
endSequence
endScript


Edit: And with that, I'm getting an ERROR [75 ] ENDSEQUENCE expected but "JS2 found" when I check the script. :blink:

abe_beson
04-01-2005, 07:11 PM
Hi Ghost!
Your script looks almost right, all you have to do is move all your #define statements before the script keyword. That is, move these 5 lines to the top of your script and it will probably work:

%define radarantup js2.b25
%define radarantdn js2.b29
// CMS buttons used,
%define radarantup cms.b7
%define radarantdn cms.b8

/Abe

Edit: typo

531_Ghost
04-01-2005, 08:11 PM
[attachmentid=497]
Thanks Abe, however, I'm gettin' the same error message when I check it.

This is what I changed it to:

script
%define radarantup js2.b25
%define radarantdn js2.b29
// CMS buttons used,
%define radarantup cms.b7
%define radarantdn cms.b8
CMS.B1 = [JS2.A1 < 55]; // TDC CURSOR LEFT
CMS.B2 = [JS2.A1 > 180]; // TDC CURSOR RIGHT
CMS.B3 = [JS2.A2 > 180]; // TDC CURSOR DOWN
CMS.B4 = [JS2.A2 < 55]; // TDC CURSOR UP
CMS.B5 = [JS3.A5 < 55]; // Tail Hook Up
CMS.B6 = [JS3.A5 > 180]; // Tail Hook Down
sequence
while(radarantup);
radarantdn=true;
delay(2);
radarantup=false;
delay(2);
endSequence
sequence
while(radarantdn);
radarantdn=true;
delay(2);
radarantup=false;
delay(2);
endSequence
endScript

There's gatta be sumpthin' dumb I'm not doin' :blink:

Bob Church
05-01-2005, 12:52 AM
Hi Ghost,

>> Thanks Bob! <<

Yer welcome!

>> So, as I understand what you've replied with, leave the POV in Direct X and the "buttons" are numbered starting at 12:00 25 going clockwise to 32... <<

Yes, except that the POV doesn't have to be in any particular mode. Those buttons work whether it's in DirectX mode, operating as a POV, or sending characters.

WRT the rest, it doesn't really matter whether the %defines are before or after the "SCRIPT" statement. They can even be mid-script. They just need to be defined before they're referenced, otherwise they can go most anywhere. You're problem is that you're using the same ones twice:

%define radarantup js2.b25
%define radarantdn js2.b29
%define radarantup cms.b7
%define radarantdn cms.b8

You need to find different names for the two of those, maybe:

%define RdrAntUpButton js2.b25
%define RdrAntDnButton js2.b29
%define RdrAntUpOutput cms.b7
%define RdrAntDnOutput cms.b8

I haven't actually tried it to see if that's all that's wrong, I don't see anything else offhand, but it's certainly not going to like the duplicate %defines.

- Bob

The StickWorks
http://www.stickworks.com

Bob Church
05-01-2005, 01:08 AM
Ghost,

A couple of other notes. When you see error messages about "XXX expected but YYY found", it means that the compiler ran into something that it couldn't understand, so it's telling you that, based on what came before the, it would have expected to see the other thing next. You might have done:

sequence
statement 1
statement 2
statement 3
endsequence

and if it didn't understand statement 1 it would say "EndSequence Expected", because it's got "Sequence", it ran into something that shouldn't be in a Sequence (the incomprehensible "statement 1", and so it whines that no EndSequence because that's all that it knows it should see. It just means the line that it's on isn't right, not that you have to have "EndSequence" there.

Also, another quick look at the script. You've got one of the defines saying:

radarantup = js2.b25

then later

radarantup = TRUE;

Even if you had different names, that wouldn't work since you cannot force a state on a real controller. You're trying to tell the joystick to push it's own button.

Finally, I don't know for sure, but both sequences are more or less identical. I think you probably want all radarantup references in one of them and radarantdn references in the other (renamed of course). As it is, if it worked radarantup and radarantdn would do the same thing.

- Bob

The StickWorks
http://www.stickworks.com

531_Ghost
05-01-2005, 01:20 AM
Well Bob, as usual your advice has cleared the way for thousands! Looks as tho this will do something, weather it's what I want :D remains to be seen in the game. Thanks Again!

:cheers:

531_Ghost
05-01-2005, 01:31 AM
Hmmmmm I'm still missin' sumpthin' it's not doing anything in the game :unsure:

Bob Church
05-01-2005, 02:14 AM
Ghost,

You probably mean "while( RdrAntUpInput)" and "while( RdrAntDnInput )". As it is, nothing much will happen.

- Bob

The StickWorks
http://www.stickworks.com

531_Ghost
05-01-2005, 04:54 AM
Nope Bob, it's still not gettin' it :blink: Oh well :wacko:

Bob Church
05-01-2005, 06:06 AM
Hi Ghost,

Well, I don't know what might be wrong. I put together a quick script with just the FighterStick and ProThrottle and essentially that script with the changes in the "while" statemtents and it seems to do just what it should. I don't know what you were doing with CMS.B7 and CMS.B8, I just tied them to CM Device 1 Buttons 17 and 18 and they do flash in the test screen. It's CM Device 1, though, not the one that actually represents the ProThrottle, so if you try it be sure to look there. Anyway, it's in the attached zip if you want to have a look.

I don't know if it's pertinent, but Falcon is like LOMAC, it wants delays between the SHF/ALT/CTL keys and the actual key. It's actually a little fussier I think, it seems to me that not only did the modal key have to go down first, it had to come up last. Maybe that has something to do with it?

Anyway, have a look at the map, maybe it will help sort it out.

- Bob

The StickWorks
http://www.stickworks.com

Bob Church
05-01-2005, 06:19 AM
Ghost,

One last note. Remember that Up and Down depend on the Rotate POV checkbox on the Program Settings tab. The map I sent has that cleared, so it's physically left and right that activate it. You can set the checkbox and it will move things around.

- Bob

The StickWorks
http://www.stickworks.com

531_Ghost
05-01-2005, 05:34 PM
Thanks again Bob, I think you may be right, it is probably a Falcon 4 oddity :( . As I assign those commands in the normal press mode via the .cmc they work albeit one step at a time. Looks as tho it's something I'll just have to live with. Thanks again Bob!

:cheers:

abe_beson
05-01-2005, 11:34 PM
You might want to try and increase the delay after releasing the button. It might be that the game does not register the button upp event right away. Try setting a silly long delay, like 20 or something just to see if it works.

/Abe

531_Ghost
08-01-2005, 05:21 PM
Trying that now Abe, Thanks! :cheers:

531_Ghost
08-01-2005, 05:29 PM
Tried and still nothing. :( I checked in Key Check, and there were no keys being pressed as well. Altho, all the other keys were recognized. Guess I'm destined to keep it simple here. Thanks all fer tryin' tho. :cheers:

abe_beson
08-01-2005, 07:06 PM
This is really weird. May I see your script with the silly delays?

/Abe

531_Ghost
08-01-2005, 08:41 PM
// CMS Script File
//
// Game Title: Falcon 4
// Written By: Ken "Ghost" King
// Date: 1/4/2005
//
script
%define RdrAntUpButton js2.b25
%define RdrAntDnButton js2.b29
%define RdrAntUpOutput cms.b7
%define RdrAntDnOutput cms.b8
CMS.B1 = [JS2.A1 < 55]; // TDC CURSOR LEFT
CMS.B2 = [JS2.A1 > 180]; // TDC CURSOR RIGHT
CMS.B3 = [JS2.A2 > 180]; // TDC CURSOR DOWN
CMS.B4 = [JS2.A2 < 55]; // TDC CURSOR UP
CMS.B5 = [JS3.A5 < 55]; // Tail Hook Up
CMS.B6 = [JS3.A5 > 180]; // Tail Hook Down
sequence
while(RdrAntUpButton);
RdrAntUpOutput=true;
delay(20);
RdrAntUpOutput=false;
delay(20);
endSequence
sequence
while(RdrAntDnButton);
RdrAntDnOutput=true;
delay(20);
RdrAntDnOutput=false;
delay(20);
endSequence
endScript

531_Ghost
20-12-2005, 11:04 PM
FIXED!

SEE HERE! (http://www.ch-hangar.com/forum/index.php?showtopic=2733&pid=17451&st=0&#entry17451)

:thumbsup: