Results 1 to 18 of 18

Thread: Question

  1. #1
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Question

    How can i have scar check if a certain arrow key is pressed, then start a procedure?

  2. #2
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    I'm not entirely sure, but I think you can just use:

    SCAR Code:
    begin
      if (IsKeyDown(key)) then
      blah blah blah.
    end;

    If not, then I know that you can use:

    SCAR Code:
    begin
      if (IsFKeyDown(integer for Fkey)) then
      blah blah blah.
    end;

  3. #3
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    IsKeyDown(VK_RIGHT); RIGHT can be RIGHT, LEFT, UP, or DOWN.

  4. #4
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

  5. #5
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I made a case for it, for all the keys, but I accidentally deleted it Sowwy </3

    By the by, open SCAR, F1. It has taught me a lot For example,

    function IsArrowDown(Num: Byte): Boolean;
    Checks if arrow key is down. Num corresponds to 0 = up, 1 = right, 2 = down, 3 = left.

    I feel special.

    SCAR Code:
    var
      i: Integer;
     
    begin
      repeat
        for i := 0 to 3 do
          if(IsArrowDown(i))then
            case i of
              0: begin
                   ClearDebug;
                   Writeln('Up key is down');
                 end;
              1: begin
                   ClearDebug;
                   Writeln('Right key is down');
                 end;
              2: begin
                   ClearDebug;
                   Writeln('Down key is down (ha ha ;))');
                 end;
              3: begin
                   ClearDebug;
                   Writeln('Left key is down');
                 end;
            end;
      until(IsFKeyDown(12));
    end.

    I'm not liking it because it deletes it and redoes it really fast so it's hard to read, I have an idea though

    Oh well, I messed it up too much You get the idea though
    Last edited by ian.; 05-02-2009 at 02:09 PM.

  6. #6
    Join Date
    Mar 2009
    Location
    About six feet off the ground.
    Posts
    95
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    99_: Not sure, but I tried one as well...
    SCAR Code:
    {.include srl/srl.scar}
    var
      i: Integer;

    procedure InBetween; //What to do in between keys
    begin
      while not IsArrowDown(0) or IsArrowDown(1) or IsArrowDown(2) or IsArrowDown(3) do
        Wait(10);
    end;

    procedure WhichArrow;
    begin
      for i := 0 to 3 do
        if(IsArrowDown(i))then
          case i of
            0: begin
                 ClearDebug;
                 WriteLn('Up key is down.');
               end;
            1: begin
                 ClearDebug;
                 WriteLn('Right key is down.');
               end;
            2: begin
                 ClearDebug;
                 WriteLn('Down key is down.');
               end;
            3: begin
                 ClearDebug;
                 WriteLn('Left key is down.');
               end;
            end;
    end;

    procedure Looping(TimesToLoop: Integer);
    var
      Times: Integer;
    begin
    Times := 0;
      repeat
        WhichArrow;
        InBetween;
        Inc(Times);
      until((Times = TimesToLoop) or (IsFKeyDown(12)))
    end;

    procedure MainLoop;
    begin
      SetupSRL;
      Looping(5);
    end;

    begin
      MainLoop;
    end.
    ~Zeek
    Last major script: November 2009
    Attempted to rejoin: January 2011
    Rejoining: [][][][][]
    Current task: writing basic alching script

  7. #7
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    zeeky111, yours doesn't work, sorry. I love that you're learning more though <3

  8. #8
    Join Date
    Mar 2009
    Location
    About six feet off the ground.
    Posts
    95
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ha. Crap.
    Thanks, though. Any suggestions on why?
    ~Zeek
    Last major script: November 2009
    Attempted to rejoin: January 2011
    Rejoining: [][][][][]
    Current task: writing basic alching script

  9. #9
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The InBetween procedure I think? Making other random things like I always do right now, so I'm kinda busy

    SCAR Code:
    var
      i, x, T, F: Integer;
     
    begin
      repeat
        repeat
          for i := 0 to 1000000 do
          begin
            if(RBool)then
            begin
              Inc(T);
            end else
            begin
              Inc(F);
            end;
          end;
        until(T + F >= 1000000);
        Inc(x);
      until(x >= 1000000);
        Writeln('True: '+IntToStr(T));
        Writeln('False: '+IntToStr(F));
    end.

    Gonna see how random a 50/50 chance is. 1,000,000,000,000,000,000 times. Ha ha ha ha ha
    Last edited by ian.; 05-02-2009 at 03:02 PM.

  10. #10
    Join Date
    Mar 2009
    Location
    About six feet off the ground.
    Posts
    95
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Kk, no problem.
    ~Zeek
    Last major script: November 2009
    Attempted to rejoin: January 2011
    Rejoining: [][][][][]
    Current task: writing basic alching script

  11. #11
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No problem Did you see my edit?

  12. #12
    Join Date
    Mar 2009
    Location
    About six feet off the ground.
    Posts
    95
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ha ha ha. You're right...
    Omg, I HAVE to run that.
    ~Zeek
    Last major script: November 2009
    Attempted to rejoin: January 2011
    Rejoining: [][][][][]
    Current task: writing basic alching script

  13. #13
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    =X This goes extremely slow.. SURPRISINGLY! I am gonna lower it to a trillion instead of a quintillion ha ha

    Actually, screw it. I'll trust it being 50/50. Ha ha

    True: 47363720
    False: 52646280
    Last edited by ian.; 05-02-2009 at 03:28 PM.

  14. #14
    Join Date
    Mar 2009
    Location
    About six feet off the ground.
    Posts
    95
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I ran it for 15 minutes and it still didn't finish so I moved on...
    [see attached files]
    EDIT: Use at own risk. Can cause SCAR to fully freeze. Filename is a misnomer.
    Last edited by zeeky111; 05-02-2009 at 04:26 PM.
    ~Zeek
    Last major script: November 2009
    Attempted to rejoin: January 2011
    Rejoining: [][][][][]
    Current task: writing basic alching script

  15. #15
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    I made a case for it, for all the keys, but I accidentally deleted it Sowwy </3

    By the by, open SCAR, F1. It has taught me a lot For example,

    function IsArrowDown(Num: Byte): Boolean;
    Checks if arrow key is down. Num corresponds to 0 = up, 1 = right, 2 = down, 3 = left.

    I feel special.

    SCAR Code:
    var
      i: Integer;
     
    begin
      repeat
        for i := 0 to 3 do
          if(IsArrowDown(i))then
            case i of
              0: begin
                   ClearDebug;
                   Writeln('Up key is down');
                 end;
              1: begin
                   ClearDebug;
                   Writeln('Right key is down');
                 end;
              2: begin
                   ClearDebug;
                   Writeln('Down key is down (ha ha ;))');
                 end;
              3: begin
                   ClearDebug;
                   Writeln('Left key is down');
                 end;
            end;
      until(IsFKeyDown(12));
    end.

    I'm not liking it because it deletes it and redoes it really fast so it's hard to read, I have an idea though

    Oh well, I messed it up too much You get the idea though
    Exactly what i needed!

  16. #16
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I feel special now. Ha ha but I guess that's why I got my bear <3 desnob, need anymore help? Add me on MSN panic._@live.com

  17. #17
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    I feel special now. Ha ha but I guess that's why I got my bear <3 desnob, need anymore help? Add me on MSN panic._@live.com
    i'll create a new msn lol. Haven't been on msn for ages; so now i forgot the pass.

  18. #18
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Mmkay.

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
  •