Results 1 to 6 of 6

Thread: Help with holding keys down

  1. #1
    Join Date
    Nov 2008
    Location
    East bay -- California
    Posts
    91
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Help with holding keys down

    How do you set a key to held down , not just pressed once but held down for an amount of time because i dont want to have to spam my script with keydown(38) keyup(38)

    or

    could someone tell me how to ake a loop that spams that button only because i have more keys in my script and i dont want to spam them all btw here is the key spamming part of the script

    SCAR Code:
    KeyDown(9);
    KeyUp(9);
    wait(500);
    KeyDown(32);
    KeyUp(32);
    wait(500);
    KeyDown(9);
    KeyUP(9);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);;

    but i only want to spam this part

    SCAR Code:
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);


    (im using for a game where you need to hold down certain keys)

    All Help Appreciated !

  2. #2
    Join Date
    Jan 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey,

    I think you'll just have to spam your script with those.......
    Or there is another option !
    Make this:

    SCAR Code:
    Program New;

    Var
     //Something

    Const
     //Or whatever

    Procedure Buttons;
     Begin
      KeyDown ( 38 );
      KeyUp ( 38 );
      KeyDown ( 38 );
      KeyUp ( 38 );
      KeyDown ( 38 );
      KeyUp ( 38 );
     End;

    Procedure Main;
     Begin
      KeyDown ( 9 );
      KeyUp ( 9 );
      Wait ( 500 );
      KeyDown ( 32 );
      KeyUp ( 32 );
      Wait ( 500 );
      KeyDown ( 9 );
      KeyUp ( 9 );
      Repeat
       Buttons;
       Wait ( 300 + random ( 200 ) { Optional } );
      Until ( False ) //Endless loop try to avoid it
     End;

    Begin
     Main;
    End.

    Hope it helps!

    Fort Ash
    I was born to cheat on Hero

  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Quote Originally Posted by shadohead View Post
    How do you set a key to held down , not just pressed once but held down for an amount of time because i dont want to have to spam my script with keydown(38) keyup(38)

    or

    could someone tell me how to ake a loop that spams that button only because i have more keys in my script and i dont want to spam them all btw here is the key spamming part of the script

    SCAR Code:
    KeyDown(9);
    KeyUp(9);
    wait(500);
    KeyDown(32);
    KeyUp(32);
    wait(500);
    KeyDown(9);
    KeyUP(9);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);

    but i only want to spam this part

    SCAR Code:
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);
    KeyDown(38);
    KeyUp(38);


    (im using for a game where you need to hold down certain keys)

    All Help Appreciated !
    Try this:
    SCAR Code:
    procedure HoldAndReleaseKey;
    var
      a : integer;
    begin
      repeat
        KeyDown(38);
        KeyUp(38);
        A := A + 1;
      until (A > 3)
    end;

    Or you could just add it to what you have like this:
    SCAR Code:
    KeyDown(9);
    KeyUp(9);
    wait(500);
    KeyDown(32);
    KeyUp(32);
    wait(500);
    KeyDown(9);
    KeyUP(9);
    repeat
      KeyDown(38);
      KeyUp(38);
      A := A + 1;
    until (A > 3);

    Just add a variable a in your script. Hope this helps

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  5. #5
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Grrr you shut...Always one upping meh :/ lol

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  6. #6
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    As is allready seen in this thread the way to do is loops.

    If you are not sure how loops work read on for here or if you want more detail have a look at the tutorial island section on this form.

    There are 3 main types of looped used on scar.



    ScarScript:By Drunkenoldma
    Repeat</p><p> //Code Here</p><p> //Code Here</p><p>until { Watever }




    that basiclly tells it self it will repeat the loop until something, you can repeat , a time , until you find a color , find a DTM etc.

    For To Do Loop

    The for to do loop is very good for TPAs and Loops to do with Lengths of Integers.

    it looks like this.

    SCAR Code:
    For I:= 0 to 5 do
    begin
      Writeln(IntToStr(I));
    end;

    so that will repeat that loop 5 times because i defined it as I:= 0 to 5.

    each time it goes through the loop it adds 1 onto the varable you defined it as ( I ).

    the While Do loop

    the while do loop is very simple and Imho it is under used here at SRL.

    The is simply While Something Do this. As in While FindDTM do Wait.

    Or While FlagPresnt do Wait.

    Example:

    SCAR Code:
    while FlagPresent do
      Wait(100);

    I Hope you learnt something.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help With Holding Keys Down
    By shadohead in forum OSR Help
    Replies: 2
    Last Post: 01-28-2009, 07:49 AM
  2. VK Keys?
    By Macro_FTW in forum OSR Help
    Replies: 1
    Last Post: 11-12-2008, 04:22 PM
  3. holding keys
    By RudeBoiAlex in forum OSR Help
    Replies: 8
    Last Post: 02-19-2007, 02:28 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
  •