Results 1 to 3 of 3

Thread: How to perform 2 actions at the same time?

  1. #1
    Join Date
    Jan 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default How to perform 2 actions at the same time?

    Hi, beginner here.
    Im looking for to run 2 separate codes at the same time.
    Example. While my mouse is moving across the bankscreen interface, the "bankScreen.clickButton(BANK_BUTTON_PRESET_1); " is also being send.

    So action "MOUSE_MOVE" and "bankScreen.clickButton(BANK_BUTTON_PRESET_1); " is done at the same time.

    here is my code

    Simba Code:
    begin
    if bankScreen.isOpen(5000) then
        begin
          wait(randomRange(99, 199));
          while bankScreen.isOpen do
          begin
            smallRandomMouse(60); //<-- as the mouse is being moved, the bank_button_preset_1 is being send.
            bankScreen.clickButton(BANK_BUTTON_PRESET_1); //<-- This should be send while the mouse is moving.
          end;
        end;
    end;

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    The short answer is that you cannot do this. Simba is a single-threaded application, meaning it can only do one thing at a time. It has no concept of how to execute multiple actions in tandem, which is called "multithreading."

    Moreover, the interpreters (PascalScript and Lape) we use are not thread-safe. Meaning that even if Simba had the ability to take advantage of multiple threads, we could not utilize it without writing a new interpreter.

    There exist ways to achieve pesudo-multithreading, such as using non-modal forms, timers or a plugin but these are somewhat hacky, probably won't accomplish exactly what you want, and might cause unforeseen issues.
    Last edited by KeepBotting; 04-07-2016 at 02:46 AM.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Jan 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Ah thanks. I think Ive found a way to solve this

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
  •