PDA

View Full Version : Script debug...


wildwolf
26-03-2004, 11:29 PM
AFAIK, this worked fine on a Control Manager 2.x version, but 3.0 doesn't like it:

// CMS Script File
//
// Â* Â* Game Title:
// Â* Â* Written By:
// Â* Â* Â* Â* Â* Date:
//
script

Â*Â*Â*Â*IF( NOT CMS.B2 ) THEN

Â*SELECT( JS1.A1, RANGE ) OF

Â* Â*CASE 0:
Â* Â* Â*CMS.B1 = TRUE;
Â* Â*Â*Â*Â*Â*BREAK;

Â* Â*CASE 64:
Â* Â* Â*CMS.B1 = FALSE;
Â* Â*Â*Â*Â*Â*BREAK;

Â* Â*CASE 192:
Â* Â* Â*CMS.B1 = TRUE;
Â* Â*Â*Â*Â*Â*BREAK;

Â*ENDSELECT

Â*Â*Â*Â*ENDIF

Â*Â*Â*Â*IF( NOT CMS.B1 ) THEN

Â*SELECT( JS1.A2, RANGE ) OF

Â* Â*CASE 0:
Â* Â* Â*CMS.B2 = TRUE;
Â* Â*Â*Â*Â*Â*BREAK;

Â* Â*CASE 64:
Â* Â* Â*CMS.B2 = FALSE;
Â* Â*Â*Â*Â*Â*BREAK;

Â* Â*CASE 192:
Â* Â* Â*CMS.B2 = TRUE;
Â* Â*Â*Â*Â*Â*BREAK;

Â*Â*Â*Â*Â*ENDSELECT

Â*Â*Â*Â*ENDIF

endScript


Errors encountered:
"There was an error compiling the CMScript"

If I look at the script in the CM Editor, and try to "Check Script", it tells me: "ERROR: Illegal Select Statement at Line 11".

which is this line: SELECT( JS1.A1, RANGE ) OF

MichaelCHProd
27-03-2004, 07:08 AM
The script works OK if you remove the IF/THEN statements. Let me look at this some more.

MichaelCHProd
27-03-2004, 07:09 AM
What are you trying to do exactly?

Bob Church
27-03-2004, 08:10 AM
The Select block within an If/Then is illegal, has always been as far as I recall. If it worked, it may have been an earlier bug, but I tried the script you posted under V2.20 and it won't compile there, either.

The If/Then leads to a rather problematic construct. If the conditional goes FALSE, the SELECT block simply gets skipped which can leave it "stuck". There are ways to do what you're doing, of course. I'd probably try to take the If/Then blocks out, let the SELECT blocks do their thing, and then use the bits from the conditionals to enable/disable the results rather than using them to enable the SELECTs themselves. Maybe something like:

SELECT( JS1.A1, RANGE ) OF

CASE 0:
CMS.B1 = NOT CMS.B2;
BREAK;

CASE 64:
CMS.B1 = FALSE;
BREAK;

CASE 192:
CMS.B1 = NOT CMS.B2;
BREAK;

ENDSELECT

Which I think gives which I think gives more-or-less what you're original script did, but like Michael says, "What are you trying to do exactly?".

- Bob

The StickWorks
http://www.stickworks.com

MichaelCHProd
27-03-2004, 08:21 AM
Go get'em Bob B)

wildwolf
28-03-2004, 07:39 PM
Well, I was under the impression from the place I got it from that it was a "walk-run" script.

IE) in games that were non-analog style (axis movement was either "on" or "off") the script was to allow a user to push the stick a little and "walk" or further and the "run" would be enabled instead.

However, seems that I must have grabbed an older trial script where the fellow was still working out bugs.

One of these days...I'll spend a few hours trying to learn how these scripts work so I can write my own and not bother other people for 'em. :(

Bob Church
29-03-2004, 12:36 AM
Okay. Well, I wouldn't think that's what that little scriptlet does. It looks like what the fellow was trying to do was to create a sort of D-Pad. As it is (assuming it would compile) is two buttons, CMS.B1 and CMS.B2, and he's trying to keep them from turning on at the same time. Assuming that part worked, he'd have CMS.B1 on whenever the X axis was at less then 25% or greater than 75%, e.g. the lowest 1/4th and the highest 1/4th of it's range. CMS.B2 would be doing the same thing for the Y axis. It's "sort of" what you describe, but it wouldn't really work even without the error. You'd have the same button full left or full right, the other one full forward or full back. No way to tell which direction it's actually going to go in and no dual speed at all.

What you describe isn't hard to implement, though. You'd need a total of 8 keys I'd think. Slow forward, fast forward, slow back, fast back, slow left, fast left, slow right, and fast right. Then you'd need to set up each axis with 5 steps rather than the 3 that the script has now. The middle would do nothing, then depending on direction you'd see it hit the slow key first, and if you moved it farther you'd see the fast key.

I can show you how to do it if you like. I need to know whether you really need to lock out one direction when you're going to the other, e.g. if you were to push the stick up into the upper left corner and the directions weren't interlocked, you'd have both the fast forward and fast left keys on. Would that matter or do you need to have it arranged so only one of the two is on? That looks like what he was trying to accomplish, but usually it doesn't matter. The diagonals are fine with the game and useful since you don't need to go left first, then stop, then go forward.

Let me know if you want to pursue it and we can work something out for it.

- Bob

The StickWorks
http://www.stickworks.com

wildwolf
31-03-2004, 12:43 AM
Hmm...no, that's ok, Bob.

However, if you could explain some (probably trivial) concepts to me, perhaps I can get started creating my own scripts more easily.

First, I have the CH Products Fighterstick USB version (love it, btw).

Now, if I hit the pinky button (JOY4), how can I script so that it sends a SPC (spacebar?) command to the application? (ie jump in a FPS game...that doesn't support joysticks).

I know that it's easy enough to just set it to non-dx mode and select the character to bind whatever I want...but my purpose is to learn how to send actual character data back through the CMS controls/script.

Thanks for any help.

Roger

Bob Church
02-04-2004, 12:47 AM
Well, it sounds like just a matter of putting the SPC on the button, that wouldn't really take any scripting. Start a new map, "Add" the FighterStick. Click the pinky button and it will jump you to the dialog for the button. Uncheck the DirectX box and you'll get the character programming dialog. Put "SPC" in the "Normal Press" box (no quotes around SPC) and download, it should send a space when you click it. Actually, it will hold the space down while you hold the button down. If you just want a single space, put "SPC NULL" in the box and it will just send one.

Is that what you wanted to know or am I missing something?

- Bob

The StickWorks
http://www.stickworks.com