Results 1 to 6 of 6

Thread: HoldArrows

  1. #1
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default HoldArrowKeys + RotateCamera

    I noticed that I couldn't find a function to hold down more than one arrow key at once.
    Cuz' a lot of times in real life I hold down more than one arrow key

    Didn't know if there is one of these already or not but I couldn't find one..
    So I made some arrow using procedures

    Remember that just like in the SCAR functions:
    0 = UP
    1 = RIGHT
    2 = DOWN
    3 = LEFT

    SCAR Code:
    Procedure HoldArrowKeys(Arrows: TIntegerArray; Time: Integer);
    {will hold all ARROWS simultaneously for amount of TIME in milliseconds
        0 = UP
        1 = RIGHT
        2 = DOWN
        3 = LEFT  }

    var
      i : Integer;
    begin
      for i := 0 to High(Arrows) do
      begin
        if (Arrows[i] = 3) then IncEx(Arrows[i], 34) else
          IncEx(Arrows[i], 38);
        KeyDown(Arrows[i]);
      end;
      Wait(Time);
      for i := 0 to High(Arrows) do
        KeyUp(Arrows[i]);
    end;



    Procedure RotateCamera(Limited: Boolean);
    //randomly rotates camera angle
    var
      Rand : Integer;
    begin
      if Limited then Rand := 4
        else Rand := 8;
      Case Random(Rand) of
        0 : HoldArrowKeys([0, 1], RandomRange(953, 1463)); //up-right
        1 : HoldArrowKeys([0, 3], RandomRange(953, 1463)); //up-left
        2 : HoldArrowKeys([1, 2], RandomRange(953, 1463)); //down-right
        3 : HoldArrowKeys([2, 3], RandomRange(953, 1463)); //down-left
       
        4 : HoldArrowKeys([0], RandomRange(953, 1463)); //up
        5 : HoldArrowKeys([1], RandomRange(953, 1463)); //right
        6 : HoldArrowKeys([2], RandomRange(953, 1463)); //down
        7 : HoldArrowKeys([3], RandomRange(953, 1463)); //left
      end;
    end;
    EXAMPLES:
    SCAR Code:
    begin
      HoldArrowKeys([0, 1], 1000);
        //will hold up and right arrows for 1 second
      HoldArrowKeys([2, 3], 1000);
        //will hold down and left arrows for 1 second
     
      RotateCamera(True);
        //randomly moves camera angle using ONLY "double" arrows (more than one)
      RotateCamera(False)
        //randomly moves camera angle using BOTH "double" or "single" arrows
    end.


  2. #2
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I like this function. Simple but effective
    Formerly known as Cut em2 it

  3. #3
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Duh nice one...just planned to make obj finder what changes camera angle while moving pointer to object...but how should I do that?

    KeyDown(X);
    MMouse
    KeyUp(X)

    ?

    Too complicated for me

    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  4. #4
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    KeyDown(X);
    MMouse
    KeyUp(X)
    I've made it once, though I don't think it was very complicated, but it isn't accurate/good enough for moving mouse to an object - I built it for antiban purposes.

    Anyways, if you want to look at it, search for "CompassMMouse".

  5. #5
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    KeyUp and KeyDown with numbers don't always work that well. But these do:
    SCAR Code:
    KeyDown(VK_UP)
    KeyDown(VK_DOWN)
    KeyDown(VK_LEFT)
    KeyDown(VK_RIGHT)
    That way, you should also be able to hold 2 at the same time.

    -Knives

  6. #6
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by King of Knives View Post
    KeyUp and KeyDown with numbers don't always work that well. But these do:
    SCAR Code:
    KeyDown(VK_UP)
    KeyDown(VK_DOWN)
    KeyDown(VK_LEFT)
    KeyDown(VK_RIGHT)
    That way, you should also be able to hold 2 at the same time.

    -Knives
    I originally had those..
    But I changed it

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
  •