Results 1 to 20 of 20

Thread: Recognizing keypresses?

  1. #1
    Join Date
    Apr 2007
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Recognizing keypresses?

    I want to make a script that when i press (F5) the script would click on the possition I chose like:

    Procedure clickhere;
    if pressedkey=f5 (Don't have a clue how =) )
    then
    mouse()
    end;

    Is that possible?
    Jaghax FTW

  2. #2
    Join Date
    Sep 2006
    Posts
    322
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    SCAR Code:
    program New;

    begin
      if (IsFKeyDown(5)) then
      begin
        writeln('If you held down F5 while starting this');
        writeln('Youll see this message');
        clickmouse(1,1,true);
      end;
    end.
    Last edited by uncfan1119; 10-31-2009 at 02:09 AM.
    "SRL is the best SCAR community in the World, with the most talented programmers: adjust your volume."
    -Wizzup?

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

    Default

    For a regular key:

    SCAR Code:
    IsKeyDown(GetKeyCode('a'));

    ~Sand

  4. #4
    Join Date
    Apr 2007
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks both of you!
    Jaghax FTW

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

    Default

    sorry, double
    Jaghax FTW

  6. #6
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    where as if you do this
    SCAR Code:
    program New;

    begin
      Repeat
      if (IsFKeyDown(5)) then
      begin
        writeln('If you held down F5 ');
        writeln('Youll see this message');
        clickmouse(1,1,true);
        writeln('if you press F4 it ends');
        writeln('But you could press f5 as many times as like');
      until (IsFKeyDown(4));
      end;

    end.
    Not sure but should work
    I see Now, says the blind man

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

    Default

    Small correction to the above:

    SCAR Code:
    program New;

    begin
      if (IsFKeyDown(5)) then
      begin
        Repeat
          writeln('If you held down F5 ');
          writeln('Youll see this message');
          clickmouse(1,1,true);
          writeln('if you press F4 it ends');
          writeln('But you could press f5 as many times as like');
        until (IsFKeyDown(4));
      end;

    end.

    You had the open repeat above the begin and the closing until before the end.

    ~Sand

  8. #8
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Please avoid using clickmouse(), clickmouse() is afaik ban-able, use mouse() instead

  9. #9
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    He never stated it was for RuneScape.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  10. #10
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    Please avoid using clickmouse(), clickmouse() is afaik ban-able, use mouse() instead
    Yea but i was only editting uncfan1119's post
    I see Now, says the blind man

  11. #11
    Join Date
    Mar 2006
    Location
    Northern Kentucky
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    until If IsKeyDown(GetKeyCode('q'))Then
    TerminateScript;

    Trying to make escape clause. For some reason not working and has been AGES since i've used scar. Not for RS dont worry its for conquer online xD

  12. #12
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    until IsKeyDown(GetKeyCode('q'));
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  13. #13
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    IsKeyDown('q'); works

  14. #14
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yea, scar could use a makeover on this feature though because it is HORRIBLE. scar needs a key press event so that if you press a key at ANY time then scar can see it. right now its limited to the key has to be down when the code gets to a certain point.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

  15. #15
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).

  16. #16
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).
    It actually is possible. SCAR recognizes if you press CTRL + ALT + S at any point while the script is running

  17. #17
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I am currently learning VBScript and they have events which fire whenever a key is pressed and things like that. It is very useful.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  18. #18
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Didn't even think about that, Zyt3x. But I meant you can't do it during runtime.

  19. #19
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    That's because there's no multithreading capability in SCAR. I don't think it's possible in Delphi, and it isn't possible in PascalScript, either, as far as I know (what Simba will be using).
    It is possible in Delphi... Multi-threading and hooking is possible.
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  20. #20
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Dan's The Man View Post
    It is possible in Delphi... Multi-threading and hooking is possible.
    Quote Originally Posted by i luffs yeww View Post
    Didn't even think about that, Zyt3x. But I meant you can't do it during runtime.
    wat

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
  •