Results 1 to 6 of 6

Thread: KeyCodes?

  1. #1
    Join Date
    Mar 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default KeyCodes?

    Hi, this is a problem thats frustrated me for a while.

    I need to figure out how to script SCAR to send a key (anything, but in this case the keys 's' 'd' and 'a') and then hold it down, until I tell SCAR to release it.

    I've never been able to do this because I can't figure out what the help file is talking about when it explains these commands:

    procedure KeyDown(Key: Byte); - simulates pushing a key.

    procedure KeyUp(Key: Byte); - simulates releasing a key.

    procedure KeyDownSilent(Key: Byte); - simulates pushing a key in silent mode.

    procedure KeyUpSilent(Key: Byte); - simulates releasing a key in silent mode.

    function GetKeyCode(Key: Char): Byte; - get keyboard code of a character.
    As far as I can tell I need to use GetKeyCode to find out the Byte value of the key's that I want to press, but I can't figure out the syntax of that command.

    I essentially need it to work like this:
    Code:
    GetKeyCode(Key: a)Byte: x;
    where "Byte:a" would put the Byte value for the 'a' key into an integer variable (in this case 'x').

    I'm sure I'm just missing something really easy, but this has been troubling me for some time now. I would greatly appreciate any light you can shed on this matter for me.

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

  3. #3
    Join Date
    Mar 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well I guess that works, thanks.

    Though it would still be nice to know how to use the GetKeyCode function for myself.

  4. #4
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    keyup(getkeycode('m'));

    or

    var MyInt:integer; //byte is an integer

    begin
    MyInt:=getkeycode('m'); //char is a string
    keyup(myint);
    end.


    or

    writeln(inttostr(getkeycode('m'));
    you see the number that it prints out and use that

  5. #5
    Join Date
    Mar 2007
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesome, everything I was trying to figure out

    Thanks a bunch.

  6. #6
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Mopar

    Here is a direct link to Mopar if anybody wants it. For kyles key code tut


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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