Ding
10-01-2004, 06:15 AM
I'm just getting started with CMS and this script is giving me some considerable trouble. I was wondering if anyone here could assist me with it.
The game this script file is for has a communications interface which can be opened with C (assigned to CMS.B11 - fires on press and release). At this point, you are presented with several options which can be chosen using keys 1-9 (assigned to CMS.B1-B9 respectively). There is also a Back option accessible by pressing 0 (CMS.B10). I would like to be able to control this interface entirely from the HOTAS without actually dedicating 10 buttons to the comms. This script is meant to set up the pinky button on the Fighterstick (JS1.B4) as a shift - when it is activated, the comm interface is brought up. I would then be able to "select" the needed option using Hat2-up (JS1.B9) and Hat2-down (JS9.B11). Pressing Hat2-right (JS.B10) would activate the selected command, and Hat2-left (JS.B12) would activate the Back command (assigned to CMS.B10). While the pinky button is off, Hat2 returns to normal operation.
The code:
script
SEQUENCE
Â*Â*Â*Â*WAIT(JS1.B4 AND NOT B1);
Â*Â*Â*Â*B1=TRUE;//comms interface activated
Â*Â*Â*Â*
Â*Â*Â*Â*CMS.B11=TRUE;//open comms interface
Â*Â*Â*Â*
Â*Â*Â*Â*WAIT(JS1.B9 OR JS1.B10 OR JS1.B11 OR JS1.B12 OR JS1.B4 AND NOT B1);
Â*Â*Â*Â*
Â*Â*Â*Â*IF(NOT JS1.B9 AND NOT JS1.B10 AND NOT JS1.B11 AND NOT JS1.B12 AND JS1.B4 AND NOT B1) THEN
Â*B1=TRUE;//comms interface activated
Â*CMS.B11=TRUE;//open comms interface
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B12) THEN//back
Â*CMS.B10=FALSE;//send back command
Â*CMS.B10=TRUE;
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B9) THEN//decrement
Â*A1=A1-1;
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B11) THEN//increment
Â*IF([A1<4]) THEN
Â*Â*Â*Â*Â*A1=A1+1;
Â*ENDIF
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B10) THEN//commit
Â*CMS.B1=[A1==0];
Â*CMS.B2=[A1==1];
Â*CMS.B3=[A1==2];
Â*CMS.B4=[A1==3];
Â*CMS.B5=[A1==4];
Â*
Â*CMS.B11=FALSE;//close interface
Â*
Â*A1=0;
Â*B1=FALSE;//comms interface deactivated
Â*Â*Â*Â*ENDIF
ENDSEQUENCE
IF(NOT JS1.B4 AND B1) THEN//comms interface open, but shift is not held down
Â*Â*Â*Â*CMS.B11=FALSE;//close interface
Â*Â*Â*Â*
Â*Â*Â*Â*B1=FALSE;
ENDIF
IF(NOT JS1.B4) THEN//normal hat operation
Â*Â*Â*Â*A1=0;
Â*Â*Â*Â*CMS.B12=JS1.B9;
Â*Â*Â*Â*CMS.B13=JS1.B11;
Â*Â*Â*Â*CMS.B14=JS1.B10;
Â*Â*Â*Â*CMS.B15=JS1.B12;
Â*Â*Â*Â*CMS.B1=FALSE;
Â*Â*Â*Â*CMS.B2=FALSE;
Â*Â*Â*Â*CMS.B3=FALSE;
Â*Â*Â*Â*CMS.B4=FALSE;
Â*Â*Â*Â*CMS.B5=FALSE;
ENDIF
endScript
At the moment it's only implemented for the first five buttons, but extending it will be trivial once the script is fixed.
A1 keeps track of the currently selected option and B1 indicates whether the comm interface is currently open. Over the past several hours I have gone through a handful of revisions of this script, and this one seems to be the closest to working. The shift functionality works, as does the unshifted functionality of the hat, but the rest of it is having major problems which I can't figure out. Coming from a proper programming background, I'm lost without a debugger or at least the ability to include debug messages. :)
Perhaps my problem comes from misunderstanding the basic structure of CMS, and I'd love it if someone could enlighten me to the proper way of setting up this particular script.
Thanks.
The game this script file is for has a communications interface which can be opened with C (assigned to CMS.B11 - fires on press and release). At this point, you are presented with several options which can be chosen using keys 1-9 (assigned to CMS.B1-B9 respectively). There is also a Back option accessible by pressing 0 (CMS.B10). I would like to be able to control this interface entirely from the HOTAS without actually dedicating 10 buttons to the comms. This script is meant to set up the pinky button on the Fighterstick (JS1.B4) as a shift - when it is activated, the comm interface is brought up. I would then be able to "select" the needed option using Hat2-up (JS1.B9) and Hat2-down (JS9.B11). Pressing Hat2-right (JS.B10) would activate the selected command, and Hat2-left (JS.B12) would activate the Back command (assigned to CMS.B10). While the pinky button is off, Hat2 returns to normal operation.
The code:
script
SEQUENCE
Â*Â*Â*Â*WAIT(JS1.B4 AND NOT B1);
Â*Â*Â*Â*B1=TRUE;//comms interface activated
Â*Â*Â*Â*
Â*Â*Â*Â*CMS.B11=TRUE;//open comms interface
Â*Â*Â*Â*
Â*Â*Â*Â*WAIT(JS1.B9 OR JS1.B10 OR JS1.B11 OR JS1.B12 OR JS1.B4 AND NOT B1);
Â*Â*Â*Â*
Â*Â*Â*Â*IF(NOT JS1.B9 AND NOT JS1.B10 AND NOT JS1.B11 AND NOT JS1.B12 AND JS1.B4 AND NOT B1) THEN
Â*B1=TRUE;//comms interface activated
Â*CMS.B11=TRUE;//open comms interface
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B12) THEN//back
Â*CMS.B10=FALSE;//send back command
Â*CMS.B10=TRUE;
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B9) THEN//decrement
Â*A1=A1-1;
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B11) THEN//increment
Â*IF([A1<4]) THEN
Â*Â*Â*Â*Â*A1=A1+1;
Â*ENDIF
Â*Â*Â*Â*ENDIF
Â*Â*Â*Â*
Â*Â*Â*Â*IF(JS1.B10) THEN//commit
Â*CMS.B1=[A1==0];
Â*CMS.B2=[A1==1];
Â*CMS.B3=[A1==2];
Â*CMS.B4=[A1==3];
Â*CMS.B5=[A1==4];
Â*
Â*CMS.B11=FALSE;//close interface
Â*
Â*A1=0;
Â*B1=FALSE;//comms interface deactivated
Â*Â*Â*Â*ENDIF
ENDSEQUENCE
IF(NOT JS1.B4 AND B1) THEN//comms interface open, but shift is not held down
Â*Â*Â*Â*CMS.B11=FALSE;//close interface
Â*Â*Â*Â*
Â*Â*Â*Â*B1=FALSE;
ENDIF
IF(NOT JS1.B4) THEN//normal hat operation
Â*Â*Â*Â*A1=0;
Â*Â*Â*Â*CMS.B12=JS1.B9;
Â*Â*Â*Â*CMS.B13=JS1.B11;
Â*Â*Â*Â*CMS.B14=JS1.B10;
Â*Â*Â*Â*CMS.B15=JS1.B12;
Â*Â*Â*Â*CMS.B1=FALSE;
Â*Â*Â*Â*CMS.B2=FALSE;
Â*Â*Â*Â*CMS.B3=FALSE;
Â*Â*Â*Â*CMS.B4=FALSE;
Â*Â*Â*Â*CMS.B5=FALSE;
ENDIF
endScript
At the moment it's only implemented for the first five buttons, but extending it will be trivial once the script is fixed.
A1 keeps track of the currently selected option and B1 indicates whether the comm interface is currently open. Over the past several hours I have gone through a handful of revisions of this script, and this one seems to be the closest to working. The shift functionality works, as does the unshifted functionality of the hat, but the rest of it is having major problems which I can't figure out. Coming from a proper programming background, I'm lost without a debugger or at least the ability to include debug messages. :)
Perhaps my problem comes from misunderstanding the basic structure of CMS, and I'd love it if someone could enlighten me to the proper way of setting up this particular script.
Thanks.