PDA

View Full Version : Example 4 of manual error 239



sobe
15th February 2010, 03:14 AM
the following was copied from example 4 of the scripting examples with the only change that I made was to use button 5.

when the cms checker gets to this line:
yCmsValue = yStickValue + yTrimValue it stops and says error 239? what does that mean?

Here is the complete script:
// Named variables to hold the trim offsets
//
%DEFINE xTrimValue A1
%DEFINE yTrimValue A2
// Names for the actual joystick axes
//
%DEFINE xStickValue JS1.A1
%DEFINE yStickValue JS1.A2
// Friendly names for GUI axes that go to Windows
//
%DEFINE xCmsValue CMS.A1
%DEFINE yCmsValue CMS.A2
// Name a constant for the axis center value
//
%DEFINE centerStickValue 128
// Name a couple of bit functions.
//
%DEFINE trimButtonPressed JS1.B5
%DEFINE trimButtonReleased NOT JS1.B5
// The definitions are complete. Now we write the script.
//
SCRIPT
// This trims the joystick values and puts them in the CM Device
// Axes while the trim button is released. This is the normal run
// situation.
//
IF( trimButtonReleased ) THEN
xCmsValue = xStickValue + xTrimValue
yCmsValue = yStickValue + yTrimValue
ENDIF
// This waits for the trim button to be pressed, then records
// how far from stick center that the X and Y values are. Those
values
// are used as the trim correction that will be in effect when the
// trim button is released.
//
SEQUENCE
WAIT( trimButtonPressed );
xTrimValue = xStickValue - stickCenterValue;
yTrimValue = yStickValue - stickCenterValue;
ENDSEQUENCE

Bob Church
15th February 2010, 03:45 AM
Hi Sobe,

I'm not sure that the latest version supports defining quantities in terms of other defined quantities. It sort of in evolution at the moment to allow more flexibility in the way the #defines can be used. If that's the case, you can't say:

#define x1 10
#define x2 20
#define sum x1 = x2

It worked at one time, then got broken. I think it has been fixed but I'll have to check it when the CM is set up again.

You do need to move the "#define" statements down after the "script" statement though. Earlier versions would allow them above the script line, but the newer ones wont, I think it has to do with fixing the same problem.

Try moving the "script" statement so it looks like this. You also need an "endScript" statement:



script // <<- Put SCRIPT Here
// Here is the complete script:
// Named variables to hold the trim offsets
//
%DEFINE xTrimValue A1
%DEFINE yTrimValue A2
// Names for the actual joystick axes
//
%DEFINE xStickValue JS1.A1
%DEFINE yStickValue JS1.A2
// Friendly names for GUI axes that go to Windows
//
%DEFINE xCmsValue CMS.A1
%DEFINE yCmsValue CMS.A2
// Name a constant for the axis center value
//
%DEFINE centerStickValue 128
// Name a couple of bit functions.
//
%DEFINE trimButtonPressed JS1.B5
%DEFINE trimButtonReleased NOT JS1.B5
// The definitions are complete. Now we write the script.
//
// This trims the joystick values and puts them in the CM Device
// Axes while the trim button is released. This is the normal run
// situation.
//
IF( trimButtonReleased ) THEN
xCmsValue = xStickValue + xTrimValue
yCmsValue = yStickValue + yTrimValue
ENDIF
// This waits for the trim button to be pressed, then records
// how far from stick center that the X and Y values are. Those
// values are used as the trim correction that will be in effect when
// the trim button is released.
//
SEQUENCE
WAIT( trimButtonPressed );
xTrimValue = xStickValue - stickCenterValue;
yTrimValue = yStickValue - stickCenterValue;
ENDSEQUENCE
endScript

If that doesn't help, is there any text following the error 239 error message? When you use the red "Check" button in the editor and it runs into an error, it will place the cursor at the point where it figured out it was lost. Usually the error will be slightly before that, and if it follows a '#define" reference, the error itself could be back in the #define and not in the actual script. If you can't sort it out, post the entire error message and maybe I can spot the problem for you.

Anyway, first try moving the script and adding the endScript, see if it helps.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobe
15th February 2010, 04:20 PM
The script endscript is not an issue as this is just part of a larger script. I ran the checker and where the * is located is where the cursor stopped with the following code:
ERROR (239) error at "CMs"

yCm*sValue = yStickValue + yTrimValue

sobe
21st February 2010, 05:55 PM
Hello Bob
Any more thoughts on the above problem?

Bob Church
21st February 2010, 07:35 PM
Hi Sobe,

I answered this sort of, I don't know where the reply went. My only thought off-hand was whether or not it was a US keyboard? If not, what does the keytest utility show you when you hit the key on your keyboard?

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobe
22nd February 2010, 04:17 PM
It is a genuine IBM US keyboard.

Bob Church
22nd February 2010, 05:18 PM
Hi sobe,

Ah. Well, hard to argue with that. I use one that's nearly 20 years old, you can hear it three blocks away, but it came with a first-run AT and I don't think I could work with anything else. As to your question, I don't know what to tell you. I've never heard of such a thing (and I would have, trust me<g>). If you open the keytest utility, and type the key on the keyboard, does it show you the right press/release or are they wrong. Seems unlikely that it would have worked fine except in the CM. One very distinct possibility. Is the character contained in a macro (look at the thing in the CMC file if there is one specified on the Program Settings tab.. It's an easy thing to do, swapping "/" and "\" there, and you can't really see what's there looking at the map itself. Of there's a CMC file, click the CM Editor button, find the macro reference, and see if whoever wrote it made a type. A lot of time, guys put all the commands in, but then only use a some of the commands and it may just have gone unnoticed.

Let me know if you find anything and we'll see if we can sort it out.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobe
22nd February 2010, 08:27 PM
I am sort of lost on your response. I am using the cmc file that I have been using for awhile for IL2 with no problems in mapping. This problem occurred only when I have attempted to use your example 4 with my cmc file. I cannot get to the key test file because the cms error checker keeps telling me that there is an error that I describe above.

PS IBM always made the best keyboards. I know use lenovo's portables and they cheapened the keyboard.

Bob Church
22nd February 2010, 08:42 PM
Hi sobe

>> I am sort of lost on your response. I am using the cmc file that I have been using for awhile for IL2 with no problems in mapping. <<

Well, I haven't changed the character processing since about 2002, so we're kind of at an impasse. Were you referencing the particular macro in the earlier versions? Also, on closer inspection, are their semicolons at the end of the two lines in the map file, not the CMS. Easy to miss and it will break it every time. Finally, did you move the script statement above the %defines?

>> PS IBM always made the best keyboards. I know use lenovo's portables and they cheapened the keyboard. <<

Yup. Well, the 84-key with the F-keys on the the left. I never could deal with the 101s, they're just too off-center for lap work.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobe
25th February 2010, 03:44 AM
Bob

I entered some semi colons that were missing and got down to this line: xTrimValue = xStickValue - stickCenterValue; where the script checker now says "ERROR (204) Analog value expected but "stickCenterValue" found."
Now what?

Bob Church
25th February 2010, 04:43 AM
Hi Sobe,

Easy mistake to make. You defined "stickCenterValue" but referenced "centerStickValue". It didn't know what it was. It should turn to the "analog" color, sort of brown by default. It showed up black which means it's not really known. Anyway, this seems to compile:


script
// Here is the complete script:
// Named variables to hold the trim offsets
//
%DEFINE xTrimValue A1
%DEFINE yTrimValue A2
// Names for the actual joystick axes
//
%DEFINE xStickValue JS1.A1
%DEFINE yStickValue JS1.A2
// Friendly names for GUI axes that go to Windows
//
%DEFINE xCmsValue CMS.A1
%DEFINE yCmsValue CMS.A2
// Name a constant for the axis center value
//
%DEFINE centerStickValue 128
// Name a couple of bit functions.
//
%DEFINE trimButtonPressed JS1.B5
%DEFINE trimButtonReleased NOT JS1.B5
// The definitions are complete. Now we write the script.
//
// This trims the joystick values and puts them in the CM Device
// Axes while the trim button is released. This is the normal run
// situation.
//
IF( trimButtonReleased ) THEN
xCmsValue = xStickValue + xTrimValue;
yCmsValue = yStickValue + yTrimValue;
ENDIF
// This waits for the trim button to be pressed, then records
// how far from stick center that the X and Y values are. Those
// values are used as the trim correction that will be in effect when
// the trim button is released.
//
SEQUENCE
WAIT( trimButtonPressed );
xTrimValue = xStickValue - centerStickValue;
yTrimValue = yStickValue - centerStickValue;
ENDSEQUENCE
endScript

It's one of those things where "spelling counts", code is not forgiving. Sometimes you can spend days finding things like the semicolons, you look at it so long that you miss the error and it gets pretty frustrating. Anyway, give it a try and see if it works now.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobe
2nd March 2010, 07:02 PM
Bob
any further thoughts on the above?
Stanley

Bob Church
3rd March 2010, 05:44 AM
Hi Stanley,

>> any further thoughts on the above? <<

I need to know what happened when you changed the map, does it compile and download now? If so, what happens when you try to load it?

Best regards,

- Bob

The StickWorks
http://www.stickworks.com