Results 1 to 5 of 5

Thread: Cases with IsKeyDown?

  1. #1
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Cases with IsKeyDown?

    Ok, so I'm trying to make a 13372p34k converter, but I don't want to use a whole bunch of if...thens.

    I have this so far:

    SCAR Code:
    program New;
    {.include srl/srl.scar}

    begin
      setupsrl;
      repeat
        wait(100);
        Case IsKeyDown('') Of
        '3' : begin
        Keydown(8);
        Keyup(8);
        sendkeys('e');
        End;
      until false
    end.

    It's giving me a type mismatch, and i'm not how to fix it. Any help is appreciated.

    ~Sandstorm

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    IsKeyDown('') is not a function, it does not return anything. Thats why its giving you a type mismatch error.


  3. #3
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh. Duh. Why can I do this then?

    SCAR Code:
    If IsKeyDown('') Then

    Wait nevermind, I get it now, I'm just being slow today .

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    You could make a loop.
    Hup Holland Hup!

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

    Default

    Use this list
    http://www.moparisthebest.com/smf/in...ic,2894.0.html

    Loop through the numbers, and have a 1337 alphabet string. When you get to a key number that is down, subtract 65 from it, and TheString[TheNumber-65] should get you the corresponding letter in the 1337 alphabet.

    Edit: actually nevermind, that way doesn't help with spaces etc. Try it this way.
    SCAR Code:
    program New;
    var mystr,mystr2,mystr3:string;

    i,t:integer;
    begin
    mystr :='abcdefghijklmnopqrstuvwxyz ';
    mystr2:='4b[d3f9hijklmn0pqr5tuvwxyz ';


      repeat
        for i:=1 to 27 do
        begin
          if iskeydown(mystr[i]) then
          begin
            mystr3:=mystr3+mystr2[i];
            cleardebug;
            writeln(mystr3);
            t:=getsystemtime;
            repeat
              wait(1);
            until ((getsystemtime-t)>250)or(not iskeydown(mystr[i]));
          end;
        end;
      until isfkeydown(12);
    end.

    Or instead of a string, turn it into an array, so that you can have a single match up to a multiple, like V = \/.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. If(IsKeyDown)Then + Repeat
    By anonymity in forum OSR Help
    Replies: 6
    Last Post: 12-12-2008, 04:43 AM
  2. IsKeyDown
    By 666d3v1l666 in forum OSR Help
    Replies: 6
    Last Post: 08-29-2008, 11:34 AM
  3. iskeydown - need help
    By l33t_h4x0r in forum OSR Help
    Replies: 5
    Last Post: 12-16-2007, 11:31 PM
  4. What's IsKeyDown in C++ and how do I use it?
    By PwNZoRNooB in forum C/C++ Help and Tutorials
    Replies: 10
    Last Post: 08-14-2007, 05:49 AM

Posting Permissions

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