Results 1 to 7 of 7

Thread: Help with a script needed

  1. #1
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Help with a script needed

    I am working on making a small script that tries to reproduce a sort of very basic aircraft black box but there are some things that I can't figure out by myself so I need a bit of help from the more expert programmers ( I have a very minimal experience in scripting )

    Said so my question are:

    1)- I can find easily the Instrumentation ParamType of an aircraft instrument ( for example taking it from Virtual Cockpit files ):

    Sample ( Elevator Trim ):
    Code:
    double A_ElevatorTrim = curPlane.getParameter(part.ParameterTypes.A_ElevatorTrim, -1);
    But where I can find the other parameters of the instruments that are located in the " Parameters - Machine Spatial " section of the script? Is there a complete list of them available around? From where do you get them?

    Samples:

    Code:
    double Z_Overload = curPlane.getParameter(part.ParameterTypes.Z_Overload, -1);
    double Z_AltitudeAGL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeAGL, -1);
    double Z_AltitudeMSL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeMSL, -1);
    double Z_VelocityIAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityIAS, -1);
    double Z_VelocityTAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
    double Z_VelocityMach = curPlane.getParameter(part.ParameterTypes.Z_VelocityMach, -1);
    double Z_AmbientAirTemperature = curPlane.getParameter(part.ParameterTypes.Z_AmbientAirTemperature, -1);
    2- I would like to add to the script also the right and left engine water temperature ( Bf 110 )...how can I do it? I mean, the ParamType is I_EngineWatTemp but how I let the script recognise/distinguish the left one, from the right one?

    3- The script works on a dedicated Lobby but not online on a public server...Is there a way to let it work online too? If yes, what I have to modify/edit in the script? ( I'm asking this because I would like to start to use a script instead of Virtual cockpit that drains precious resources anf FPS from my PC, if possible )

    4- Once I run the mission on the dedicated Lobby the yellow, capital on screen message is displayed at the top of the screen...How can I move it to the bottom of the screen instead? Is it possible to change the colour in which the writings are displayed? ( In medium blue for example )


    Below there is the script I'm currently using. If you want/can help me, please, in your reply report/post the script already correctly edited by you ( due to my inexperience in scripting ), thanks!

    Thanks in advance to all the ones that will help me!!! ;)

    The Script I'm Currently Using

    Code:
    using System;
    using System.Threading;
    using System.Collections.Generic;
    using maddox.game;
    using maddox.game.world;
    using maddox.GP;
    
    
    public class Mission : AMission
    {
    //flag
    bool done = false;
    
    //Create Stream
    System.IO.StreamWriter sw;
    
    //Strings
    string str_log = System.String.Empty;
    string str_hud = System.String.Empty;
    
    //Create Log File
    System.IO.FileInfo fi = new System.IO.FileInfo("C:\\FLIGHT_TEST_DATA.CSV");
    
    //Script Main
    public override void OnTickGame()
    {
    //Init Ticker
    base.OnTickGame();
    
    //loop rate set to ~1/30th of a second, i.e. 30 ticks = ~1 second
    if (Time.tickCounter() % 30 == 1)
    {
    //Get player aircraft
    AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft;
    
    if (curPlane != null)
    {
    //Instrumentation - Machine Spatial
    double I_VelocityIAS = curPlane.getParameter(part.ParameterTypes.I_VelocityIAS, -1);
    double I_Altitude = curPlane.getParameter(part.ParameterTypes.I_Altitude, -1);
    double I_Variometer = curPlane.getParameter(part.ParameterTypes.I_Variometer, -1);
    double I_MagneticCompass = curPlane.getParameter(part.ParameterTypes.I_MagneticCompass, -1);
    double A_ElevatorTrim = curPlane.getParameter(part.ParameterTypes.A_ElevatorTrim, -1);
    
    //Parameters - Machine Spatial
    double Z_Overload = curPlane.getParameter(part.ParameterTypes.Z_Overload, -1);
    double Z_AltitudeAGL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeAGL, -1);
    double Z_AltitudeMSL = curPlane.getParameter(part.ParameterTypes.Z_AltitudeMSL, -1);
    double Z_VelocityIAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityIAS, -1);
    double Z_VelocityTAS = curPlane.getParameter(part.ParameterTypes.Z_VelocityTAS, -1);
    double Z_VelocityMach = curPlane.getParameter(part.ParameterTypes.Z_VelocityMach, -1);
    double Z_AmbientAirTemperature = curPlane.getParameter(part.ParameterTypes.Z_AmbientAirTemperature, -1);
    
    //Game Time
    double dtime = Time.current();
    
    //Log Header
    if (done == false)
    {
    //Write Header
    sw = fi.AppendText();
    sw.WriteLine("TIME;HEADING;ALTITUDE;IAS;VARIOMETER;ELEVATOR_TRIM;TEMP");
    sw.Close();
    done = true;
    }
    
    //Log Data
    str_log = dtime.ToString("0.00") + ";" + I_MagneticCompass.ToString("0.00") + ";"
    +I_Altitude.ToString("0.00") + ";"
    +I_VelocityIAS.ToString("0.00") + ";"
    +I_Variometer.ToString("0.00") + ";"
    +A_ElevatorTrim.ToString("0.00") + ";"
    +Z_AmbientAirTemperature.ToString("0.00"); //TEMP
    
    sw = fi.AppendText();
    sw.WriteLine(str_log);
    sw.Close();
    
    //Display HUD
    GamePlay.gpHUDLogCenter("TIME: " + dtime.ToString("0.00") + 
    " HEADING: " + I_MagneticCompass.ToString("0.00") +
    " ALTITUDE: " + I_Altitude.ToString("0.00") + 
    " IAS: " + I_VelocityIAS.ToString("0.00") + 
    " VARIOMETER: " + I_Variometer.ToString("0.00") +
    " ELEVATOR_TRIM: " + A_ElevatorTrim.ToString("0.00") + 
    " TEMP: " + Z_AmbientAirTemperature.ToString("0.00")); 
    }
    }
    }
    }
    Last edited by Erpr.Gr.210_Mölders; Nov-09-2019 at 09:16.
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  2. #2
    ATAG Member ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    986
    Post Thanks / Like
    Total Downloaded
    908.31 MB

    Re: Help with a script needed

    1. There are only two more Z_Coordinates and Z_Orientation.

    2. curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 0); and curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 1);

    3. You are getting a reference to your aircraft with this code: AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft; You need to fetch that by player name.

    AiAircraft curPlane = null;
    List<Player> players = new List<Player>();
    foreach (Player p in GamePlay.gpRemotePlayers()) {
    if (p.Name() == "myName") {
    curPlane = p.Place() as AiAircraft;
    break;
    }
    }



    4. I don't think the HUD can be moved or the text colour changed.

  3. Likes Erpr.Gr.210_Mölders, danperin liked this post
  4. #3
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Re: Help with a script needed

    Quote Originally Posted by ATAG_Oskar View Post
    1. There are only two more Z_Coordinates and Z_Orientation.

    2. curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 0); and curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 1);

    3. You are getting a reference to your aircraft with this code: AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft; You need to fetch that by player name.

    AiAircraft curPlane = null;
    List<Player> players = new List<Player>();
    foreach (Player p in GamePlay.gpRemotePlayers()) {
    if (p.Name() == "myName") {
    curPlane = p.Place() as AiAircraft;
    break;
    }
    }



    4. I don't think the HUD can be moved or the text colour changed.
    Thank you very much for the info, their very usefull and appreciated!
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  5. #4
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Re: Help with a script needed

    Quote Originally Posted by ATAG_Oskar View Post
    1. There are only two more Z_Coordinates and Z_Orientation.

    2. curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 0); and curPlane.getParameter(part.ParameterTypes.I_Engine WatTemp, 1);

    3. You are getting a reference to your aircraft with this code: AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft; You need to fetch that by player name.

    AiAircraft curPlane = null;
    List<Player> players = new List<Player>();
    foreach (Player p in GamePlay.gpRemotePlayers()) {
    if (p.Name() == "myName") {
    curPlane = p.Place() as AiAircraft;
    break;
    }
    }



    4. I don't think the HUD can be moved or the text colour changed.
    In the current script where I have to put the part you submitted....at the beginning of it?

    My online tag-name is Erpr.Gr.210_Mölders...by fetching by player name, you mean that I have to use it to recall my plane?

    If possible, please, post the script I've reported in the first post ( The Script I'm Currently Using ) already edited with the part about engine water temperatures and the part to let it work on a online server ( or if some benevolent soul can do it ), because, as said I'm almost a full nerd in scripting so this is already at the limit of my " scripting capabilities ", sorry...This almost start to sound as Aramaic to me... )
    Last edited by Erpr.Gr.210_Mölders; Nov-09-2019 at 13:38.
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  6. #5
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Re: Help with a script needed

    Quote Originally Posted by ATAG_Oskar View Post

    3. You are getting a reference to your aircraft with this code: AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft; You need to fetch that by player name.

    AiAircraft curPlane = null;
    List<Player> players = new List<Player>();
    foreach (Player p in GamePlay.gpRemotePlayers()) {
    if (p.Name() == "myName") {
    curPlane = p.Place() as AiAircraft;
    break;
    }
    }


    I have attempted to include the part that you have reported above to the script several times and the script stopped working every time ( so I'm surely making something wrong here! )

    Let's try a different approach...

    The original section of the script of interest is this ( Quoted the section of interest and the following one ):

    Code:
    //Get player aircraft
    AiAircraft curPlane = GamePlay.gpPlayer().Place() as AiAircraft;
    
    if (curPlane != null)
    {
    //Instrumentation - Machine Spatial
    double I_VelocityIAS = curPlane.getParameter(part.ParameterTypes.I_VelocityIAS, -1);
    double I_Altitude = curPlane.getParameter(part.ParameterTypes.I_Altitude, -1);
    double I_Variometer = curPlane.getParameter(part.ParameterTypes.I_Variometer, -1);
    double I_MagneticCompass = curPlane.getParameter(part.ParameterTypes.I_MagneticCompass, -1);
    Can you please provide me the complete section named " //Get player aircraft " edited exactly as it should be done so to have the script until this point correctly working? Thanks!
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  7. #6
    Team Fusion ATAG_Noofy's Avatar
    Join Date
    Feb 2019
    Location
    https://w3w.co/chat.hisses.lofty
    Posts
    2,602
    Post Thanks / Like
    Total Downloaded
    1.25 GB

    Re: Help with a script needed

    What would be interesting to be able to do is have this info displayed in a corner of the screen (or in an info window) while flying:

    Heading(mag)
    Velocity(IAS)
    Altitude(ASL)
    Vario(+/- m/s or ft/min)

    Any idea where to look for that? Any existing scripts?
    Last edited by ATAG_Noofy; Nov-10-2019 at 03:56.
    Gigabyte Z390 UD | i7 9700K @3.60GHz | 16.0 GB | Windows 10 Pro 64-Bit | NVIDIA GeForce GTX 1070 Ti
    TM Warthog HOTAS | Saitek pro rudder pedals | TrackIR 5 | TeamSpeak 3.3.2 | TS Notifier 1.6.0h

  8. #7
    Ace Erpr.Gr.210_Mölders's Avatar
    Join Date
    Dec 2015
    Location
    Italy
    Posts
    2,452
    Post Thanks / Like
    Total Downloaded
    1,002.26 MB

    Re: Help with a script needed

    Quote Originally Posted by ATAG_Noofy View Post
    What would be interesting to be able to do is have this info displayed in a corner of the screen (or in an info window) while flying:

    Heading(mag)
    Velocity(IAS)
    Altitude(ASL)
    Vario(+/- m/s or ft/min)

    Any idea where to look for that? Any existing scripts?
    Check here: https://simhq.com/forum/ubbthreads.p...-s#Post3347984

    This one, differently from the one I'm speaking here in this thread, is displayed in a info window
    Visit the Robert Mölders Facebook Group ( Left-click on the red link on the left to open the relative page! )
    Visit the Robert Mölders YouTube Channel ( Left-click on the red link on the left to open the relative page! )
    *Important Note: You can also open the Robert Mölders Facebook Group page by clicking directly on my signature image


    My PC specs
    Windows 10 Pro 64 bit ~ Intel Core i7-7700K 4.2GHz 8MB Cache Quad core
    ASUS ROG STRIX Z270H GAMING Motherboard, Socket 1151 ATX, Dual M.2, USB 3.1 Type-C ~ MSI GeForce GTX 1080 TI Gaming X 11G Graphic Card PCIE 3.0, 11 GB, GDDR5X 352 bit, 11.01 GHz, 1569 MHz
    Samsung MZ-V6E250BW SSD 960 EVO, 250 GB, M.2, NVMe ~ Western Digital WD Caviar Blue 2TB 64MB Cache, WD20EZRZ (64MB Cache) ~ Enermax Liqmax II 240 (ELC-LMR240S-BS)
    Corsair CMK16GX4M2B3000C15 Vengeance LPX RAM 16 GB, 2x8 GB, DDR4, 3000 MHz, CL15 ~ EVGA SuperNOVA GQ PSU 750W ~ NZXT CA-N450W-M1 Case for Gaming PC, Black
    LG 49UK6200PLA TV 49" 4K UltraHD, IPS Display, 4096 x 2160, Active HDR, Multitasking ~ LG 27UD68P Monitor 27" 4K UltraHD LED IPS, 3840 x 2160, AMD FreeSync, Multitasking
    Thrustmaster T.16000M FCS Joystick ~ Thrustmaster TWCS Throttle ~ Thrustmaster TFRP Pedals

  9. Likes ATAG_Noofy liked this post

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •