1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is there a C# Tutorial on how to read "Custom Mission Action"?

Discussion in 'SimConnect' started by radialronnie, 5/1/08.

  1. radialronnie

    radialronnie

    Joined:
    7/12/07
    Messages:
    120
    Country:
    unitedstates
    Is there a C# Tutorial on how to read "Custom Mission Action"?
    i searched the forum and even looked at EVERY simconect post!
    nu luck. if anybody could bive me some pointers i would be most gratefull.

    C#
  2. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,304
    Country:
    netherlands
    What do you mean with custom mission action here? Do you want to trigger an action from SimConnect while the mission is running? And why with SimConnect and not within a mission?
  3. jimkeir

    jimkeir

    Joined:
    7/6/07
    Messages:
    87
    Country:
    unitedkingdom
    Hi,

    I can't help for C# but I can give you some sample code for C++. It should be close enough that you can work out the differences.

    Code:
    void CALLBACK MyDispatchProcMA(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext)
    {
      SIMCONNECT_RECV_CUSTOM_ACTION *pCustomAction;
    
      // Check to see if this is a CustomAction
      switch(pData->dwID) {
        case SIMCONNECT_RECV_ID_CUSTOM_ACTION:
          // Yes. Get a pointer to the data
          pCustomAction = (SIMCONNECT_RECV_CUSTOM_ACTION *)pData;
          
          printf("Custom payload=\"%s\", WaitForCompletion = %s\n",
            pCustomAction->szPayLoad,
            pCustomAction->dwWaitForCompletion == 0 ? "False":"True");
          
          // Do something :)
          ProcessMyCustomAction(pCustomAction);
          
          // If the mission writer requested a confirmation, send it.
          if (pCustomAction->dwWaitForCompletion)
            SimConnect_CompleteCustomMissionAction(hSimConnect,pCustomAction->guidInstanceId);
    
          break;
      }
    }
    
    Cheers,
    Jim
  4. beatle

    beatle

    Joined:
    28/9/06
    Messages:
    324
    Country:
    us-virginia
    Hey Arno,

    You can have custom actions in a mission that are used to trigger a SimConnect client. What you do with that is up to the mission designer/SimConnect client author. I believe this is probably what the Embry-Riddle folks are using for their scoring system they were showing off at DevCon. I haven't actually used any of these myself yet, I only started doing any SimConnect related stuff a couple of months ago after I joined the ESP team (if you stopped by the MS booth at I/ITSEC, then you probably saw my demo app :-> )

    Possible things you could do, from a scoring system standpoint, would be to have triggers for various conditions (too low, too high, too fast, too slow, etc), and use those to subtract from a perfect score - that sort of thing. I'm sure there are lots of other things you could do with them, I'm just not sure what off the top of my head :->
  5. BASys

    BASys

    Joined:
    25/5/06
    Messages:
    1,247
    Country:
    scotland
    Hi Folks

    Tim -
    I realise you're only giving an example above,
    that can be achieved without using custom mission actions or SimConnect,
    just using counters,
    plus the droppable payload counter to display the score.

    Obviously though, neither shareable or storable.

    ATB
    Paul
  6. radialronnie

    radialronnie

    Joined:
    7/12/07
    Messages:
    120
    Country:
    unitedstates
    i would like to send info to my simconnect client from my mission via a "custom action" (thats what it's called)
  7. arno

    arno Administrator Staff Member FSDevConf team Resource contributor

    Joined:
    28/5/04
    Messages:
    21,304
    Country:
    netherlands
    Thanks Tim for the explanation, I did not really get that the original question was about this. I can indeed see that you can do interesting things with this.

    But as I am just learning missions and SimConnect myself as well, can't really answer it further :D.
  8. radialronnie

    radialronnie

    Joined:
    7/12/07
    Messages:
    120
    Country:
    unitedstates
    thanks Arno.
    I don't expect you to know everything.:D You know a lot as it is. (But knowledge is VERY great thing to have;))

Share This Page