Jump to content

TARGET - Advanced programming


ivanwfr
 Share

Recommended Posts

Here are some of my major proficient elements good to consider when dealing with TARGET scripting. And I mean when you want to go beyond Thrustmaster FAST SCRIPT BASIC document.

 

The intent is to add some clues to what comes out from experimenting with the language after having read this and messed up with what you think the meaning was.

 

The main intent of the author seems to be about making explanations as simple (i.e. short) as possible in order to avoid frightening readers... Results is there are so many missing parts that your guesses are the only way out, like if 20% of A-10's cockpit buttons were not documented.

 

 

My starting point was to use TARGET to improve the use of a perfectly working HOTAS that does not require it in any way. To do that, I had to come up with a clean working base. And the documentation was not helpful here.

 

To start with something immediately useful, here is the most basic lesson I learned from the experience:

 

 

 

 

Making good use of preprocessing include directive helps at improving readability in several ways:

 

- Lightens and compacts calling code with the effect of displaying the big picture.

 

- Confines related code into a dedicated file where it can be isolated from irrelevant code.

 

 

  • Here are a few topics organized into their own separate files:
    [size="2"]
    [color="RoyalBlue"][b]include[/b][/color] "target.tmh"              // Target's own definitions
    [color="RoyalBlue"][b]include[/b][/color] "js/js_map.tmc"           // ...separate custom code
    [color="RoyalBlue"][b]include[/b][/color] "th/th_map.tmc"           // ...throttle mapping detail
    [color="RoyalBlue"][b]include[/b][/color] "axis/util_axis_map.tmc"  // ...MapAxis() calls
    [color="RoyalBlue"][b]include[/b][/color] "axis/util_KeyAxis.tmc"   // ...keyAxis() calls
    [/size]
    


    ...those files can use their own relevant include organization as well.
     
     
     
     

  • Optional functions files may be included too:
    [size="2"]
    [color="RoyalBlue"][b]include[/b][/color] "view/util_view.tmc"
    [color="RoyalBlue"][b]include[/b][/color] "util/util_led.tmc"
    [color="RoyalBlue"][b]include[/b][/color] "util/util_log.tmc"
    [/size]
    


    ...activating and deactivating those optional functions would only require commenting out a one-liner call to the freezed function from main code. The alternative beeing a whole bunch of freezed commented code lines.
     
     
     
     

  • The standard main script entry point specifying two modifier switches for IO and UMD layers:
    [size="2"]
    int main()
    {
    // Init
    Exclude(&HCougar);
    Exclude(&T16000);
    Exclude(&LMFD);
    Exclude(&RMFD);
    
    if(Init(&EventHandle))
    	return 1;
    
    SetKBRate(25, 33);
    
    // [u]Layer shift switches S3 and S4[/u]
    SetShiftButton(
      &Joystick, S4      // devI    , indexI
    , &Joystick, S3 , 0  // devUMD  , indexU, indexD
    , 0);                // flag (IOTOGGLE + UDTOGGLE)
    [/size]
    


     
    ...&Joystick, S4
    Means holding joystick S4 switch down while activating another js or th switch asks TARGET to generate it's I(in) layer mapped virtual input event (instead of the default O(out) one).
     
    ...&Joystick, S3
    Same idea applies for the U(up) layer mapping.
    , 0 is where an D(down) layer modifier would be specified.
     
    ..., 0
    - Default (0) has layer shift while holding shift buttons (modifiers / reformers)
    - IOTOGGLE, UDTOGGLE toggles layer combination in effect on/off each time you hit one
     
     
     
     

  • The mapping part: [PHYSICAL SWITCHES] to generated [PROCESS INPUT EVENTS] (keyboard + DX-Input):
    [size="2"]
    printf("DCSW_main:\xa"); // A clue about script activity in editor's trace panel
    js_map();                // Calling a function defined in the included "js/js_map"
    th_map();                // ...same for throttle mapping
    util_axis_map();         // ...and axis mapping
    util_KeyAxis();          // ...virtual keyboard events based on specified axis values
    init_LED(&Throttle);     // ...playing with console LEDs
    printf("...ready\xa");   // Just to know we're there, not trapped into some dead-lock
    [/size]
    


     
     
     
     

  • Handling [button press / release] entry point:
    [size="2"]
    int EventHandle(int type, alias o, int x)
    {
    if(log_level > 0) {
    	if((x < IN_POSITION_AXES) & o[x])
    		log_event(&o, x);
    }
    DefaultMapping(&o, x);
    }
    [/size]
    


    Here we have a chance to interfere before the virtual input mapped to each switch gets delivered to the focussed process (*).
     
    In this case, the code does not change anything to the standard handling. It just calls a function that prints details about what's happening when switch activation handling is carried out. The log_event() function is in the "util/util_log.tmc" included file (shows selected layer, switch number, ...).
     
    In fact, this is where we can add some tricks that would override standard TARGET features (...)
     

 

I have more experimental (painfully obtained) information to share but it will be better discussed when appropriate rather than adding to this first post... that I hope it's still readable ;)

 

(*) During script test sessions, your focused window will direct generated virtual events to the owning process. A good idea is to always click EventTester's window before pressing any button as it is prepared to ignore anything you throw at it.

 

 

As it is my first contribution to the forum, I made this post as a compilation of what brings me here and I intend to reorganize it in the near future.

 

Topic subject is about TARGET advanced programming (early steps) but I need to state who's talking in order to make myself clear about why this post and what I expect from readers.

 

BTW, I'm french, so... ;)

 

To say the least, I'm quite new at sim's! In fact I have everything to learn as my only background is some playing around with FS ages ago. But, as I took the (good!) time to read posts telling newbies how to behave, I think I'm ready to contribute with something useful ...and hopefully get some contributing input in return.

 

At this time, I had to show up because I went as far as I could with my non-existent experience on the main subject (DCS per se).

 

In fact, this TARGET SCRIPT exploration of mine has been my first motivation at getting my hands on a Thrustmaster HOTAS. I was amazed by all these buttons and the level of user programming Thrustmaster released. All my previous experience with Logitech software has been so disappointing that I was not expecting such level of consideration from any hardware manufacturer.

 

Then, I stumbled upon DCS A-10C ED's simulator (early 2011 was just the right time ;) ) and I could not resist at downloading it. And I'm really happy I failed!

 

From my reading so far, I could see that experienced simmers are rather envious of newcomers at the discipline as the journey from startup to mastering the beast is the best part. ...Lucky me!

 

As such, any serious major choices I'm about to make at this stage of my INPUT programming requires sound decisions. Like for example which buttons would be best dedicated at TARGET IOUMD layers switching that would be the least interfering with mission tasks... That's where i'm a total noob and this is the rationale of this post, aside from the pleasure to share what I'm best prepared to contribute thanks to my knowledge... I'm no airline pilot, but I know my way around computers, that's why.

 

...all this needs being relocated to some presentation thread. I'm aware of it! ...will do.

 

My student journey had me motivated to gather information published by others and I shared my harvest in these User Files:

But my code the most relevant to this post is the one attached bellow. I did not upload it elsewere yet because it's my working copy and as such is going to become obsolete everyday!

 

 

 

[size="2"]

[u]DCS_ivanwfr.zip[/u]
(111222)
...updated TM_Warthog_Combined_1111_ivanwfr.lua
... * DX Input OFF button events have no effect :( *

(110924)
+ H2U + TG1_MO  + flashLED() // PAC auto zoom 
(110818)
+ H4U_DO = USB_QUOTE;                // Score window
+ H4R_DO = USB_QUOTE+ L_SHIFT;       // Show debriefing window
+ H4P_MI = USB_M    + L_CTL;         // Master Caution

(110803)
... js_SHIFT() & th_SHIFT() called later, in order to override earlier standard mapping.
... Console back light Intensity & On/Off
... Up-Out layer updated: Eject, Respawn, Frame rate, Active Pause
... [b]Joystick[/b] with SetCurve(zoom) with [b]S3[/b]
- Hold S3 = Joystick Precision temporary mode (like TrackIR does)
- Hold S3 + Friction Control : Adjust and retain zoom (Full forward = 100% deviation)
- ... removed curvature adjustment (no need for TM Warthog)

... Adjusted snap-views key down timer from default 32ms to 50ms - (110613)
[i]* works much better (as in [u]every time[/u]) with my rig (i7 960 + W7x64)[/i]
... Adjusted hat corner handling -- Throttle CS and Joystick H[1234] [uRDL] - (110612)
... Added th_DX_main.tmc for a simple DirectInput Trottle Mapping
[i]* needs loading related profile *[/i]
... Adjusted P&P profile for Patch-1108
... China Hat that won't go in corners (...and disrupt [i]Left Long Press[/i] = SOI)
... Hats in corners
... Slew keying/mousing tuned by Friction-Control
... DCSW_PNP_main.tmc as a bare PnP starting point
... Slew / Trackpad mouse pointer freezing with S3 for a stable Left-Click.

[u]PNP_ivanwfr.zip[/u]
...TARGET [i]Combined[/i] plug and play as an alternative to separate USB devices
[i]Joystick+Throttle HOTAS Warthog Game Controllers[/i]  

[u]DCS_Bindings.zip[/u]
...Keyboard dynamic HTML for IOUMD layers bindings

[/size]

 

Note : All of this has been smartly sabotaged with patch 1.1.1.1. :cry:

Event_Tester_PNP.thumb.png.f5e03256d06de99829f046edca355308.png

PNP_ivanwfr_110924.zip

DCS_ivanwfr_110924.zip

MI.thumb.png.9d686c7f781e0261dab8bc00551924d4.png

DCS_Bindings_110924.rar

MO.thumb.png.b2a9edb910dec8c26a39ca8dc0048e01.png

UI.thumb.png.50832ee6535aeebe778785b42c7a4dd2.png

UO.thumb.png.f44bac7c2fa77057760e6863b31a6fc7.png

DI.thumb.png.5a732fc89717d9c1cd48f68580a747ed.png

DO.thumb.png.d7d7e33377df1adfb671f1e1d5f09077.png

PNP_ivanwfr_111222.zip

DCS_ivanwfr_111222.zip


Edited by ivanwfr
spelled organized correctly instead of organizsed ^^
  • Like 1
Link to comment
Share on other sites

Adjusting and Saving Cockpit Angles ruled by thumb

 

Starting from the structured mapping code attached - and updated - to my first post, I could introduce an automated handling of DCS\Config\View\SnapViews.lua.

 

DCS Command is:

[save Cockpit Angles] category [View Cockpit]: [save current cockpit camera angles for fast numpad jumps]

 

 

<install_dir>\DCS\Config\View\SnapViews.lua:

 

This feature does not seem to be fully implemented yet as the configuration is not saved in user profile space as it should... for instance:

C:\Users\<your_login_name>\Saved Games\DCS Warthog\Config\View

...would be appropriate, I guess.

 

Instead, your views are saved in one of DCS program default configuraton folder:

<install_dir>\DCS\Config\View in a file named SnapViews.lua

 

 

This is where the 10 snap views corresponding to Num0-Num9 of the Number pad are defined (and can be adjusted) (and 3 more views are there for mirrors).

 

 

But, in fact, they're never saved, anywhere, as this can happen only after you unlock the feature as explained below.

 

 

<install_dir>\DCS\Config\View\View.lua:

Another little but weird detail to consider, is that you need to modify a variable defined in the View.lua program file you can find in the same folder in order to have the command effectively do something!

 

Even if you map some input event to "Save Cockpit Angles", there is a default directive telling the program to ignore this command. To change this, you have to modify one line of View.lua.

Line 50 says:

UseDefaultSnapViews = true

...and it should read:

UseDefaultSnapViews = false

...as we want our SnapViews.lua file used instead of the one named SnapViewsDefault.lua!

 

At this point, we can hit R_ALT + Num0 and have our SnapViews.lua updated when program exits. (Beware, this file is created only when you terminate your session).

 

As a side note some helpful information can be found in SnapViewsDefault.lua but unfortunately, there is a twist in the comment you find there (merely a missplace punctuation in fact):

 

User-made snap views for all his missions are saved 
in the Config/View/SnapViews.lua file if the parameter
DisableSnapViewsSaving = true in the Config/View/Cockpit.lua file.
Default snap views come from the Config/View/SnapViewsDefault.lua file.

 

...should read:

 

User-made snap views for all his missions are saved in the Config/View/SnapViews.lua file.

If the parameter DisableSnapViewsSaving = true in the Config/View/Cockpit.lua file,

default snap views come from the Config/View/SnapViewsDefault.lua file.

 

...and that's precisely what we don't want!

 

 

 

Using [save Cockpit Angles]:

 

Still, even if you can redefine your views, it's not a friendly process. If ED did not advertise much about this it's for a reason, and I guess it's because the procedure is currently pretty tricky:

 

When you hit [R_ALT + Num0], what you're saving is the last selected predefined view you've displayed before you started ajusting the camera.

This means you must not inadvertently use any of those views while you're making your camera adjustements. If you do, you're going to modify the wrong one.

 

 

 

TARGET:

 

This is where my TARGET script comes to the rescue... Well it will be adequate only for those who are ready to use TARGET with a compatible HOTAS! ...and get their hands dirty during the process ...and are still reading.

 

I based the Save Cockpit Angles function on the SNAP VUE [LOOK]-[sELECTION] mechanism I've put in there earlier.

 

What it does right now is this:

 

- The selection of one of those views can be made with the 4 HATS/POV of a Warthog HOTAS.

 

- After having carefully adjusted the position of the camera in the cockpit, the next HAT-SELECTED view can be instantly modified (and later saved) by pressing [s4 + S3 + S2] (cat + drunk-pilot proof combos!).

 

... just follow the maze:

 

S4 (Middle-In layer shift)

-> see [H1234] mapping of js/js_MI_view.tmc

-> will call view_look_start, view_look_end, view_select, unlock_view of view/view_cockpit.tmc

 

S3 (Up-In layer shift)

-> see [s2] mapping of js/js_UI_view.tmc

-> will call view_save_selected of view/view_cockpit.tmc

 

These steps are not frienly either (at first) but I wanted to share my raw results early. If they draw more than my own curiosity, I'm ready to get into more details for those interested.

 

Quick steps to make that work: ;)

 

(Dont' shoot, I will elaborate/adjust on request...)

 

- Combined_ivanwfr.lua: In order to have TARGET virtual HOTAS work at least like the TM Warthog 2 separate devices mapping with DCS A-10C, you have to import those DCS corresponding commands.

 

It comes as the result of an initial mapping session profile with a keyboard shortcut bound to each Joystick button keeping all 32 DX-input available for Throttle mapping.

 

(BTW... have a look there to see a note about [Flight Control] JOY_BTN3 messed up between joystick and throttle... still have to issue a ticket about that.)

 

 

- Launch TARGET Script Editor and load and run view_main.tmc or DCSW_main.tmc

 

 

- Then do some reading of the most relevant code in these files:

- view_main.tmc

- js/js_MI_view.tmc

- js/js_UI_view.tmc

- view/view_cockpit.tmc

 

 

I think I've much to do for all that to make sense to no geek-like-me but it's all a work in progress.

 

...don't hesitate to ask about all that I intentionally avoided to talk about... (this post is long enough ;) )

 

[size="2"]
   DCSW_main.tmc
   Makefile
   view_main.tmc
   |
   +---assoc
   |       util_assoc.tmc
   |       util_assoc_init.tmc
   |       util_assoc_keys.tmh
   |       util_assoc_log.tmc
   |       util_assoc_main.tmc
   |       util_assoc_map.tmc
   +---axis
   |       axis_key_map.tmc
   |       axis_map.tmc
   +---js
   |       js_declare.tmc
   |       js_map.tmc
   |       js_MI_view.tmc
   |       js_MO_LED.tmc
   |       js_MO_standard.tmc
   |       js_Release.tmc
   |       js_UI_view.tmc
   |       js_UO_LED.tmc
   +---th
   |       th_declare.tmc
   |       th_map.tmc
   |       th_MO.tmc
   +---util
   |       util_led.tmc
   |       util_log.tmc
   |       util_usb.tmh
   +---view
       view_cockpit.tmc
[/size]


Edited by ivanwfr
typo
Link to comment
Share on other sites

TARGET - Friction Control Slider to adjust SC sensitivity (Slew and mouseStick)

 

This TARGET script shows how it is possible to adjust Slew Control and trackpoint sensitivity.

 

Friction Control slider modifies keystrokes down/up time ratio as well as mouse axis curve zoom as appropriate.

 

Joystick S4 activates SC button press In-layer function (as shift key) to toggle between SC ",./;" default key pulses and mouse pointer mapping.

 

In each case, sensitivity can be adjusted by the Friction Control slider.

 

(I can get into more details when/if asked)

 

 

[edit]

After some test, I'm not happy with CPU drain by my REXEC(slewFunctions)...looking for optimization... I crashed twice as the Joystick input was delayed!

 

But it was good not needing the mouse for Aircraft view handling... I had to invert MOUSE_Y="Camera Vertical View" and MOUSE_Z="Camera Zoom View" to make it feel as you were turning the plane around instead of the camera.

ivanwfr_slew_110511.zip


Edited by ivanwfr
script attached!
Link to comment
Share on other sites

Question...

 

Can somebody post detailed info on how to use DCS_ivanwfr._110506.zip file so i can have equivalent of the P&P default interactions between Thrustmaster HOTAS and DCS: A-10C.?

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Well, I didn't bother getting into any detailed procedure on how your're supposed to switch from a default plug & play use of a perfectly working TM Warthog HOTAS as you're supposed to suffer by yourself a little of the "painful" TARGET aproach :book: and I can deduce from your wording that you did not even considered it any bit :helpsmilie:

 

If I'm right assuming you're not on the geek side, I would say it's safer to keep away from relying on TM scripting as long as you're not ready to tune the code to your liking. Nearly everything I've put in this script I'm not happy with - yet - but I know I can change any part of it in a matter of seconds without even having to restart the sim! And I'm quite sure you would get more frustration than advantages if you can't do that as easily.

 

But, would you ask for any "technical" detail, I'm willing to talk about opportunities to improve or adapt all of this... Tell me if you're ready to get your hands dirty with some C'ish coding ...?

 

Updated first post archive -- Slew keying/mousing tuned by Friction-Control

Link to comment
Share on other sites

Well...what i wanted is a scripted profile, that is same as default TM Warthog DCS A-10c profile, on which I can add my own comands for extrenal views, and such..

So basically a profile that is same as pnp + my own commands added in script editor portion of TM Warthog software...

I have a basic understanding of programing and adding new key presses, tempo functions, 3 layers and shift state...

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Bare Plug and Play TARGET script

 

I've just updated my first post's attached archives with a DCS_ivanwfr_110513.zip version. It contains a main script file named DCSW_PNP_main.tmc which makes no references to my fancy functions! It can be used as a clean starting point at using TARGET with a TM Warthog HOTAS with ED's DCS A-10C sim.

 

The only variation is about those 4 unused swtiches:

 

- Joystick S4 (Paddle Switch) not mapped by js/js_MO.tmc

- Throttle SC (Slew Control) push mapped to Mouse Left button

- Throttle MSP (Micro Switch push) mapped to Escape

- Throttle MSU (Micro Switch up) mapped to DX3

 

Let us know where you get from there as I'm still looking into getting the best from what TARGET has to offer in order to get rid of my mouse and keyboard when in the sky!

 

I'm currently setting up a layout that makes sense at using shift keys to manage IOUMD layers without messing up muscle memory before it's too late. And it's not easy with my last addition of 27 calls to all Function keys combinations needed to access DCS's views :juggle:


Edited by ivanwfr
Link to comment
Share on other sites

  • 5 weeks later...

First, let me thank to ivanwfr...I am asking for a quick step by step guide on how to set up files in DCS_ivanwfr_110613.zip file.

I would like to test all of this:

 

".. Adjusted snap-views key down timer from default 32ms to 50ms - (110613)

* works much better (as in every time) with my rig (i7 960 + W7x64)

... Adjusted hat corner handling -- Throttle CS and Joystick H[1234] [uRDL] - (110612)

... Added th_DX_main.tmc for a simple DirectInput Trottle Mapping

* needs loading related profile *

... Adjusted P&P profile for Patch-1108

... China Hat that won't go in corners (...and disrupt Left Long Press = SOI)

... Hats in corners

... Slew keying/mousing tuned by Friction-Control

... DCSW_PNP_main.tmc as a bare PnP starting point

... Slew / Trackpad mouse pointer freezing with S3 for a stable Left-Click."

 

 

and not to use default PNP configuration.

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Hi hreich, at the moment, my files are meant to be friendly only to users who have studied TARGET programming to the point where reading my code makes enough sense to get what each line is suppose to do.

 

This does not mean they can't be used at all if it is - not yet - the case, but to make that easier, I need to take some time to describe each of my bindings logic.

 

In the mean time, you can just launch DCSW_main.tmc with TARGET Script Editor. It will provide the mapping illustrated by the attached DCS_Bindings.zip html file (see: IOUMD). You can check Throttle DX-Input bindings with Device Analyzer and Joystick generated keyboard events with EventTester.

 

* DCS controls have to be adjusted by importing my TM_Warthog_Combined_1108_ivanwfr.lua that goes with what the code sends when switches are activated *

 

I planned to further describe all this code at some point and I was expecting to do this through some dialog with those interested by the subject, but it looks like I am still the only one who cares.

 

Let me know if I can clarify something if you have any kind of difficulties. I am pretty sure there is matter for improvement about many aspects, as for example the one about yesterday evening snap views handling that was sometimes erratic until I found that 32ms key sampling time was too short when DCS is running.

Link to comment
Share on other sites

Well, as I don't have this error, there must be some difference between your working environment and mine.

 

The reported error is about OUT_ID_LED_5 which is defined in the file hid.tmh (line 102) which is automatically included by target.thm.

 

Those tmh files can be found in this installation folder:

C:/Program\ Files\ (x86)/Thrustmaster/TARGET/scripts.

 

  • target.tmh
  • defines.tmh
  • hid.tmh
  • sys.tmh

 

You can check your own folder location under this Script editor dialog: Options->File Paths.

 

I don't know what's wrong but it should not be too hard to find out. It could have been a question of interpreter version, but I have the only available one which is installed by TARGET_v1.0.exe.

 

Have a look into hid.tmh to see if you find the missing symbol. Maybe you will find something wrong on the way.

 

ivan

Link to comment
Share on other sites

Thx, will check later and report....

 

New report...as i reinstalled target your script works...great work, i like the dynamic sensitivity friction control thingie...

Now, i will add some aditional commands using script -external views, and such...


Edited by hreich

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Ivanwfr..i managed to try your script ..Only thing that i dont understand is this:

"Slew / Trackpad mouse pointer freezing with S3 for a stable Left-Click." - what is this used for?

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

The idea is to use S3 (long press) as another shift modifier asking the Slew axis to calm down just before a click.

...see js/js_MO.tmc where this is defined

...and axis/axis_THR_SC_MOUSE.tmc where the axis sensitivity is set to a minimum as long as you keep S3 depressed... kind of 7th layer as if IOUMD was not enough !

 

I like it, it works like PAC does when it turns the hog all by itself into a big gun aimed at the bad guys ;)

 

You should have a look in there in order to play with the default 200ms delay because you could miss nose wheel steering activation if you hold S3 longer !!!

 

And about the dynamic friction control sensitivity, (that I also like) I had to rework a pure TARGET macro version that was not smooth enough to be usable. The current version was a challenge as you can see in axis/axis_THR_SC_KEYS.tmc. That was not a big deal when you have some software experience but this is not friendly to main TARGET audience.

 

In fact this scipting is a nice programmer's toy as long as TM did not place the usual boundaries other manufacturers put there to avoid criticism and questions.

 

ED Mission Editor seams to be the same kind of tool, in many aspects. You can use the GUI only but miz files can be opened and LUA code edited if you know what you're doing.

Link to comment
Share on other sites

Hi...sorry to bother again...I read and read your code, and just started to getting some sense...Can you check why cant i get CSU,CSD,CSL,CSR hat in MI layer to be used as f1, f2, f3 and f4 views?

I tried both MapKey(&Throttle, CSU, PULSE+F1); and CSU_MO = USB_F1 ; and it doesnt work... I could swear on my life that at some point i got it working

 

"

// Hrvoje Views

// MapKey(&Throttle, CSU, PULSE+F1);

// MapKey(&Throttle, CSL, PULSE+F2);

// MapKey(&Throttle, CSR, PULSE+L_CTL+F4);

//MapKey(&Throttle, CSD, PULSE+F3);

 

 

CSU_MO = USB_F1 ; // Cockpit -- Cockpit view

CSR_MO = USB_F2 ; // Air -- Aircraft view

CSD_MO = USB_F4 ; // Tower -- Fly-By view

CSL_MO = USB_F3 ; // ChaseArcade -- Arcade View)

"

 

UPDATE: Just found that i was using CSU_MO insrtead of CSU_MI..

But now i dont know how to map MSU and MSD to F1 and F3 views??


Edited by hreich

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Hi, No bother at all! You are one of the few who dare put their fingers into that as a non-programmer! So, I'll always be ready to help ;)

 

The MSU and MSD wont work as long as they are used as modifiers in DCSW_main.tmc

 

SetShiftButton(&Joystick, S4, &Throttle, MSU, MSD, 0);

 

But don't hesitate to ask if I can help...

Link to comment
Share on other sites

The software behind TM Warthog is amazing...In another pc sim Rise of flight, it allowed one of users to make non existing trimming on WWWI era planes reality...it made me want to play it again (non exiting trimming was a reason i didnt want to play the game at the begining)...Although i know that there was no trimming in those planes...

 

Well I have a little programming experience in lotus domino desginer, but my work at a bank as programer turned to another direction, when company hired the external developer firm, and now it is mostly related to IT system support...


Edited by hreich

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Your experience could be the reason why your are not afraid. In fact that's all that matters. The major difference between an experienced programmer and any casual one is that the first is prepared to deal with many more issues than expected by the second. You can't be disappointed by problems along the way, you should love them :wacko: ...so perverse!

Link to comment
Share on other sites

Hi...i have a new question...I am building clean script, which after I load it automatically turns all leds and backlight off..Reading the script manual i got this, but it isnt working:

 

 

"include "target.tmh" //here we link this file to the file that contains the default Thrustmaster function code

 

int main()

{

if(Init(&EventHandle)) return 1; // declare the event handler, return on error

 

//script and function functions go here and before the }

 

 

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); //set LED 1 OFF

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); //set LED 2 OFF

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3)); //set LED 3 OFF

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4)); //set LED 4 OFF

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5)); //set LED 5 OFF

}

 

int EventHandle(int type, alias o, int x)

{

DefaultMapping(&o, x);

}

 

"

[sIGPIC][/sIGPIC]

Pilot from Croatia

Link to comment
Share on other sites

Well, I did not use those ActKey() commands for LED until now as I found a simpler lower level function call for what you are willing to do and you have it in BackLightOff.tmc of DCS_ivanwfr_110613.zip archive attached at the end of this thread's first post.

 

There is a script doing exactly that and the Pinky switch lets you toggle backlight on and off if you keep it running.

 

But, if you uncomment //return 1; in the main function, the interpreter will terminate after having turned all lights off.

 

This is simpler, quick and it works (from util\util_led.tmc file in the archive):

   GameOutput(&Throttle, OUT_ID_LED_1        , 0);
   GameOutput(&Throttle, OUT_ID_LED_2        , 0);
   GameOutput(&Throttle, OUT_ID_LED_3        , 0);
   GameOutput(&Throttle, OUT_ID_LED_4        , 0);
   GameOutput(&Throttle, OUT_ID_LED_5        , 0);
   GameOutput(&Throttle, OUT_ID_LED_BACKLIGHT, 0);

 

And you can play with intensity like this:

   GameOutput(&Throttle, OUT_ID_LED_INTENSITY,   0);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY,  43);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY,  86);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY, 129);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY, 172);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY, 215);
   GameOutput(&Throttle, OUT_ID_LED_INTENSITY, 255);


Edited by ivanwfr
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...