• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

ChatGPT and MSFS developement

Messages
236
Country
switzerland
Surely you must all heard of ChatGPT, which has taken the internet by storm in a very short time. I found it very useful to help coding, so I tried asking this question:

This is a javascript function that displays a text message using CoherentGT:
JavaScript:
function showText( msg, timeout, posXRel = 40, posYRel = 40 )
{
    Coherent.trigger("SHOW_TOOLTIP", 0, msg, posXRel, posYRel, msg.length * 100);
    if( timeout > 0 )
    {
        setTimeout( () => { Coherent.trigger("HIDE_TOOLTIP", 0); }, timeout * 1000 )
    }
}
Can you add a FIFO queue to use this function in a way that multiple calls to this function will not overlap, to allow all messages to be seen ?


And sure enough, after 1 second, I've got this:


Yes, you can add a FIFO queue to this function to prevent overlapping messages. Here's an example of how you could implement the queue:
JavaScript:
const messageQueue = [];
let isShowingMessage = false;

function showText(msg, timeout, posXRel = 40, posYRel = 40) {
  messageQueue.push({ msg, timeout, posXRel, posYRel });

  if (!isShowingMessage) {
    showNextMessage();
  }
}

function showNextMessage() {
  if (messageQueue.length === 0) {
    isShowingMessage = false;
    return;
  }

  isShowingMessage = true;
  const { msg, timeout, posXRel, posYRel } = messageQueue.shift();

  Coherent.trigger("SHOW_TOOLTIP", 0, msg, posXRel, posYRel, msg.length * 100);

  if (timeout > 0) {
    setTimeout(() => {
      Coherent.trigger("HIDE_TOOLTIP", 0);
      showNextMessage();
    }, timeout * 1000);
  } else {
    showNextMessage();
  }
}
This implementation uses a global messageQueue array and a global isShowingMessage flag to keep track of the state of the messages. When the showText function is called, it pushes the message and its properties to the messageQueue. If a message is not currently being shown, the showNextMessage function is called. The showNextMessage function checks if there are any messages in the queue, if there are none it sets the isShowingMessage flag to false, if not it pops the first message in the queue, shows it by triggering the coherent.js events and starts a timeout. Once the timeout is done, it calls hide_tooltip event, and calls showNextMessage again to show next message in the queue if any.

I just copied the code as it was, replacing my example function with this output, fired up MSFS, tried the new message queue and it worked at the first try! Sure, this is not a very complex function, and I could have written it myself, but surely not in a 1 second, and it's impressive how ChatGPT understood precisely what I asked for, at the first try.

All the more interesting, considering Microsoft is heavily invested in OpenAI ( developers of ChatGPT and Dall-E ) and there are some rumours that is considering buying it altogether. A proper integration in Visual Studio or VS Code seems the next logical step.
 

rhumbaflappy

Administrator
Staff member
Resource contributor
Messages
5,424
Country
us-wisconsin
This is alternately useful, amazing, and scary.
I asked:
In C# how do I drag and drop a folder onto a winForm and get the foldername

ChatGPT replied:
To enable drag-and-drop functionality for a folder onto a WinForm in C#, you need to set the AllowDrop property of the Form to true and handle the DragEnter and DragDrop events.

Here's an example of how you can do this:



C#:
// In the constructor of the Form
this.AllowDrop = true;
this.DragEnter += new DragEventHandler(Form1_DragEnter);
this.DragDrop += new DragEventHandler(Form1_DragDrop);

private void Form1_DragEnter(object sender, DragEventArgs e)
{
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
    {
        e.Effect = DragDropEffects.Copy;
    }
    else
    {
        e.Effect = DragDropEffects.None;
    }
}

private void Form1_DragDrop(object sender, DragEventArgs e)
{
    string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
    // you can use the first element of the array since only one folder can be dragged
    string folderName = Path.GetFileName(files[0]);
    // do something with the folderName
}
In the above example, the Form1_DragEnter method is used to check if the data being dragged is a file or folder, and the Form1_DragDrop method is used to handle the actual drop event. The string[] files variable will contain the path of the folder being dragged and you can use Path.GetFileName() method to get the folder name.

This is actually how to do this... and you get the result much quicker than endless hours of Googling to find the answer.
 

RicherSims

Resource contributor
Messages
552
Country
dominica
Holy S%!t!
Makes me wonder if now is either the worst time or absolute best time to try to switch my day job to become a programmer!
This AI is either going to make my job obsolete very quickly, or make it a hell of a lot easier!
 
Messages
33
Country
norway
I had imported models from many different sources into blender and had a problem that they all had different names for their respective uv map, giving weird results when merging the models together.

I asked the bot to write a script to rename all selected objects' uvmaps to 'UVmap', and surely it worked on the first try!

Then I had to make LOD's for ~8000 objects.
ChatGPT wrote me a small script to merge all files with the same texture, apply a decimate modifier and apply.

Probably very simple scripts for programmers, but as a simple 3d modeller I wouldn't even know where to start.

Saved me many hours of work!!

Sent fra min SM-G996B via Tapatalk
 

=rk=

Resource contributor
Messages
3,799
Country
us-washington
How do I merge my current scenery project with an existing addon airport using Asobo MSFS DevMode editor?

To merge your current scenery project with an existing addon airport using the Asobo MSFS DevMode editor, you will need to follow these steps:
  1. Open your current scenery project in the DevMode editor.
  2. In the "Scenery Library" tab, click on the "Import" button.
  3. Browse to the location of the existing addon airport and select the files you want to import.
  4. Click the "Open" button to import the addon airport into your project.
  5. In the "Scenery Library" tab, you can now drag and drop the imported airport files to the position you want in the "Scenery Order" list.
  6. Use the "Build Scenery" option to rebuild the project.
Note that you may need to adjust the elevation of the imported airport to match the elevation of your project. You can do this by selecting the imported airport in the "Scenery Library" tab and using the "Elevation" tool in the "Terrain" tab to adjust the elevation. It's also important to note that in order to merge the scenery, you should have knowledge of the SDK and the structure of the scenery packages, otherwise it's not recommended to try to merge them on your own, as it may cause issues.


But when I type, "can you just do it for me?"


blinking-cursor-gif-4.gif

I only get a flashing cursor. I should probably just wait 2 weeks, or do you guys think hand produced reproductions of anything in the real world, from Friendship 7 to Notre Dame Cathedral, will have any value whatsoever, in the very near future?
 

=rk=

Resource contributor
Messages
3,799
Country
us-washington

I've gotten that warning and I just refresh. I literally, just now got a generated response.

If you notice, the questions are arranged as "conversations," which implies continuity between replies. Presumably this would allow questioners to drill down on queries, without having to rephrase subsequent questions as more clearly stated versions of the previous question. To me this reveals the weakness of ChatGPT, because as they say, results vary. In one of my conversations, I pressed ChatGPT to elaborate on its insistence that I could add sounds to MSFS scenery objects and ultimately it spewed out a series of fantasies, because apparently, ChatGPT has been prevented from replying, "no."

Here is one of the generated replies, after informing me I could add sounds to buildings, I insisted ChatGPT elaborate, so it fibbed:

The built-in sound system in Microsoft Flight Simulator (MSFS) allows you to assign different sounds to different types of objects, such as aircraft, buildings, and vehicles. To assign a sound to a building, you can use the following steps:

  1. Open the MSFS settings menu by pressing the "Menu" button on your controller or keyboard.
  2. Select "Options" and then choose "Sound".
  3. In the Sound menu, you will see a list of different types of sounds that can be assigned, such as "Aircraft", "Buildings", "Vehicles", etc. Select "Buildings".
  4. In the Buildings Sound settings, you will see a list of different sound options that can be assigned to buildings. These include "Interior Sound", "Exterior Sound", and "Wind Sound".
  5. Select the type of sound you want to assign to the building. For example, if you want to assign a sound to the interior of the building, select "Interior Sound".
  6. Under the "Interior Sound" option, you will see a list of different sounds that can be assigned. You can choose from the default sounds that come with MSFS or you can also add your own custom sounds by clicking on the "+" button and browsing for the sound file on your computer.
  7. Adjust the volume and distance of the sound.
  8. Apply the changes and exit the sound settings.
Before I got my final answer, ChatGPT sidestepped into a distinction between custom and default and before you go and check, these settings do not exist, I don't even know how an AI could lie so elaborately. Presumably this false information is quoted from somewhere, but the breathless priority of providing positive results, over actionable results, is almost kitschy. Like Pinocchio, ChatGPT is overly eager to please, be advised.
 
Messages
809
Country
australia
Okay I could have used this years ago... Anyone know if this would work? lol I don't have my installer code anymore...

Code:
Input:
write a php script for users to authenticate their software

Output:
<?php
    session_start();

    // Connect to the database
    $conn = mysqli_connect("host", "username", "password", "database");

   // Check if the user has submitted their credentials
    if (isset($_POST['username']) && isset($_POST['password'])) {
        // Sanitize the input
        $username = mysqli_real_escape_string($conn, $_POST['username']);
        $password = mysqli_real_escape_string($conn, $_POST['password']);

        // Check if the user exists in the database
        $query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
        $result = mysqli_query($conn, $query);
        if (mysqli_num_rows($result) > 0) {
            // Login successful
            $_SESSION['username'] = $username;
            header("Location: dashboard.php");
            exit();
        } else {
            // Login failed
            echo "Invalid username or password";
       }
    }
 ?>

 <html>
<head>
    <title>User Authentication</title>
</head>
<body>
    <form action="" method="post">
        <label for="username">Username:</label>
        <input type="text" name="username" id="username">
        <br>
        <label for="password">Password:</label>
        <input type="password" name="password" id="password">
        <br>
        <input type="submit" value="Login">
    </form>
 </body>
 </html>

EDIT: Okay I've been working on a scenery project that I've duplicated stuff in the SDK tools but it's added (Copy X) to the ends of the file names. I don't have python installed but this is what I asked:

in this xml remove all references to copy that are in ()

Response:
To remove all references in parentheses that say "copy from this XML," you can use a regular expression to search for the specific text pattern and replace it with an empty string. The exact code will depend on the programming language you are using and the framework or library you are using to manipulate the text.

Here is an example of how you might do this in Python using the re library:

Code:
import re

# original text
text = "This is some text (copy from this XML) with references in parentheses."

# regular expression to match the text pattern
pattern = r"\(copy from this XML\)"

# use the re.sub() function to replace the matched text with an empty string
text = re.sub(pattern, "", text)

print(text)

Thought this might be useful if anyone wants to clean up their XML
 
Last edited:
Messages
236
Country
switzerland
Like Pinocchio, ChatGPT is overly eager to please, be advised.

Sure and, once you start using it, you know how to make questions made to confuse it on purpose. For example, I tried asking this:

why Napoleon lost at Austerlitz ?

And got a perfectly sensible reply, which of course is completely wrong as well:

Napoleon Bonaparte lost the Battle of Austerlitz on December 2, 1805, due to a combination of factors. One reason was that the Russian and Austrian armies were able to successfully coordinate their actions against Napoleon's forces, despite initial setbacks. Additionally, Napoleon's plan for the battle was overly complicated and relied on the cooperation of his subordinates, which did not always happen. Finally, the Russian and Austrian armies were able to take advantage of the terrain and weather conditions to launch a surprise attack on Napoleon's right flank, which helped to turn the tide of the battle.

So I tried this:

are you sure Napoleon lost at Austerlitz ?

I apologize, I made an error in my previous answer. Napoleon Bonaparte actually won the Battle of Austerlitz, also known as the Battle of the Three Emperors, on December 2, 1805. This battle was fought against the Russian Empire and the Austrian Empire, and it was a significant victory for Napoleon and his Grande Armée. The battle is considered one of Napoleon's greatest victories and it is often referred to as his "greatest triumph". It marked the defeat of the Third Coalition against the French Empire, and it was a turning point in the Napoleonic Wars.
 
Messages
236
Country
switzerland
And it seems to be highly confused about who won World War 1, although in the end it decided it was a "stalemate"

Explain some reasons why Germany won WW1

Germany won World War I for several reasons. One major reason was their military strategy, which included the use of submarines to cut off supplies to the Allies and the implementation of the "Schlieffen Plan" for a quick defeat of France. Additionally, Germany had strong alliances with Austria-Hungary and the Ottoman Empire, which helped to fight on multiple fronts. The entry of the United States into the war also played a role, as their resources and manpower greatly strengthened the Allied forces and put pressure on Germany. Ultimately, the war ended in a stalemate and both sides were forced to negotiate a peace treaty, with the Treaty of Versailles being imposed on Germany, which many historians believe led to the rise of Hitler and ultimately World War II.

However, the trick didn't work with WW2:

Explain some reasons why Germany won WW2

Germany did not win World War II, they were defeated by the Allied powers in 1945. There are several reasons why the Axis powers, led by Germany, lost the war:
  1. Superior resources: The Allied powers, particularly the United States, had much greater industrial and economic resources than the Axis powers. This allowed them to produce more weapons, vehicles, and supplies, which gave them a significant advantage on the battlefield.
  2. Strategic mistakes: The German leadership made several strategic mistakes, such as invading the Soviet Union and declaring war on the United States. These decisions stretched German resources thin and allowed the Allies to focus their efforts on one front at a time.
  3. Strong Allied leadership: The Allied powers were led by highly capable leaders such as Franklin D. Roosevelt and Winston Churchill, who were able to effectively coordinate the efforts of their respective nations and military forces.
  4. Turning point in the Eastern front: The Eastern front was the main theater of the war, and the tide turned against the Axis powers when the Soviet Union was able to turn the tide of the war with the Battle of Stalingrad and the counter-offensive that followed.
  5. The entry of the US in the war: The entry of the United States into the war in December 1941 provided the Allies with a significant increase in manpower and resources, which helped tip the balance in their favor.
 
Messages
70
Country
australia
How do I merge my current scenery project with an existing addon airport using Asobo MSFS DevMode editor?




But when I type, "can you just do it for me?"


blinking-cursor-gif-4.gif

I only get a flashing cursor. I should probably just wait 2 weeks, or do you guys think hand produced reproductions of anything in the real world, from Friendship 7 to Notre Dame Cathedral, will have any value whatsoever, in the very near future?
I found that ChatGPT is sometimes confused by "?"
I typed your Q and received the same answer. And then I typed(pasted actually)

"can you just do it for me" (without the quotes AND the ?) it replied:

I'm sorry, I am a language model and I do not have the capability to perform tasks within the game. I can provide you with instructions, but you will need to follow them within the game. If you have any issues with the process, feel free to ask me any further questions.

HTH
 
Top