Jump to content

Oakes SIOC Export/Import Scripts


Oakes

Recommended Posts

well, I'll develop weapons script this week and will post it, but I still haven't received SIOC card so I can't test it myself... and would be pleased if you could verify it and add it to your work.

 

but with no card connected, I will have to let ouput values blank in SIOC...

Link to comment
Share on other sites

  • Replies 125
  • Created
  • Last Reply

Top Posters In This Topic

Well, the script has support for cannon ammo count, missile/bombs etc count and weaponstype.

 

-- Enter the SIOC parameter number for the Remain and RNDS disply on the Weapons Control panel
ammoCountersAndType = {Remain=208, RNDS=207, Type = 300}

"RNDS = 207" => please update the SIOC variable nbr 207 with the nummer of cannons rounds remaining.

 

"Remain = 208" => same as above but for missiles, bombs etc

 

"Type=300" => gets a value based on the selected weapon according to the weaponsTypeIndicator table (in weaponsIndicator.lua). Your SIOC code needs to interpret this value and display the correct info on the display.

 

weaponsTypeIndicator = {
["EMPTY"] = 0,
["S-8KOM"] = 1, -- HP
["9A4172"] = 2, -- NC
["FAB-250"] = 3 -- A6
}

SIOC Code:

Var 0300, name WeaponType, Value 0
{  
 IF &WeaponType = 1     // HP
 {
   &UL1 = 1    
   &C1 = 1    
   &B1 = 0    
   &LL1 = 1    
   &T1 = 0    
   &UR1 = 1    
   &LR1 = 1    
   &UL2 = 1    
   &C2 = 1    
   &B2 = 0    
   &LL2 = 1    
   &T2 = 1    
   &UR2 = 1    
   &LR2 = 0    
 }
 IF &WeaponType = 2     // NC
 {
   &UL1 = 1    
   &C1 = 0    
   &B1 = 0    
   &LL1 = 1    
   &T1 = 1    
   &UR1 = 1    
   &LR1 = 1    
   &UL2 = 1    
   &C2 = 0    
   &B2 = 1    
   &LL2 = 1    
   &T2 = 1    
   &UR2 = 0    
   &LR2 = 0    
 }
 IF &WeaponType = 3     // A6
 {
   &UL1 = 1    
   &C1 = 1    
   &B1 = 0    
   &LL1 = 1    
   &T1 = 1    
   &UR1 = 1    
   &LR1 = 1    
   &UL2 = 1    
   &C2 = 1    
   &B2 = 1    
   &LL2 = 1    
   &T2 = 1    
   &UR2 = 0    
   &LR2 = 1    
 }
}

UL1 => Upper left segment display 1, B2 => bottom segment display 2 etc...

 

What I need help with is adding all the weapons to the weaponIndicatorTable.

 

So far I have simply made a little debug code in the script that prints the Weapon name to Export.log and compared that with the simulated display for a bunch of weapons. Maybe there is a smarter way.

 

Uncomment these lines in function ProcessAmmoCountAndType(pRemainSIOCParam, pRNDSSIOCParam, pTypeSIOCParamhttp://code.google.com/p/dcsbsexport/source/browse/tags/beta_0_92/ExportSupport.lua#103) in exportsupport.lua

 

--io.write(lWeaponType)
--io.write("\n")

and make sure that the

io.flush()

is uncommented at the end of the same function.

 

Now you will see the name of the weapon in the .\temp\Export.log

 

/Oakes

Link to comment
Share on other sites

I went through all the available load outs from the radio menus and here is the complete list of weapons in the stock misssions.

["9A4172"] = "NC",  
["S-8KOM"] = "HP",
["S-13"] = "HP",
["UPK-23-250"] = "NN",
["AO-2.5RT"] = "A6",
["PTAB-2.5KO"] = "A6",
["FAB-250"] = "A6",
["FAB-500"] = "A6"

 

I know oakes covered it in other posts but other tricky part is determining when to turn the weapons 7 segment leds on/off. So far the sudo logic I use is as follows:

start with station_display set to no
start with ammo_display set to no

if argument 615 on device 0 = 0 then station_display set to off
if argument 615 on device 0 = 1 then station_display set to on
if argument 433 on device 0 = 1 then ammo_display set to on
if argument 433 on device 0 = 0 then ammo_display and station_display set to off

This works very close except during startup. In the game cockpit the display does not come on line to appropriate power is available, but I have not found a way to detect this via the lua export.

Link to comment
Share on other sites

Excellent. I'll copy that list in no time......:music_whistling:

 

btw, here is another case that is somewhat tricky: Select a station with rockets, jettison the rockets (station is now reported as "EMPTY") but DCS still displays the NC/HP etc on the type display....

 

Wish ED could give us a"getInfoOnDisplay(2)" function :helpsmilie:

 

/Oakes

Link to comment
Share on other sites

can you use

 

-- Engines RPM from main panel

 

LeftEngineRPM = 135

RightEngineRPM = 136

 

to test the electrical power : it appears to be sufficient to light many systems only above a certain value of engines RPMs no ? (to determine I didn't do that, just a suggestion...)

 

/Hellfrog


Edited by C6_Hellfrog
Link to comment
Share on other sites

can you use

 

-- Engines RPM from main panel

 

LeftEngineRPM = 135

RightEngineRPM = 136

 

to test the electrical power : it appears to be sufficient to light many systems only above a certain value of engines RPMs no ? (to determine I didn't do that, just a suggestion...)

 

/Hellfrog

 

Problem is that only accounts for part of it. You have to account for external ac as well as what setting the inverter switches are at. It becomes more of a matrix of conditions to deal with than I want to deal with. So I just deal with having more info occasionally displayed on my cockpit than in game.

Link to comment
Share on other sites

Problem is that only accounts for part of it. You have to account for external ac as well as what setting the inverter switches are at. It becomes more of a matrix of conditions to deal with than I want to deal with. So I just deal with having more info occasionally displayed on my cockpit than in game.
Yep, me too.

 

Here is another interesting test case: You can select weapons with the Targeting System off and the LUA functions for getting weapons info will report back as if the targeting system was on. Funny enough DCS itself doesn't update the display :)

 

Select ATGM (outer stations), switch Targeting system off, select rockets (inner stations), switch targeting system on. DSC Simulated weapon type is still ATGM:doh:

 

And what about damage....how do we detect that the Targeting system or some subsystem etc is causing the displays to be blank etc....blehh

 

I say, "Ed, give some display info to the people":)

 

/Oakes

Link to comment
Share on other sites

btw, here is another case that is somewhat tricky: Select a station with rockets, jettison the rockets (station is now reported as "EMPTY") but DCS still displays the NC/HP etc on the type display....

 

/Oakes

It only updates the weapon type when you change stations. So if you jettison rockets, switch to other stations, and switch back, it will be blank.

 

Cheers,

Colin

Link to comment
Share on other sites

Hi Colin

 

yep, I know, the problem is that the get_weapon_type_on_station() reports the station as EMPTY, so if you use that as the "trigger" for display or not display ones "real" display will be out of sync with the "sim" display (since the sim display follows the behavior you described).

 

Anyway I made a work around in the script (only update the display if you select a different station). It's a little bit messy, I'm seriously thinking of rewriting that part of the code at some point....:book: maybe there is a smarter way.

 

/Oakes

Link to comment
Share on other sites

Hi Colin

 

yep, I know, the problem is that the get_weapon_type_on_station() reports the station as EMPTY, so if you use that as the "trigger" for display or not display ones "real" display will be out of sync with the "sim" display (since the sim display follows the behavior you described).

 

Anyway I made a work around in the script (only update the display if you select a different station). It's a little bit messy, I'm seriously thinking of rewriting that part of the code at some point....:book: maybe there is a smarter way.

 

/Oakes

Well, that's how the sim does it, so that's how I do it too. Just get_weapon_type whenever you change stations.

 

Cheers,

Colin

Link to comment
Share on other sites

  • 1 month later...
  • 6 months later...

I have modified ExportSuport.lua to include potentiometer support, this work fine for the 3 potentiometer of the Shkval and the pot of the Abris brightness. To make this work, only add this following code to the bottom of ExportSuport.lua:

function SimplePotentiometer(pValue, pDevice, pNumber)
   GetDevice(pDevice):performClickableAction(pNumber + 3000,(pValue /256))
end

Exemple: to control the brightness of the HMS, add this code to siocConfig.lua

[701] = {SimplePotentiometer, 23, 1},--Helmet device brightness

Also, some switch 3 positions switches like the baro/ralt altitude do not work like the burst length switch. To make this particular switches work correctly, a value of 1 6 11 must be used instead of 1 2 3

The SIOC code for this switch is:

Var 0518, name BaroRalt, Value 1

Var 0906, name Baro, Link IOCARD_SW, Input 279
{
 IF &Baro = 1
 {
   &BaroRalt = 1    
 }
 IF &Baro = 0
 {
   &BaroRalt = 6    
 }
}

Var 0907, name Ralt, Link IOCARD_SW, Input 286
{
 IF &Ralt = 1
 {
   &BaroRalt = 11    
 }
 IF &Ralt = 0
 {
   &BaroRalt = 6    
 }
}

And the code inside siocConfig.lua is this:

[518] = {SimpleRotary, 33, 6},--Autopilot BARO/RALT altitude hold mode

My configuration files can be found at https://www.simonguilbault.ca/upload/cockpit/

Link to comment
Share on other sites

  • 2 months later...

Hi to all!

 

I´m trying to build a BlackShark pit with OC-Cards and now have my first little problem:

For the Burst Lenght (LNG/Med/Short) i use a On-Off-On Switch.

The required Key "s" will be sent but the switch inside the simulation skips some positions. The "double s" will not be sent at the right time.

Other switches are working fine so theres no problem with opencockpitcards or something else.

What i have read in several posts, my configuration seems to be right but it is still not working. Maybe someone can help me and give the crucial hint. I tried arround a whole day now and get no solution.

Im still beginning with programming such things and its really not so easy for me...

 

In Sioc.ssi there are the lines that stands underneath exept other Var numbers:

 


Var 0510, name BurstLen, Value 1

Var 0506, name BurstLenShort, Link IOCARD_SW, Input 8
{
 IF &BurstLenShort = 1
 {
   &BurstLen = 1    
 }
 IF &BurstLenShort = 0
 {
   &BurstLen = 2    
 }
}

Var 0507, name BurstLenLong, Link IOCARD_SW, Input 6
{
 IF &BurstLenLong = 1
 {
   &BurstLen = 3    
 }
 IF &BurstLenLong = 0
 {
   &BurstLen = 2    
 }
}

And this line in inputsTables.lua takes care of the DCS side

[510] = {SimpleRotary, 12, 4},

Just let me know if you need any more help.

 

/Oakes

 

In siocConfig.lua:

[525] = {SimpleRotary, 12, 4},--Weapon mode switch - Burst Length

 

In dcs.csv from keyclient_1_00:

525;BurstLen;S;;1;3;s;

I think here is the problem

 

Maybe someone can upload a final sioc.ssi so i can compare some settings. So i can better understand the correlation.

 

P.S.

Great thanks to Oakes for all his work! This animated me to start building my little Homepit and i hope i get it...:thumbup:

 

regards

Terrorvogel

Sioc-ssi.jpg.0522858f5023d2885545e17cd0199e9b.jpg

siocConfig-lua.jpg.90c38e7f512dd550758e87a9bb3ffdb3.jpg

dcs_csv.jpg.381f4c3b9cac9b37badf84dc6ad780c5.jpg

ASROCK X79 Extreme11 (WC), i7-4930K (WC), 32GB G.Skill TridentX, Vertex 3 120GB, GTX 980ti, 3x 39,5" Philips 4K, TrackIR 5, TM Warthog with PeterP´s FFB2 Mod, 2xSaitek Throttle, 2x Thrustmaster Cougar MFD Bezel, Simped Vario Pedals modded with toe brakes, Opencockpit Cards, 4x Soundcard, 2x Buttkicker Gamer 2, 4x GTX 950 with tons of touchscreens...

Link to comment
Share on other sites

There is no export data for the UV26 Displays, PVI-800 Displays or the three indicators above the EKRAN.

 

For the weapons panel and it's segments do a search on this thread, panel builders and some of my old threads.... I know him, Oakes and myself discussed the algorithms for the weapons panel and posted LUA code at one point.

Link to comment
Share on other sites

  • 2 weeks later...
Hi to all!

 

I´m trying to build a BlackShark pit with OC-Cards and now have my first little problem:

For the Burst Lenght (LNG/Med/Short) i use a On-Off-On Switch.

The required Key "s" will be sent but the switch inside the simulation skips some positions. The "double s" will not be sent at the right time.

Other switches are working fine so theres no problem with opencockpitcards or something else.

What i have read in several posts, my configuration seems to be right but it is still not working. Maybe someone can help me and give the crucial hint. I tried arround a whole day now and get no solution.

Im still beginning with programming such things and its really not so easy for me...

 

In Sioc.ssi there are the lines that stands underneath exept other Var numbers:

 

 

 

In siocConfig.lua:

[525] = {SimpleRotary, 12, 4},--Weapon mode switch - Burst Length

 

In dcs.csv from keyclient_1_00:

525;BurstLen;S;;1;3;s;

I think here is the problem

 

Maybe someone can upload a final sioc.ssi so i can compare some settings. So i can better understand the correlation.

 

P.S.

Great thanks to Oakes for all his work! This animated me to start building my little Homepit and i hope i get it...:thumbup:

 

regards

Terrorvogel

 

 

Hi mate

 

 

Keyclient was used before we could connect directly to DCS:BS through export.lua = > you shouldn't use the Keyclient when using the direct connection through export.lua, this will most likely introduce some sort of race condition between the keyclient and export.lua which will cause you to see erratic behavior (depending on whether keyclient or export.lua manipulates the switch first).

 

/Oakes

Link to comment
Share on other sites

Hi mate

 

 

Keyclient was used before we could connect directly to DCS:BS through export.lua = > you shouldn't use the Keyclient when using the direct connection through export.lua, this will most likely introduce some sort of race condition between the keyclient and export.lua which will cause you to see erratic behavior (depending on whether keyclient or export.lua manipulates the switch first).

 

/Oakes

 

First of all thx for your reply Oakes,

 

meanwhile i tried arround and that Burst Lenght button is working now, but i dont know why. All the other Switches, that i have installed so far, are working fine too.

 

Nevertheless i think your hint is very important for my further building a pit because last days i had ordered a additional Mastercard and first USB Outputs-Card and lots of that Gray-Encoders. So maybe you can still give me some helpful answers for my noobie questions:

 

1. What do i have to change exactly to "eliminate" my keyclient.exe and using only the export.lua? Maybe you can upload some config files (export.lua and sioc.ssi or whatever is important)? Im a little bit overwhelmed with all that "programming" so i can better understand when i see an still existing configuration . I dont even know how i get my current switches to work :doh:

 

2. Is it possible, to let SIOC turn the switches in the cockpit to the real positions at beginning of flight so they dont get out of sync? I read about some kind of that question before but didnt understand the answer. Now i have to set all my Switches to basic positions before start so they are in sync. Does this work better with running over export.lua? But i dont think so...

 

3. Im still building a UV-26 and do you think in future it will be possible to integrate a 3-digit unit controlled by SIOC? Its so bad that it is not already integrated:cry:

 

greetings from cloudy Austria

Terrorvogel

ASROCK X79 Extreme11 (WC), i7-4930K (WC), 32GB G.Skill TridentX, Vertex 3 120GB, GTX 980ti, 3x 39,5" Philips 4K, TrackIR 5, TM Warthog with PeterP´s FFB2 Mod, 2xSaitek Throttle, 2x Thrustmaster Cougar MFD Bezel, Simped Vario Pedals modded with toe brakes, Opencockpit Cards, 4x Soundcard, 2x Buttkicker Gamer 2, 4x GTX 950 with tons of touchscreens...

Link to comment
Share on other sites

  • 2 weeks later...

 

1. What do i have to change exactly to "eliminate" my keyclient.exe and using only the export.lua? Maybe you can upload some config files (export.lua and sioc.ssi or whatever is important)? Im a little bit overwhelmed with all that "programming" so i can better understand when i see an still existing configuration . I dont even know how i get my current switches to work :doh:

All my files are available here http://code.google.com/p/dcsbsexport/source/browse/#svn/trunk

 

Also, please have a look at this thread (start at post #48 ), you will get more or less a step by step guide on how to connect a switch to the OC card and getting it's inputs to the sim. http://forums.eagle.ru/showthread.php?t=45071&page=5

 

 

 

2. Is it possible, to let SIOC turn the switches in the cockpit to the real positions at beginning of flight so they dont get out of sync? I read about some kind of that question before but didnt understand the answer. Now i have to set all my Switches to basic positions before start so they are in sync. Does this work better with running over export.lua? But i dont think so...

 

If you use export.lua, all the virtual switches will be synced at sim startup with the physical (i.e real) ones (watch out and remember to reset your physical eject switch before you start the sim...ask me how I know :lol:)

 

 

3. Im still building a UV-26 and do you think in future it will be possible to integrate a 3-digit unit controlled by SIOC? Its so bad that it is not already integrated:cry:

 

This is up to ED, we can control any number of 7-segment displays through SIOC, but ED needs to enable us to get the correct numbers by calling some LUA function.

 

 

/Oakes

Link to comment
Share on other sites

for the HUD I have this line in clickabledata.lua :

 

 

elements["PTR_HUD-TMB-SETKA02"] = { class = {class_type.TUMB, class_type.TUMB}, hint = LOCALIZE("HUD Modes Reticle/Night/Day"), device = devices.HUD, action = {device_commands.Button_2, device_commands.Button_2}, arg = {9, 9}, arg_value = {-direction*1.0, direction*1.0}, arg_lim = {{-1,1}, {-1,1}} }

 

I have make this line in SiocConfig.lua

 

[1070] = {SimpleRotary, 7, 2}

 

but I can just change for 2 positions not for the 3

 

I have test with

 

[1052] = {TwoPositionSwitch, 7, 2, -1,1},

[1052] = {TwoPositionSwitch, 7, 2, -1},

[1052] = {TwoPositionSwitch, 7, 2, 0.2},

 

but that no good

 

have you make this command ?

Thank's for your work

Link to comment
Share on other sites

Hi mate

 

Try adding this function to ExportSupport.lua:

 

function SimpleRotaryTest(pValue, pDevice, pNumber)
   GetDevice(pDevice):performClickableAction(pNumber + 3000,pValue - 2)
end

and change the line in SIOCConfig.lua to:

 

[1070] = {SimpleRotaryTest, 7, 2}

Let me know if this works.

 

Your SIOC code should send the value of 1, 2 or 3 (depending on the switch position) to parameter 1070 for this to work.

 

 

/Oakes


Edited by Oakes
Link to comment
Share on other sites

  • Recently Browsing   0 members

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