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

Sell OSRS Gold
will6100

Looking for tips and guidance

Recommended Posts

I really love the process of developing a script, testing it, debugging it, etc.. So after writing my first really simple script that would tan hides, I got my first botting account banned, which is something I knew was gonna happen since my lack of scripting knowledge. Im ready to get a new one up and going and continue to develop more basic scripts to sharpen my scripting skills. Im sharing my first script here and looking to hear what I should do and should not do. Also get some tips on what to look for to reduce the banning rates of my testing accounts. The account I was using was only combat lvl 5 and didnt have any quests done, I guess that didnt help too? I was also about to introduce ABC2 into the script and learn how to use it but my account got banned right before I could implement it. So looking forward to hear your criticisms about my script and tips to not get the script bannable. Also have in mind I didnt really refactor anything, some parts may look ugly, beware!

package scripts;


import org.tribot.api.DynamicClicking;
import org.tribot.api.General;
import org.tribot.api.Timing;
import org.tribot.api.input.Mouse;
import org.tribot.api2007.*;
import org.tribot.api2007.types.RSNPC;
import org.tribot.api2007.types.RSObject;
import org.tribot.api2007.types.RSTile;
import org.tribot.api2007.util.ThreadSettings;
import org.tribot.script.Script;
import org.tribot.script.ScriptManifest;

import java.awt.*;
import java.util.function.BooleanSupplier;


@ScriptManifest(category = "Moneymaking", authors = "will6100" , name = "Tanner")
public class Tanner extends Script {


    private final static int BLACK_DHIDE_ID = 1747;
    private final static int TANNED_LEATHER_ID = 2509;
    private final static int ELLIS_ID = 3231;
    private final static int BANK_BOOTH_ID = 10355;
    private final static int COINS_ID = 995;


    private boolean isBankable() {
        RSObject[] booths = Objects.findNearest(100, BANK_BOOTH_ID);
        if (booths.length > 1) {
            return booths[0].isOnScreen();
        }
        return false;
    }


    private boolean coinsCheck() {
        if (Inventory.find(COINS_ID).length < 1) {
            if (Banking.find(COINS_ID).length > 0) {
                if (!Inventory.isFull()) {
                    return Banking.withdraw(0, COINS_ID);
                } else {
                    if (Inventory.find(BLACK_DHIDE_ID).length > 0) {
                        return Banking.deposit(1, BLACK_DHIDE_ID);
                    } else if (Inventory.find(TANNED_LEATHER_ID).length > 0){
                        return Banking.depositAll() > 0;
                    }
                }
            }
        } else {
            return true;
        }
        return false;
    }


    private boolean bank() {
        if (!openBank()) {
            General.println("Couldnt open bank");
            return false;
        }
        if (!coinsCheck()) {
            General.println("No more gold");
            return false;
        }
        if (!setupInventory()) {
            General.println("No more hides");
            return false;
        }
        sleep(100,1000);
        return true;
    }


    private boolean setupInventory() {
        if (Inventory.find(TANNED_LEATHER_ID).length > 0) {
            sleep(50,1000);
            if (Banking.deposit(0,TANNED_LEATHER_ID)) {
                if (Banking.find(BLACK_DHIDE_ID).length > 0){
                    sleep(50,1000);
                    Banking.withdraw(0, BLACK_DHIDE_ID);
                    return Timing.waitCondition(this::readyToTan, General.random(3000,5000));
                }
            }
        } else if (Inventory.find(TANNED_LEATHER_ID).length < 1) {
            sleep(50,1000);
            if (Banking.find(BLACK_DHIDE_ID).length > 0){
                Banking.withdraw(0, BLACK_DHIDE_ID);
                return Timing.waitCondition(this::readyToTan, General.random(3000,5000));
            }
        }
        return false;
    }


    private boolean openBank() {
        if (!Banking.isBankScreenOpen()) {
            if (!isBankable()){
                if(!walkToDestCondition(this::isBankable)) {
                    return false;
                }
            }
            return clickBankBooth();
        }
        return true;
    }


    private boolean clickBankBooth() {
        RSObject[] bankBooths = Objects.findNearest(40, BANK_BOOTH_ID);
        RSObject booth;
        if(bankBooths.length > 1) {
            do {
                sleep(50);
                booth = bankBooths[General.random(0, bankBooths.length - 2)];
            } while (!booth.isOnScreen() && !booth.isClickable());
            booth.hover();
            if (isHoverRendered(Mouse.getPos())){
                Mouse.click(1);
            }else {
                clickBankBooth();
            }
            return Timing.waitCondition(Banking::isBankScreenOpen, General.random(25000,27000));
        }
        return false;
    }

    
    private boolean isHoverRendered (Point toHover) {
        return !Screen.getColorAt(Mouse.getPos()).equals(new Color(0, 0, 0));
    }
    
    

    private boolean isTannable() {
        RSNPC[] ellis = NPCs.find(ELLIS_ID);
        if (ellis.length < 1) {
            return false;
        } else if (isTanningWindowOpen()){
            return true;
        }
        return ellis[0].isOnScreen();
    }


    private boolean tanLeather() {
        RSNPC ellis;
        if (isTannable()) {
            sleep(100,200);
            ellis = NPCs.find(ELLIS_ID)[0];
            while (!isTanningWindowOpen()) {
                Mouse.setSpeed(190);
                sleep(300,500);
                if (DynamicClicking.clickRSNPC(ellis,"Trade " + ellis.getName())){
                    Mouse.setSpeed(115);
                    Timing.waitCondition(this::isTanningWindowOpen, General.random(15000, 17000));
                    sleep(200,500);
                    Interfaces.get(324,107).click("Tan all");
                    return Timing.waitCondition(() -> !isTanningWindowOpen(), General.random(3000,5000));
                }
            }
        } else {
            return walkToDestCondition(this::isTannable);
        }
        return false;
    }


    private boolean walkToDestCondition(BooleanSupplier waitCondition) {
        Walking.blindWalkTo(new RSTile(3278 + General.random(-2,2), 3180 + General.random(-1, 1)));
        return Timing.waitCondition(waitCondition, General.random(11000,12000));
    }


    private boolean isTanningWindowOpen() {
        return Interfaces.isInterfaceValid(324);
    }


    private boolean readyToTan() {
        return Inventory.find(BLACK_DHIDE_ID).length > 0 && Inventory.find(COINS_ID).length > 0 ;
    }


    @Override
    public void run() {
        Mouse.setSpeed(115);
        ThreadSettings ts = new ThreadSettings();
        ts.setClickingAPIUseDynamic(true);
        while (true) {
            sleep(50);
            if (isTannable()) {
                if (readyToTan()) {
                    if(!tanLeather()){
                        General.println("1");
                        break;
                    }
                } else {
                    if(!bank()) {
                        General.println("2");
                        break;
                    }
                }
            } else if (isBankable()) {
                if (readyToTan()) {
                    if(!tanLeather()){
                        General.println("3");
                        break;
                    }
                } else {
                    if(!bank()) {
                        General.println("4");
                        break;
                    }
                }
            } else if (readyToTan()) {
                if(!tanLeather()){
                    General.println("5");
                    break;
                }
            } else {
                if(!bank()) {
                    General.println("6");
                    break;
                }
            }
        }
    }


}

 

Share this post


Link to post
Share on other sites
Array

Look into more realistic sleep times. Currently you always sleep for 50 milliseconds between actions, which is a major red flag. Don't add pure randomness to it either, look into using General.randomSD(average, deviation) because it's a random normal distribution and mimics the natural bell curve of human distributions. You should be using small delays between actions of your script too, so between any two method calls that physically interact with the game world (moving the mouse, clicking, typing on the keyboard, rotating the camera) there needs to be some delay. I personally recorded myself performing some tasks in-game then looked at my own delays and modeled some generator functions around that but you could probably get away with just guessing. I hope this was useful, and happy scripting!

@will6100

Edited by IceKontroI
  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, IceKontroI said:

Look into more realistic sleep times. Currently you always sleep for 50 milliseconds between actions, which is a major red flag. Don't add pure randomness to it either, look into using General.randomSD(average, deviation) because it's a random normal distribution and mimics the natural bell curve of human distributions. You should be using small delays between actions of your script too, so between any two method calls that physically interact with the game world (moving the mouse, clicking, typing on the keyboard, rotating the camera) there needs to be some delay. I personally recorded myself performing some tasks in-game then looked at my own delays and modeled some generator functions around that but you could probably get away with just guessing. I hope this was useful, and happy scripting!

@will6100

Cheers, will look more into that in the future.

Thanks for the feedback!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By tomking50
      Hello, 
      I've just purchased this bot and im wondering how do i set breaks to avoid bans?
       
      Thank you,   
    • By ELON
      ELON AIO COMBAT
      abc2 lvl 8
      + Custom antiban
      gui support
      save/load
      SOURCE:https://github.com/Elon333/ELON-Combat-Aio
      LINK TO SCRIPT: https://tribot.org/repository/script/id/3411
       

      Bug Report info:
      bot debug copy paste in pastebin
      client debug copy paste in pastebin
      explanation on bug
      screenshot/video if applicable
      MY DISCORD INFO: Elon#6697
      message my discord for faster reply

      ELON FREE SCRIPTS:
      RESTLESS GHOST: https://tribot.org/repository/script/id/3416
      PRIEST IN PERIL: https://tribot.org/repository/script/id/3407
      COMBAT AIO: https://tribot.org/repository/script/id/3411
       
    • By whyareyoudoingthis
      Hello, I would really appreciate some advice since it's lookin kinda hopeless.
      I'm getting consistent bans on p2p accounts with nFletcher, within 24-48 hours, even though I am botting with randomized breaks, doing some manual selling/restocking every 1-2 hours. I did not bot during the night, maybe 3 sessions for 3-4 hours per day TOPS.
      I even did some slayer in between every 1-2 hours on my semi-main and it just got banned for 2 days regardless (ty god no perma, obviously not gonna bot on a valuable account ever again, that was dumdum)
      Am I doing something wrong or what? This seems completely unprofitable and unsustainable. I am not into this as much as to create a bot farm, but I wanted to do a total of 10ish m/day on 1-2 accounts and this seems impossible. 
      Any advice? Thank you so much in advance
    • By DizFunk
      Hi guys, I just started attempting to script. I bought VIP so I could write my own scripts. I've been having the hardest time setting up my eclipse to work with TRIBot. So far I have set up my eclipse to compile with JDK/JRE 8, TRIBot is being launched with JDK 8. Everything seems to be setup correctly, however I get this odd error message in my bot debug logs. I've attached a photo of the logs. 
      Here is what my class file looks like: 
      package scripts;
      import org.tribot.script.Script;
      import org.tribot.script.ScriptManifest;
      @ScriptManifest (authors = { "DizFunk" }, category = "Test", name = "Test")
      public class Test extends Script {
          @Override
          public void run() {
              println("Hello World!1");
          }
      }
       If anyone knows whats going on here it would be a big help

    • By schenkelenkel
      Getting this error, client won't start.

    • By Trixztor
      i purchased 8 credits was charged twice and never got the credits, can i just get the 16 credits and call it good? i made a support ticket but 3 days and no response. any advice on what to do? thanks all
    • By ilysmd
      Looking to buy a cox scouting bot, that will keep scouting until it finds a raid within the desired parameters.
    • By jesusgj18
      Tengo un problema ya que compré un script premium.
      Es que después de que el bot se ejecuta durante 2 horas, se detiene.
      y cuando intentó ejecutar el bot de nuevo, me muestra el error que se muestra en la imagen.
      Es un bot increíble, pero tengo ese problema ya que lo tengo y es desalentador

      Como el bot no funciona más de 2 horas , le pedí ayuda al creador del bot, pero él respondió que ya es un problema con tribot.

      AYUDA
       
    • By idkfa
      Hello my knowledgeable friends,
      Ive botted about 3 accounts to max combat and ran small gold farms but lately I really interested in learning how to script myself so I can give back to the awesome community and start goldfarming on a professional level. That being said ive got some questions.Little background check, im a total noob when in comes to programming languages.
      - ive read that learning Java is a must. But what I don't understand is do I need to learn everything about java or just parts that are relevant to scripting for Tribot. Do I have to take a course or to do a deep dive like enlisting in an education  or is learning Java just for Tribot enough?
      - If a book is preferable, do you have any recognmendations?
      - after being proficiant in Java ive read I still need to learn how to script for Tribot specifically. Is this a long process?
      - I know this is a difficult question to answer but how long do you guys recon this process will take in hours learning Java and scripting for Tribot? Ive got about 2/3 hours to spare a day and about 5/7 on weekends
      - Also is there a discord with like minded people out there looking to learn java/tribot and also one for goldfarmer (not gonna ask for methods lol)
       
      Sorry for the long and nooby questions. Hope you guys can point me in the right direction. 
      Any constructive comments are greatly appriciated.
      Cheers,
      IDKFA
    • By Turninprofut
      I'm using Blazing Proxy, mainly just to learn about this stuff, and when attempting to use the username/password login on the tribot client I am given a pop up window that says the connection has timed out.
      Yet if I try to authenticate via IP I do not have the user/pass that Tribot uses. 
       
      What am I doing wrong? Is anyone using Blazing Proxies that could share their settings?
       
      Or any other solutions/tips would be greatly appreciated, thank you!

  • Our picks

    • Come give us feedback on the next version of TRiBot!
        • Thanks
        • Like
      • 30 replies
    • TRiBot is looking to improve a lot of its customer relationship management, customer on boarding process, customer experience, design elements, community engagement and pretty much everything else you can imagine when it comes to marketing.

      Our goal: To ensure that the marketing done TRULY reflects the experience and does not shine an inaccurate light on what TRiBot is lacking in.

      So I ask, what do you love about TRiBot and what do you hate about TRiBot? What does O S Bot, Rune M8, PowR Bot and Dre amBot do better? (yes I purposely didn't spell it right 😂).

      Love, 

      RileyZ
        • Like
      • 19 replies
    • Over the last three weeks, I've been working on upgrading our server infrastructure. It's finally ready and is now live!

      Why?

      Increased reliability - less server errors


      Increased availability - less downtime


      Increased security - keeping us and you secure


      Increased capacity - ability to serve you better


      Increased speed - less waiting for things to load


      Faster development - server and service updates will come faster


      What are the changes?

      Move from a single AWS EC2 instance to AWS ECS (Elastic Container Service)


      Distributed computing


      Load balancing


      Git management of server files and filesystem


      Redis caching


      How?

      AWS ECS (with 10 EC2 instances)


      AWS ElastiCache (Redis)


      AWS Load Balancing


      AWS EFS (Elastic file system)


      Please bare with us as I continue to tune the server for maximum performance. Slow loading speeds may occur temporarily. I thank everyone for their patience.

      Please post on this thread if you experience any issues other than slow loading times.
        • Like
      • 51 replies
    • This release will:

      Fix prayers and world hopper API (Thanks @JoeDezzy1 and @erickho123)


      Improve banking API (Thanks @Encoded)


      Adds methods for returning and using Java Lists, rather than arrays


      Slightly randomizes some hardcoded behaviour


      Removes sleeps from waitConditions; the efficiency saving potential is negligible in these use-cases, therefore cleaner code is preferable


      Other back-end improvements





      Note: If you are using LG, please restart both the RS client and TRiBot.
        • Sad
        • Haha
        • Thanks
        • Like
      • 90 replies
    • This release will:

      Add new internal framework for capturing exceptions


      Fix issue with not selecting the last column in world hopper (Thanks @Todd)


      Add a message about pin usage in Banking#openBank (Thanks @Todd)


      Disable the firewall by default (Thanks @Todd)


      Fix handling of the welcome screen after login (Thanks @Encoded)


      Fix wrong amount bank withdrawal (Thanks @Encoded)


      Fix Screen#isInViewport


      Fix Game#isInViewport (Thanks @Encoded)


      Call onBreakEnd for ListenerManager Breaking Listeners (Thanks @Encoded)


      Fix Prayer#getPrayerPoints NumberFormatException (Thanks @JoeDezzy1)



      Note: If you are using LG, please restart both the RS client and TRiBot.
        • Thanks
        • Like
      • 28 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...