Jump to content

Want to get into scripting


Recommended Posts

Posted (edited)

Where should I start. I know there's videos out there, but what should my first script be that I first make that is simple enough to understand some of the components in this process. Thanks

 

  • Learn the basics to Java
  • Know how to find the Osbot API and search it
  • Learn the basic script skeleton to make an Osbot script.
  • Start with something very basic. (Shop buyer + walker + etc.)
  • Learn new methods by de-compiling other scripts in the local section
  • Post in the Scripter Help section for insight

Tools

 

Edited by Sinatra
Posted (edited)

Some tips:

- null checks

- use conditional sleeps whenever possible

- dont just write code in order, use logic and conditional statements for example:

public int onLoop(){ //this is bad
getBank().open();
getBank().depositAll();
getBank().withdraw("Coins", 20000);
getBank().close;
return 500;
}

public int onLoop(){ //this is better and is less likely to break
if(!getBank().isOpen()){
getBank().open();
new ConditionalSleep(2500, 3000){
@Override
public boolean condition(){
return getBank().isOpen();
}
}.sleep();
} else {
if(getBank().getAmount("Coins") >= 20000 && !getInventory().contains("Coins")){
getBank().withdraw("Coins", 20000);
new ConditionalSleep(2500, 3000){
@Override
public boolean condition(){
return getInventory().contains("Coins");
}.sleep();
}
}
if(getInventory().contains("Coins")){
getBank().close();
new ConditionalSleep(2500, 3000){
@Override
public boolean condition(){
return !getBank().isOpen();
}
}.sleep();
}
return 500;
}
Edited by LoudPacks
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...