Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buy OSRS Gold


  • Content Count

  • Joined

  • Last visited

  • Feedback


Community Reputation

0 Neutral

About sergiox57

  • Rank
    New Botter

Recent Profile Visitors

1,869 profile views
  1. Thanks for replying, i guess i will have to execute the custom login method inside the same thread of the script code to avoid any thread interference.
  2. Hi thanks for replying, i already have done this setLoginBotState(false), and i run my custom login method in a separate thread, also i have tried putting all my script code inside a custom thread called thread1, but the same problem appears that is why i came to the conclusion that the deadlock was being generated when the thread was suspended while calling this method DynamicClicking.clickRSObject() , i guess the solution would be like Fluffe said adding a block of code that would idle the script code while not ingame or using a volatile boolean variable that the custom login would change to tell the script code to idle until the custom login method finishes execution. But still i am curious on, how Tribot Login.login() method avoids generating a deadlock when pausing the script? Thanks for replying!
  3. Hello, currently i am writing a custom login method for my scripts but sometimes the script gets deadlocked when the customLogin method is called, the scriptThread.suspend() method inside the customLogin method makes the script thread get into a deadlock when it is executing DynamicClicking.clickRSObject(), i know this deadlock occurs because DynamicClicking.clickRSObject() is not thread safe. To suspend the script thread this is what i do: Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); Thread[] threadArray = threadSet.toArray(new Thread[threadSet.size()]); Thread scriptThread = null; for(Thread t : threadArray){if(t != null && t.getName().contains("Script Thread")){scriptThread=t;}} scriptThread.suspend(); I even wrote a code that replicates the problem 50% of the times, the mouse speed should be set to around 30 for the problem to appear more times. This is the code: Mouse.setSpeed(30); Thread testThread1 = new Thread(new Runnable(){ @Override public void run() { while(true){ DynamicClicking.clickRSObject(Objects.findNearest(20, "Door")[0], 1); sleep(1); } } }); Thread testThread2 = new Thread(new Runnable(){ @Override public void run() { while(true){ Mouse.clickBox(new Rectangle(100,400,50,50), 1); sleep(2000); } } }); testThread1.start(); sleep(1000); testThread1.suspend(); testThread2.start(); while(true){ sleep(20000); } After running the code a few times you will notice that the Mouse.clickBox() method will not get executed, thats the deadlock situation i am talking about. I have a few questions: 1) how the script thread can be paused without getting into a deadlock situation like this one? 2) how Tribot Login.login() method avoids getting into a deadlock when pausing the script? any help is appreciated!
  • Create New...