Jump to content

redeems

Members
  • Posts

    23
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

865 profile views

redeems's Achievements

Bronze Poster

Bronze Poster (2/10)

7

Reputation

  1. The first one would be best. Create a state that handles logging in, and put a timeout on it. If it doesn’t complete the login action, you could assume 1 of two things. Credentials are incorrect, or the account is banned.
  2. true. conditional sleeps are almost always better than static sleeps.
  3. } else if (currentState == States.DROPPING) { //if the state is dropping... log("Inventory full dropping fish.."); //log that we are in this state and executing getInventory().dropAllExcept("Feather","Fly fishing rod"); //drop everything besides feathers and rod int openslots = (getInventory().getEmptySlotCount()); //variable for open inventory spots if (openslots == 26) { currentState = States.FISHING; } } } corrected. now it will go the distance.
  4. private States currentState = States.FISHING; //setting starting state private Area area = new Area(3109, 3434, 3103, 3423); // fishing area public enum States {FISHING, DROPPING} //the two states LUL just realized i never ....okay you win this time LUL
  5. ? https://gyazo.com/134f41b8e4a867b03c372fb0e6a70020
  6. the states are an enumeration. using states allows you to be dynamic. for this, case/switch works just fine, but what happens when you have a lot of cases, gets confusing. Your way is not incorrect. It's never wrong if the outcome is successful. yours is correct. It's just good practices.
  7. I've written this into a better structure using states. I commented everything so please take it and learn from it. Look up some java tutorials, and keep scripting. import org.osbot.rs07.script.Script; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import org.osbot.rs07.api.model.NPC; @ScriptManifest(name = "Fishing for States", author = "Redeems", version = 1.0, info = "", logo = "") //manifesto public class Main extends Script { private States currentState = States.FISHING; //setting starting state private Area area = new Area(3109, 3434, 3103, 3423); // fishing area public enum States {FISHING, DROPPING} //the two states private void startfishing() throws InterruptedException { //function to run on loop if (currentState == States.FISHING) { //if the state is "FISHING" then NPC fishSpot = getNpcs().closest("Rod Fishing spot"); //get closest rod fishing spot int openslots = (getInventory().getEmptySlotCount()); //variable for open inventory spots if (!myPlayer().isAnimating() && !getInventory().isFull() && !myPlayer().isMoving() && fishSpot != null) { //conditions for action log("Fishing.."); //log we've passed conditions fishSpot.interact("Lure"); //interact with fishing spot (fish) sleep(random(300, 600)); //sleep to give time to interact getMouse().moveOutsideScreen(); //move mouse off screen "said to be good? i dont do this..." if (openslots == 0) { //if no open inventory spaces....then currentState = States.DROPPING; //switch state to dropping } } } else if (currentState == States.DROPPING) { //if the state is dropping... log("Inventory full dropping fish.."); //log that we are in this state and executing getInventory().dropAllExcept("Feather","Fly fishing rod"); //drop everything besides feathers and rod } } @Override public void onStart() { } @Override public void onExit() { } @Override public int onLoop() { if (!area.contains(myPlayer())) { // if the area doesnt contain yourself log("Not in fishing area.. walking there."); //log that to be the case getWalking().walk(area); //walk to fishing spot } else { // otherwise.... if (area.contains(myPlayer())) { //if the area does include you try { //try catch statement in case something goes wrong we have an exception. if (myPlayer().isVisible()) { //something thats always true. log("about to start fishing"); //log entering function startfishing(); //enter function } } catch (InterruptedException e) { //catch log("got interrupted!"); //useless exception. } } } return random(1000, 1500); //how fast we loop. not needed to be random, i like it just for fun. } @Override public void onPaint (Graphics2D g) { } }
  8. if(!myPlayer().isAnimating()) { if(!myPlayer().isMoving()) { if(!getInventory().isFull()) { if(fishSpot != null) { log("Fishing.."); you can just use and instead of doing each if. if(!myPlayer().isAnimating() && !getInventory().isFull() && !myPlayer().isMoving() && fishSpot != null) { log("Fishing.."); fishSpot.interact("Lure"); sleep(random(300,600)); getMouse().moveOutsideScreen(); }
  9. The best way, if you have some know how about java, is to look over the API, learn it, and try to achieve something that there is no public resource for, this way you are forced to research specific concepts, instead of just looking at a source and not understanding. The way to include antibans is to not include them, they are pointless. Walkpaths you can look at the API in the classes "Walking, walking event, webwalking". There can never be a tutorial on making something "unique". There is also a scripting help section, which i've found users to be very willing to help answer questions. Furthermore, the snippets section has a lot of good resources as well.
  10. redeems

    GE Data

    Just because I know people will have issues converting this. This is how you do that. String Itemname = "Logs"; Optional<String> Itemprice = ItemLookup.get(Itemname, Property.SELL_AVERAGE); int ItemPriceConverted = Integer.valueOf(Itemprice.get()); log(Itemname + " are worth " + ItemPriceConverted + " gp"); Great stuff dreameo
  11. Sent the request, thanks man
  12. Hey frost bug would it be possible for me to add you on Discord
  13. Perfect, exactely what I was in need of. I was hoping you'd be the one to respond to this post, love me some frost scripts.
×
×
  • Create New...