PDA

View Full Version : Scripting error in CMS file



sobeach
18th October 2009, 04:50 PM
I have copied this simple script from something that Bob Church had posted and modified it to TAW.

script
timer ( PULSE, d1, 10 ) = js1.b2;
cms.b1 = d1 AND NOT js1.b2;
cms.b2 = js1.b2 AND NOT d1;
endScript

Now I get a script error. Perhaps I am not setting up the joystick button b2 correctly? In CMS, b1 is simply KB8 and b2 is F1.

thanks

Bob Church
18th October 2009, 09:00 PM
Hi sobeach,

Edit: Use "PERIOD" and not "PULSE". PULSE is a different device, not a timer type. Otherwise it looks fine to me. If you still have trouble, load it up in the editor and click the "Check" button at the top left of the toolbar. It should scan and stop at or just after the error, it might be some help.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com

sobeach
19th October 2009, 02:14 AM
Thanks. That seemed to work. By the way, I took the script from the following answer by you:

Hi Tincan,

Just use:

SHF F1 and not LSHF F1. LSHF is sent as a separate character which is why it gets released before the F1 is pressed when you watch it in the key tester. SHF will hold the left shift key down while the F1 is sent.

For the short/long click logic, you need to add the CMS Controls to the map. Click the "Add" button and pick them from the list of controllers, they're down at the very bottom. You'll get a tab for the CMS Controls and the editor button will be enabled.

Open the editor, it'll come up with an empty script, just "script" and "endScript" in it. Edit that to add the three lines between those two statements. You can just cut and paste from here, but be sure you don't end up with more than one "script" at the top and one "endScript" at the bottom. The script looks like this:

Code:
script
timer( PULSE, d1, 10 ) = js1.b5;
cms.b1 = d1 AND NOT js1.b5;
cms.b2 = js1.b5 AND NOT d1;
endScript
The script assumes that the FighterStick is on the first tab to the right of the one that says "Program Settings". You need to clear the programming from js1.b5 and program Button 1 on the CMS Controls tab to send the short-click command and Button 2 on the CMS Controls tab to send the long-click command. You can adjust the half-second with the "10" value in the timer statement if you want to have to hold it for more or less time.

Hope this helps!

Best regards,

- Bob

The StickWorks
http://www.stickworks.com (http://www.stickworks.com/)

http://www.ch-hangar.com/forum/styles/ch_hangar/statusicon/user_online.gif http://www.ch-hangar.com/forum/images/buttons/report.gif (http://www.ch-hangar.com/forum/report.php?p=40731) http://www.ch-hangar.com/forum/images/buttons/quote.gif (http://www.ch-hangar.com/forum/newreply.php?do=newreply&p=40731)Why is my example different?

Bob Church
19th October 2009, 08:48 AM
Hi sobeach,

No. It's just that I get them crossed up all the time.

Best regards,

- Bob

The StickWorks
http://www.stickworks.com