PDA

View Full Version : I want to learn how to make scripts



Locust_
22nd June 2004, 10:44 PM
:w00t:

Locust_
22nd June 2004, 11:04 PM
Jeez Im reading the scripting information within CM3 help files & its very confusing

How hard can it be? I simply want this button on my throttle to DropBomb, pop the airbrake for 2 seconds then raise the airbrake......

I can do it manualy but would be aswome to have it scripted

Helppppppppppp:wacko:

MichaelCHProd
22nd June 2004, 11:24 PM
Tell me the key commands for that sequence.

Locust_
22nd June 2004, 11:57 PM
Hat 1 down [B5] ..................(drops bomb)

Hat 3 down [B14] ............... Extends Airbrake

Hat 3 down [B14] ................. Retracts Airbrake


Hi Sir I want the airbrake to deploy about a tenth of a second after the bomb is released then I want the airbrake to stay down for 1.8 seconds & then retract

so if I was doing it manualy heres what I do

Press B5 on pro throttle (drops bomb) press B14 on pro throttle deployes airbrake
count 2 in my head & press B14 to retract airbrake

I added the cms blue thing with all thoes buttons & axes's to my map also my stick is 1 & throttle is 2

MichaelCHProd
23rd June 2004, 12:16 AM
Sorry, I want to know what keys on your keyboard that the game assigns to those functions by default.

JNOV
23rd June 2004, 04:27 AM
Locust:

You can do what you want very simply with a script. Try something like this (You don't need to use the "defines." I just put them in hopes of making it easier to follow.):

///////////////////////////////////////////////////////////////////////////////////////////
// instead of js1.bx, use whatever button you want to begin the sequence
// E.g., to use the side, forefinger button on your stick, replace "js1.bx" with
// "js1.b3"
%define BeginButton js1.bx
%define DropBomb cms.b100
%define ExtendAirBrake cms.b101
%define RetractAirBrake cms.b102
%define BrakeOpenDelay 20 // Play with this until the air brake open delay is correct

sequence

wait(BeginButton);
DropBomb = TRUE;
delay(3);
ExtendAirBrake = TRUE;
DropBomb = FALSE;
delay(3);
ExtendAirBrake = FALSE;
delay(BrakeOpenDelay);
RetractAirBrake = TRUE;
delay(3);
RetractAirBrake = FALSE;

endsequence

///////////////////////////////////////////////////////////////////////////////////////////

In the GUI, assign cms.b100 to the drop bomb key of DirectX button, cms.b101 to the extend air brake key or DirectX button, and cms.b102 to the retract air brake key or DirectX button. For example, if your sim expects spacebar to drop bombs, "b" to extend air brake, and "r" to retract air brake, you'd go to the GUI, select cms.b100 and enter "SPC" in the Normal Action>Press edit field (you can leave the other three blank). Leave off the quotation marks. You'd then fill in the Normal Action>Press edit fields for cms.b101 and cms.b102 with "b" and "r", respectively (again, without the quotation marks). If your sim expects DirectX buttons to activate any of the commands, check the DirectX box in the appropriate GUI entry (i.e., cms.b100, cms.b101, or cms.b102), and select the appropriate DirectX button from the drop-down box.

I hope this helps.

- JNOV

Locust_
23rd June 2004, 07:30 PM
Originally posted by MichaelCHProd@Jun 22 2004, 11:16 PM
Sorry, I want to know what keys on your keyboard that the game assigns to those functions by default.
So you want to know what keystroke by default drops bombs, deployes airbrake ???

That I canot tell you as I have remaped thoes keys, I can tell you what they are currentaly mapped to but its not default ok........


"ALT SPC" (drops bombs)

"s" (retracts & extends the airbrake)

I could save my ingame profile & reset all ingame controlls to default & then tell you what the default settings are for bombs & airbrake but I dont see how that could help anything. Infact it would cause many problems untill I droped my "ingame profile " back into the Forgotten Battles Users folder...

Ive been remaping these keys since IL2 Sturmovik was released & theres no way in heck I could use the default key settings cause Ive changed many things about the default keybord layout some is the same but alot is differant I know it makes it harder to program kinda but I use the KB alot & have it memorized the way it is.

Locust_
23rd June 2004, 07:40 PM
Originally posted by JNOV@Jun 23 2004, 03:27 AM
Locust:

You can do what you want very simply with a script. Try something like this (You don't need to use the "defines." I just put them in hopes of making it easier to follow.):

///////////////////////////////////////////////////////////////////////////////////////////
// instead of js1.bx, use whatever button you want to begin the sequence
// E.g., to use the side, forefinger button on your stick, replace "js1.bx" with
// "js1.b3"
%define BeginButton js1.bx
%define DropBomb cms.b100
%define ExtendAirBrake cms.b101
%define RetractAirBrake cms.b102
%define BrakeOpenDelay 20 // Play with this until the air brake open delay is correct

sequence

wait(BeginButton);
DropBomb = TRUE;
delay(3);
ExtendAirBrake = TRUE;
DropBomb = FALSE;
delay(3);
ExtendAirBrake = FALSE;
delay(BrakeOpenDelay);
RetractAirBrake = TRUE;
delay(3);
RetractAirBrake = FALSE;

endsequence

///////////////////////////////////////////////////////////////////////////////////////////

In the GUI, assign cms.b100 to the drop bomb key of DirectX button, cms.b101 to the extend air brake key or DirectX button, and cms.b102 to the retract air brake key or DirectX button. For example, if your sim expects spacebar to drop bombs, "b" to extend air brake, and "r" to retract air brake, you'd go to the GUI, select cms.b100 and enter "SPC" in the Normal Action>Press edit field (you can leave the other three blank). Leave off the quotation marks. You'd then fill in the Normal Action>Press edit fields for cms.b101 and cms.b102 with "b" and "r", respectively (again, without the quotation marks). If your sim expects DirectX buttons to activate any of the commands, check the DirectX box in the appropriate GUI entry (i.e., cms.b100, cms.b101, or cms.b102), and select the appropriate DirectX button from the drop-down box.

I hope this helps.

- JNOV
JNOV


Do you have ICQ ?
Do you have Ventrillo ?


I learn very fast

I could use some help via voice comms Im starting to understand but Im still a dork, Im not a pc noob tho. :)

JNOV
23rd June 2004, 07:59 PM
Locust:

I don't have either ICQ or Ventrillo, but given your response to Michael, we should be able to flesh out a script/map pretty easily.

If you send me your current map (you can put all the files in a zip file and attach them to a reply, if you want to), I'll add the functionality I've outlined above to it. You can look and see what I've done and, if you've got any questions, we can discuss them.

(By the way, there' s no need to remap your keys to the default configuration. Michael just wanted to know how you had them configured.)

- JNOV

Locust_
23rd June 2004, 08:08 PM
Ok gona attach it here

Id still love to speak to someone via voicecomms about scripting :(

JNOV
23rd June 2004, 08:16 PM
You should be able to attach it to a forum post. There is a file attachments box at the bottom. If that doesn't work, you can send it to me at kb_jnov@hotmail.com.

Thanks - JNOV

Locust_
23rd June 2004, 08:30 PM
Ok there attached in above post.....

Sorry didnt see the attach file option before thankyou.......

MichaelCHProd
24th June 2004, 12:51 AM
JNOV I bow before your programming skill :)

and with that I am history..... poof :bye:

JNOV
24th June 2004, 02:29 AM
Thanks, Michael -- LOL. I'm just a rank novice. BC's the master!

Locust:

I've attached the file. I added the code that I typed above in the post, exactly as I typed it, except that I changed js1.bx to js2.b1, because the only free button in your map was Button #1 on your throttle (i.e., the ministick "button"). I also changed the BrakeOpenDelay from 20 to 30, because that seemed to give a delay of close to two seconds. You can test it out and change that value as you see fit in order to fine tune it.

I'll make a couple of suggestions, if I may, regarding your map:

1. You should probably consider using a Shift key. If you check the "Shift" box in a button's GUI (people usually choose either the pinkie button on the stick or the pinkie button on the throttle), you can use the "shift" fields for the remainder of the buttons in the map, effectively doubling the number of inputs you have.

2. I'm not sure what your viewing scheme is, but it seems inordinately complicated. It's as if you're using a view mode where each click of one key moves the view one "notch" in a particular direction. That seems odd to me, but perhaps it works for you.

What I did in IL-2 before I had Track-IR (and what I do in Aces High now) was to simply use the 8-way hat for directional views (by mapping the directions to the 8 perimeter keypad number keys). To generate the "up" view, I assigned KP5 to one of the single buttons on the throttle. This allows you to move through the level views using the stick 8-way hat and generate the 45-degree up view by depressing the assigned throttle key simultaneously. If you press the throttle key by itself, you get the lift-vector (i.e., straight-up) view.

I hope this helps.

Best regards,

JNOV

Locust_
24th June 2004, 02:49 AM
Hey On the throttle... I need HAT 1 DOWN [B5] to (drops bombs)
wich is "ALT SPC" Programed within the Game itself & in my current CH map, Do I need to change it also ?

Can I just change js2.b1 to js2.b5 ? in the script ?


Please not that mouse button Sir


I use F9 when needed for snap views & the rest is toggle view works great, would love to have TIR2 tho :) one day & iliminate all that... The shift idea is good tho thx

Gona go try this :w00t:

JNOV
24th June 2004, 03:47 AM
[double post deleted]

JNOV
24th June 2004, 03:50 AM
I hate the mouse button, too, but it's the only one I could find. If you'd prefer another, you can change it easily enough. Just change "js2.b1" in the script to whichever button you'd like to use. "js2" is the throttle, because it's the second device in your map (i.e., second tab from the left); "js1" is the stick, because it's the first device in your map. You can find out what the button numbers are by pressing them and seeing how they show up in the GUI. So, for example, if you wanted to change it to the side, forefinger button on the stick, you'd change "js2.b1" to "js1.b3."

>>> Oh, sorry, I didn't read your post carefully enough. Yes, if you'd rather use button 5 on the throttle, just change "js2.b1" to "js2.b5". And, no, there is no need to change ALT SPC, because that's the command I programmed the script to send. You can see the three commands are defined to key presses in the *.cmc file. The ExtendAirbrake and RetractAirbrake commands are the same. I know that IL-2 gives the option to assign some functions to either toggle or on/off. If the airbrake is one of those, you might consider assigning one key to extending it and another to retracting it to avoid getting out of sync.

Good luck!

- JNOV

Locust_
24th June 2004, 04:25 AM
Sad to say the Airbrake is a one keystroke command (dosent have X=extend X=retract)

Heres the Final script , I removed ALT SPC from B5 on the throttle & made that the
begin button for the script

Then added "ALT SPC" to cms.b100 = dropbomb
added "s" to cms.b101 = extendairbrake
added "s" to cms.b102 = retractairbrake

Changed the BrakeOpenDelay to 45 Works great 30 was lil short

Thx for all your help, Im starting to understand this a lil going to have to read more in the help files

One thing I was wondering, the time between the release of the bomb & the initial extension of the airbrakes is too long, altho its fast, it still seams a lil long can I shorten that somehow ?


THX AGAIN !!!

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

///////////////////////////////////////////////////////////////////////////////////////////
// instead of js1.bx, use whatever button you want to begin the sequence
// E.g., to use the side, forefinger button on your stick, replace "js1.bx" with
// "js1.b3"
%define BeginButton js2.b5
%define DropBomb cms.b100
%define ExtendAirBrake cms.b101
%define RetractAirBrake cms.b102
%define BrakeOpenDelay 45 // Play with this until the air brake open delay is correct

sequence

wait(BeginButton);
DropBomb = TRUE;
delay(3);
ExtendAirBrake = TRUE;
DropBomb = FALSE;
delay(3);
ExtendAirBrake = FALSE;
delay(BrakeOpenDelay);
RetractAirBrake = TRUE;
delay(3);
RetractAirBrake = FALSE;

endsequence

///////////////////////////////////////////////////////////////////////////////////////////


endScript

Locust_
24th June 2004, 01:11 PM
haah I see now in the CMC you give names to keystrokes......
then you use thoes names in the script

Ok I changed the CMS back to what it was (DropBomb) instead of adding ALT SPC to cms.b100



Thx again !!!

JNOV
24th June 2004, 01:44 PM
Sure, you can change the relative timing of dropping the bombs and opening the air brakes. Right now, the timing is controlled by these lines in the script:

DropBomb = TRUE;
delay(3);
ExtendAirBrake = TRUE;

The "delay(3);" line is the source of the delay between dropping the bomb and extending the air brakes. You can get rid of that line and its delay altogether, so that the two events would occur simultaneously, or you could reduce the delay to 2 or 1 for a finite, but shorter delay.

I'm glad you got it working!

- JNOV

JNOV
24th June 2004, 02:09 PM
Locust:

I was thinking about your "toggle views." There is an easier way to get at this problem using a script. The idea is that when you have snap views selected, pressing the 8-way hat or up-view modifying key(s) maintains the selected view(s) only as long as the key is pressed. But, if you have snap views selected, pressing the 8-way hat and/or up-view modifying key(s) maintains the selected view after you release the view keys and until a new view is selected or a "re-center view" key is pressed. Using this scheme, you would always keep the sim in snap-view mode; the toggling between snap- and toggle-view modes would be logical and be handled entirely in the script. This would free up a bunch of buttons for you, and the "slewing" from view to view would probably be smoother when in "toggle view" mode than it is now with the repeated keystrokes.

If you're interested, let me know and I'll try to throw something together for you. It might be a good way to learn about some of the "more advanced" things you can do with CMS scripting.

Best regards,

- JNOV

Locust_
24th June 2004, 02:49 PM
Ok now youve made me curiouse

Add it to the map Sir, Ill try it.

Right now I can look around preaty good, but im sure theres better waye's, that would rox.

hookitup_ :cheers:

Locust_
24th June 2004, 02:59 PM
I dont know if this will help its the keylayout I use within FB_Aces

opens with notepd