Results 1 to 4 of 4

Thread: Detect a key press

  1. #1
    Student Pilot
    Join Date
    Jun 2014
    Location
    Nr Shrewsbury
    Posts
    12
    Post Thanks / Like
    Total Downloaded
    2.5 KB

    Detect a key press

    Hi all - just getting my head round scripting at the moment and I am wanting to build a little training mission where instructions came up on screen so I have started building a list of messages i.e.

    Code:
    int intArrayMsg = 0;
    
    var listStrMsg = new List<string>(); //List that will hold all the messages
    //Add each message to the list
    listStrMsg.Add("Good morning pilot, today you are going to have a lesson on starting and taking off in the Hurricane.");
    listStrMsg.Add("To display the next message press the F12 key.");
    listStrMsg.Add("And to display the previous message press the F11 key.");
    
    //Display the first message
    GamePlay.gpHUDLogCenter(listStrMsg[intArrayMsg]);
    So now I need to know if the F11 or F12 keys have been clicked to display the previous or next message. I will then be able to call a different function to display the appropriate message on screen.

    Many thanks in advance
    Glyn
    Last edited by GlynD; Jan-29-2022 at 16:00.

  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: Detect a key press

    I would suggest you use the mission menu and a briefing to do what you want.

    The briefing can describe the mission and how the menu works.

    Then use code to build a mission menu.

    Check this mission for how to create a mission menu.

    https://theairtacticalassaultgroup.c...downloadid=182

  3. #3
    ATAG_Colander's Avatar
    Join Date
    Nov 2011
    Location
    Bir Tawil
    Posts
    11,128
    Post Thanks / Like
    Total Downloaded
    255.73 MB

    Re: Detect a key press

    Yeah, I don't think is possible to obtain key presses in a simple way (i.e. without some nasty hack). Your safest bet is using the menu as Oskar says or just use a timer and show the next message after X seconds automatically.

  4. #4
    Student Pilot
    Join Date
    Jun 2014
    Location
    Nr Shrewsbury
    Posts
    12
    Post Thanks / Like
    Total Downloaded
    2.5 KB

    Re: Detect a key press

    Thanks very much for the replies chaps. Will take a look at the mission menu next. I was hoping to be able to make it a bit more interactive by being able to step backwards and forwards though the messages. Will also go hunting for some timer code on here.

    Cheers
    Glyn

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
  •