Results 1 to 16 of 16

Thread: PInput - Interact with any OSRS client without taking over I/O units

  1. #1
    Join Date
    Feb 2012
    Location
    Portugal
    Posts
    91
    Mentioned
    3 Post(s)
    Quoted
    41 Post(s)

    Default PInput - Interact with any OSRS client without taking over I/O units

    PInput

    Pinput is both an include and a plugin which allows you to interact with any OSRS game client without the need of having it focused, nor taking over your I/O units.
    It uses @Kasi's KInput to achieve this (read more about his post if you want to know how it works and how to compile it).

    The plugin offers a high level interface to KInput, so you can do basic things like moving/pressing the mouse and using the keyboard more easily without having to know what events and in which order you need to send them into the client.

    The include is just a wrapper around the plugin with the following features:
    • Automatic PID discovery using target window (thanks @slacky)
    • Multi-boxing (send the same action to mwith the ability to index certain clients when needed)
    • Override Simba's Mouse and Keyboard functions, so you can use this in any script by adding a few amount of lines to it.


    Sounds great, but how do I start using it?

    How to set it up:


    Things needed:


    After downloading everything:
    1. Drag KInput.dll and PInput.dll to the Plugins folder in Simba (for me C:\Simba\Plugins)
    2. Extract the source code to the Includes folder in Simba (for me C:\Simba\Includes)
    3. Rename the extracted folder to PInput


    How to use it:


    I think is better to show a few examples rather than trying to explain what you need to do

    Basic setup:
    Simba Code:
    program new;

    {$include PInput/PInput.simba}

    procedure Stop();
    begin
      PInput.Shutdown(); // Make sure you shutdown PInput
    end;

    var
      X, Y: Integer;
    begin
      PInput.Setup(78952); // Setup PInput for client with PID 78952
      PInput.OverrideSimba := false; // Don't override Simba Mouse and Keyboard functions
      PInput.MoveMouse(580, 230);
      PInput.HoldMouse(580, 230, mouse_Left);
      PInput.MoveMouse(700, 400);
      sleep(10);
      PInput.ReleaseMouse(700, 400, mouse_Left);
      PInput.SendKeys('hey', 30, 30);
      PInput.PressKey(13);
      PInput.SendKeys('hey', 30, 30);
      PInput.GetMousePos(X, Y);
      WriteLn(X, ' ', Y);
      Stop();
    end.

    Basic setup with a single client with automatic PID discovery (Make sure you target a window!):
    Simba Code:
    program new;

    {$include PInput/PInput.simba}

    procedure Stop();
    begin
      PInput.Shutdown(); // Make sure you shutdown PInput
    end;

    begin
      PInput.Setup(); // Setup PInput. Grabs the PID of the target window.
      PInput.OverrideSimba := false; // Don't override Simba Mouse and Keyboard functions
      PInput.MoveMouse(580, 230);
      PInput.HoldMouse(580, 230, mouse_Left);
      PInput.MoveMouse(700, 400);
      sleep(10);
      Stop();
    end.

    As you may have guessed, if you do:
    Simba Code:
    PInput.OverrideSimba := true;
    PInput will override Simba's Mouse and Keyboard functions. (Only works when using one client, is enabled by default when only one client is used.)

    Basic multi-box:
    Simba Code:
    program new;

    {$include PInput/PInput.simba}

    procedure Stop();
    begin
      PInput.Shutdown(); // Make sure you shutdown PInput
    end;

    var
      X, Y: Integer;
    begin
      PInput.Setup([78952, 78951, 78953]); // Setup PInput for clients with PID 78952, 78951, 78953
      PInput.MoveMouse(580, 230); // Makes all clients move their mouses

      PInput.HoldMouse(0, 580, 230, mouse_Left); // Makes the first client hold his mouse
      PInput.MoveMouse(0, 700, 400); // Makes the first client move his mouse
      sleep(10);
      PInput.ReleaseMouse(0, 700, 400, mouse_Left); // Makes the first client release his mouse
      PInput.SendKeys(1, 'hey', 30, 30); // Makes the second client send 'hey'
      PInput.PressKey(1, 13); // Makes the second client press enter
      PInput.GetMousePos(X, Y); // Gets the mouse of all clients (the first client)
      WriteLn(X, ' ', Y);
      Stop();
    end.

    Notes:


    • Only works with Windows because it uses Windows API


    I hope you all enjoy using this project as much as I enjoyed creating it! Learned a bunch, and got more familiar with both Windows API and JNI thanks to @Kasi and his KInput plugin.

    This release has been verified working 22th September 2018
    Last edited by Patriq; 09-24-2018 at 02:00 AM. Reason: Added canvas re-grabbing, so remove that info from notes.

  2. #2
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    First! GZ on release.

  3. #3
    Join Date
    Oct 2012
    Posts
    1,258
    Mentioned
    40 Post(s)
    Quoted
    588 Post(s)

    Default

    Looks pretty neat, ty Patriq and Kasi.

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Instead of overriding all of the simba functions you should just add TEIOS support to kinput.

  5. #5
    Join Date
    Feb 2012
    Location
    Portugal
    Posts
    91
    Mentioned
    3 Post(s)
    Quoted
    41 Post(s)

    Default

    Doing that as we speak

  6. #6
    Join Date
    Nov 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks very much, this helped me so much. ATM, i have a script to start SMART, a script to grab the PID from the target window, and a script which logs in and bots. Very very basic code, but it works. If anyone would like me to share this/or help me make this three scripts in one, then let me know thanks.

  7. #7
    Join Date
    Nov 2018
    Location
    System32
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Very nice work!

    Is it possible for this to work on certain RSPS jar executable files?

  8. #8
    Join Date
    Jul 2018
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Zombified View Post
    Very nice work!

    Is it possible for this to work on certain RSPS jar executable files?
    If anyone is wondering, the answer is in the first line of the post: a plugin which allows you to interact with any OSRS game client

  9. #9
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by felparers View Post
    If anyone is wondering, the answer is in the first line of the post: a plugin which allows you to interact with any OSRS game client
    Like runelite? So it wont work with jar then any way to modify it to work for rsps?

    Also any way to make this work with linux? Will wine make it work for linux?

  10. #10
    Join Date
    Aug 2019
    Posts
    29
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Looks cool will try this soon thanks.

  11. #11
    Join Date
    Aug 2019
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    To anyone wondering who may come across this in the future.

    I was having issues with this and two pieces of information i want to share that I learned from the Patriq the developer(thanks boss you're the man)
    the first bullet was critical to solving my problem, the second is more along the lines of trivia.


    1. THE RUNESAPE CLIENT MUST BE 32bit!!! a 64bit client WILL NOT WORK
    2. while pinput isn't "just for OSRS" it still has restrictions (beyond working only on windows which is already mentioned) namely
    "It [the window targeted by pinput] needs to be a jre window with a canvas in it[.] So it won't work for notepad for example"

  12. #12
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    193
    Mentioned
    1 Post(s)
    Quoted
    6 Post(s)

    Default

    I'm really surprised how far the community has gone to help people that aren't using S.M.A.R.T.
    Bravo.

    The End Awaits. . .

  13. #13
    Join Date
    Mar 2015
    Location
    United States
    Posts
    61
    Mentioned
    0 Post(s)
    Quoted
    24 Post(s)

    Default

    Does anyone know if this still works, or something needs to be fixed? I'm having issues getting it working can't get it to send input to any windows for some reason.

  14. #14
    Join Date
    Jun 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by elephant View Post
    Does anyone know if this still works, or something needs to be fixed? I'm having issues getting it working can't get it to send input to any windows for some reason.
    Java 8, 32bit v111 is the only version that works for me.

  15. #15
    Join Date
    Sep 2015
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Pntbllfrk View Post
    Java 8, 32bit v111 is the only version that works for me.
    Hey, since these forums are dead mostly and I saw you posted this yesterday... I'm wondering if you've tried multiboxing with that plugin and if yes, is there a way to get info (like search for DTM/colors) from the multi clients without them being active?

  16. #16
    Join Date
    Jun 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    What would I need to change in @Kasi's source to use on another java application?

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
  •