Jump to content

lisabe96

Members
  • Posts

    821
  • Joined

  • Last visited

  • Feedback

    100%

Posts posted by lisabe96

  1. Tried using area, same issue:

    Banks.LUMBRIDGE_UPPER.setPlane(2);
    if (Movement.walkToArea(script, Banks.LUMBRIDGE_UPPER)) {
        script.log("Arrived at destination");
    }
    
    public static boolean walkToArea(Script script, Area area) {
    	if (!script.myPlayer().isMoving()) {
    		script.log("not moving");
    		if (area.contains(script.myPlayer())) {
    			script.log("finished");
    			return true;
    		}
    		script.log("tryna move");
    		script.getWalking().webWalk(area.getRandomPosition());
    	}
    	script.log("movement");
    	checkRunning(script);
    	return false;
    }
    

    Doesn't recognize my player being inside the area, the plane reset

  2.  

    I got you!!! have you tried doing 

    BANK_FLOOR.setPlane(2);

    Or in you're case 

    LUMBRIDE_UPPER.setPlane(2);
    

    You have to do this to give it a Z axis. So far you have created the banking area but it is by default on plane(0). Amiright?

     

     

    I put it in the onStart() method in my scripts.

     

     

    It might be this part of you're code , but most likely it's what i posted above.

    if (Banks.LUMBRIDGE_UPPER.contains(myPlayer()))

    I would write it the following way: 

    if (LUMBRIDGE_UPPER.contains(myPlayer()))

     

    This seems to be the issue, however it seems to reset the plane :/

    Position pos = Banks.LUMBRIDGE_UPPER.getRandomPosition();
    Position bank = new Position(pos.getX(), pos.getY(), 2);
    if (Movement.walkTo(script, bank)) {
      script.log("here");
    }
    

    This will print out a plane of 2, however when going to the walkTo method it prints out 0 as plane:

    public static boolean walkTo(Script script, Position pos) {
    	return walkTo(script, pos, false);
    }
    	
    public static boolean walkTo(Script script, Position pos, boolean handleDoor) {
    	if (!script.myPlayer().isMoving()) {
    		script.log(script.myPosition().getZ() + ", " + pos.getZ());
    		if (script.myPosition().distance(pos) < 3) {
    			script.log("in distance");
    			if (handleDoor) {
    				openDoor(script, pos);
    			}
    			return true;
    		}
    		script.getWalking().webWalk(pos);
    	}
    	checkRunning(script);
    	return false;
    }
    

    For some reason it resets to 0

  3. Nope ^

     

    I think it's not the actual banking that is the problem becauseeee

    It doesnt recognize my player being in the bank area in the first place.

    I'm guessing that that is my issue, it doesnt return my player being in the bank area.

    Though the player is, no clue how thats possible though

  4. Firstly "Banker" is a NPC not a RS2Object. 

     

    Secondly, you aren't null checking the objects which are found so make sure to do that.

    I know, originally I checked for the banker:

    NPC npc = getNpcs().closest("Banker");
      if (npc != null) {
        npc.interact("Bank");
      }
    }
    
    

    But as that didnt work I tried the bankbooth, then I tried looping through the nearby objects

    and then I came here.

    None of the given solutions got it working yet

     

     

    This is what I have now: (doesnt work)

    if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
      log("in the bank"); //Doesnt print
      if (!getBank().isOpen()) {
        try {
          if (getBank().open()) {
            new ConditionalSleep(5000, 6000) {
              @Override
              public boolean condition() throws InterruptedException {
                return getBank().isOpen();
              }
            }.sleep();
          }
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
    } else {
      getWalking().webWalk(Banks.LUMBRIDGE_UPPER.getRandomPosition());
    }
    
  5.  

    Have you considered trying the Bank API

     

    @Override
        public int onLoop() throws InterruptedException {        
            if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
                if (!getBank().isOpen()) {
                    if (getBank().open()) {
                        new ConditionalSleep(5000, 6000) {
                            @Override
                            public boolean condition() throws InterruptedException {
                                return getBank().isOpen();
                            }
                        }.sleep();
                    }
                }
            }
            return random(500, 900);
        }
    

    I did now and It didn't work.

    Logged the stages and it never even found my player being in the bank area.

  6. Trying to bank at the lumbridge bank at the 2nd floor of the caslte.

    However when I tried to grab a banker or a bank booth with .closest("Banker");

    It didn't find the bankbooth/banker.

     

    So I tried looping myself through all the RS2Objects in the area to find a bank booth,

    but it returned nothing.

     

    Am I missing something?

    for (RS2Object obj : script.getObjects().getAll()) {
      if (obj.getPosition().distance(script.myPosition()) < 10) {
        script.log(obj.getName());
        if (obj.hasAction("Bank")) {
          obj.interact("Bank");
          return true;
        }
      }
    }
    
  7. Cook's assistant quest completer

    By RandQm

     

     

     

    Features:

    Completes whole the quest on it's own

    Handles obstacles as doors/gates/...

    Toggles running when energy is available

    Uses webwalking

     

     

    Reasons to use this:

    Because why not

    Only takes 5 minutes

    Because it is believed having completed quests makes your account more legit (less chance on ban)

     

    Instructions:

    Do not have the supplies ready in your inventory, just start empty.

    Stand in the Lumbridge kitchen when starting the bot

    Do not interrupt the bot, it won't be able to pick up progress if you logged out in the middle of something

     

    Click here to download the JAR

     

     

    yXIDthq.png

     

     

     

     

    Code for geeks:

    package rqcooksassistant;
    
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.model.GroundItem;
    import org.osbot.rs07.api.model.NPC;
    import org.osbot.rs07.api.model.RS2Object;
    import org.osbot.rs07.api.ui.Message;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    
    /**
     * 
     * @author randqm
     *
     */
    
    @ScriptManifest(author = "RandQm", info = "Cooks Assistant", name = "RQ Cooks assistant", version = 1.0, logo = "")
    public class Main extends Script {
    	
    	private String status = "Starting...";
    	
    	private int stage = -1;
    	
    	private long startTime;
    	
    	
    	private void updateStage(int stage, String status) {
    		this.stage = stage;
    		this.status = status;
    	}
    	
    	@Override
    	public void onMessage(Message message) {
    		switch (message.getMessage()) {
    		case "You put the grain in the hopper.":
    			updateStage(13, "Operating hopper controls.");
    			break;
    			
    		case "You operate the hopper. The grain slides down the chute.":
    			updateStage(14, "Going to the flour bin.");
    			break;
    		}
    	}
    
    	@Override
    	public int onLoop() {
    		log("stage: " + stage);
    		
    		switch (stage) {
    		case -1:
    			startTime = System.currentTimeMillis();
    			updateStage(stage + 1, "Talking to cook.");
    			break;
    			
    		case 0:
    			NPC npc = npcs.closest("Cook");
    			
    			if (npc != null) {
    				npc.interact("Talk-to");
    				updateStage(stage + 1, "Handling conversation with cook.");
    			}
    			break;
    			
    		case 1:
    		case 2:
    			if (getDialogues().isPendingContinuation()) {
    				getDialogues().clickContinue();
    			} else if (getDialogues().isPendingOption()) {
    				getDialogues().selectOption(1);
    				updateStage(stage + 1, "Handling conversation with cook.");
    			}
    			break;
    			
    		case 3:
    			if (getDialogues().isPendingContinuation()) {
    				getDialogues().clickContinue();
    			} else if (getDialogues().isPendingOption()) {
    				getDialogues().selectOption(4);
    				updateStage(stage + 1, "Handling conversation with cook.");
    			}
    			break;
    			
    		case 4:
    			if (!getDialogues().isPendingContinuation()) {
    				break;
    			}
    			getDialogues().clickContinue();
    			updateStage(stage + 1, "Take pot.");
    			break;
    			
    		case 5:
    			GroundItem pot = getGroundItems().closest("Pot");
    			
    			if (pot != null) {
    				pot.interact("Take");
    				updateStage(stage + 1, "Head to wheat field.");
    			}
    			break;
    			
    		case 6:
    			if (walkTo(new Position(3163, 3289, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Pick wheat.");
    				}
    			}
    			break;
    			
    		case 7:
    			RS2Object wheat = getObjects().closest("Wheat");
    			
    			if (wheat != null) {
    				wheat.interact("Pick");
    				updateStage(stage + 1, "Head to mill.");
    			}
    			break;
    			
    		case 8:
    			if (!inventory.contains("Grain")) {
    				break;
    			}
    			if (walkTo(new Position(3162, 3290, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Head to mill.");
    				}
    			}
    			break;
    			
    		case 9:
    			if (walkTo(new Position(3166, 3302, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Going to the hopper.");
    				}
    			}
    			break;
    			
    		case 10:
    			updateStage(stage + (climbLadder(true) ? 1 : -1), "Going to the hopper.");
    			break;
    			
    		case 11:
    			if (myPosition().getZ() != 1) {
    				break;
    			}
    			updateStage(stage + (climbLadder(true) ? 1 : -1), "Putting grain into hopper.");
    			break;
    			
    		case 12:
    			if (myPosition().getZ() != 2) {
    				break;
    			}
    			RS2Object hopper = getObjects().closest("Hopper");
    			
    			if (hopper != null) {
    				getInventory().interact("Use", "Grain");
    				
    				if (!getInventory().isItemSelected()) {
    					break;
    				}
    				hopper.interact("use");
    			}
    			break;
    			
    		case 13:
    			RS2Object controls = getObjects().closest("Hopper controls");
    			
    			if (controls != null) {
    				controls.interact("Operate");
    			}
    			break;
    			
    		case 14:
    			updateStage(stage + (climbLadder(false) ? 1 : -1), "Going to the flour bin.");
    			break;
    			
    		case 15:
    			if (myPosition().getZ() != 1) {
    				break;
    			}
    			updateStage(stage + (climbLadder(false) ? 1 : -1), "Putting flour into pot.");
    			break;
    			
    		case 16:
    			if (myPosition().getZ() != 0) {
    				break;
    			}
    			RS2Object flourBin = getObjects().closest("Flour bin");
    			
    			if (flourBin != null) {
    				getInventory().interact("Use", "Pot");
    				
    				if (!getInventory().isItemSelected()) {
    					break;
    				}
    				flourBin.interact("use");
    				updateStage(stage + 1, "Heading to chickens.");
    			}
    			break;
    			
    		case 17:
    			if (!inventory.contains("Pot of flour")) {
    				break;
    			}
    			if (checkDoor()) {
    				updateStage(stage + 1, "Heading to chickens.");
    			}
    			break;
    			
    		case 18:
    			if (walkTo(new Position(3238, 3295, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Heading to chickens.");
    				}
    			}
    			break;
    			
    		case 19:
    			if (walkTo(new Position(3230, 3298, 0))) {
    				updateStage(stage + 1, "Taking an egg.");
    			}
    			break;
    			
    		case 20:
    			GroundItem egg = getGroundItems().closest("Egg");
    			
    			if (egg == null || !egg.exists()) {
    				break;
    			}
    			egg.interact("Take");
    			updateStage(stage + 1, "Heading to bucket.");
    			break;
    			
    		case 21:
    			if (!getInventory().contains("Egg")) {
    				break;
    			}
    			if (walkTo(new Position(3231, 3291, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Taking bucket.");
    				}
    			}
    			break;
    			
    		case 22:
    			GroundItem bucket = getGroundItems().closest("Bucket");
    				
    			if (bucket == null || !bucket.exists()) {
    				break;
    			}
    			bucket.interact("Take");
    			updateStage(stage + 1, "Heading to diary cow.");
    			break;
    			
    		case 23:
    			if (!getInventory().contains("Bucket")) {
    				break;
    			}
    			if (walkTo(new Position(3236, 3295, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Heading to diary cow.");
    				}
    			}
    			break;
    			
    		case 24:
    			if (walkTo(new Position(3252, 3267, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Milking diary cow.");
    				}
    			}
    			break;
    			
    		case 25:
    			if (walkTo(new Position(3255, 3274, 0))) {
    				RS2Object cow = getObjects().closest("Dairy cow");
    				
    				if (cow != null) {
    					cow.interact("Milk");
    					updateStage(stage + 1, "Heading back to cook.");
    				}
    			}
    			break;
    			
    		case 26:
    			if (!getInventory().contains("Bucket of milk")) {
    				break;
    			}
    			if (walkTo(new Position(3253, 3267, 0))) {
    				if (checkDoor()) {
    					updateStage(stage + 1, "Talking to cook.");
    				}
    			}
    			break;
    			
    		case 27:
    			if (walkTo(new Position(3208, 3213, 0))) {
    				NPC cook = getNpcs().closest("Cook");
    				
    				if (cook != null) {
    					cook.interact("Talk-to");
    					updateStage(stage + 1, "Finishing quest.");
    				}
    			}
    			break;
    			
    		case 28:
    			if (getDialogues().isPendingContinuation()) {
    				getDialogues().clickContinue();
    			} else {
    				getWidgets().closeOpenInterface();
    				updateStage(stage + 1, "Finished quest. Thanks for using my script.");
    				stop();
    			}
    			break;
    		}
    		return 600;
    	}
    	
    	@Override
    	public void onPaint(Graphics2D graphics) {
    		Graphics2D g = (Graphics2D) graphics;
    		g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
    	    
    	    g.setColor(Color.CYAN);
    
    	    g.drawString("Status: " + status, 10, 310);
    	    g.drawString("Running: " + formatTime(System.currentTimeMillis() - startTime), 10, 330);
    	}
    	
    	private boolean checkDoor() {
    		boolean opened = false;
    		
    		for (RS2Object obj : objects.getAll()) {
    			if (obj.getPosition().distance(myPosition()) < 2) {
    				if (obj.hasAction("Open")) {
    					obj.interact("Open");
    					opened = true;
    				}
    			}
    		}
    		if (opened) {
    			log("Opened closable");
    			return false;
    		}
    		return true;
    	}
    
    	private String formatTime(long ms){
    	    long s = ms / 1000, m = s / 60, h = m / 60;
    	    s %= 60; m %= 60; h %= 24;
    	    return String.format("%02d:%02d:%02d", h, m, s);
    	}
    	
    	private boolean climbLadder(boolean up) {
    		RS2Object ladder = getObjects().closest("Ladder");
    		
    		if (ladder != null) {
    			ladder.interact(up ? "Climb-up" : "Climb-down");
    			return true;
    		}
    		return false;
    	}
    	
    	private boolean walkTo(Position pos) {
    		if (!myPlayer().isMoving()) {
    			boolean opened = false;
    			
    			for (RS2Object obj : objects.getAll()) {
    				if (obj.getPosition().distance(myPosition()) < 3) {
    					if (obj.hasAction("Open")) {
    						obj.interact("Open");
    						opened = true;
    					}
    				}
    			}
    			if (opened) {
    				log("Opened closable");
    				return false;
    			}
    			if (pos.distance(myPosition()) > 2) {
    				getWalking().webWalk(pos);
    				return false;
    			}
    			log("Finished walking");
    			return true;
    		}
    		if (!getSettings().isRunning()) {
    			if (getSettings().getRunEnergy() > 10) {
    				getSettings().setRunning(true);
    			}
    		}
    		return false;
    	}
    	
    }
    
    
    • Like 3
  8.  

    Use the RS2Widgets api and use the widget debugging tool to get action names and to confirm your parent, child and if applicable child++.

    What you need:

    RS2Widget tanWidget = getWidgets().get(parent,c,c++); //this will be the widget for interacting with tan hide
    if(tanWidget != null)
        make.interact("Your action"); // get this from the widget debugging tool, Actions.
    

    Are the (parent, c, c++) values the number values the widget debugger displays?

    Like R: 142

     - 152

     -- 152

     

    Nvm figured it out, thanks

  9. Working on a simple tanner atm and I want to check if I'm in the tanning screen (trading ellis)

    To know when to tan the hides.

    How would I approach this? I noticed there's an "getInteraction" & stuff but don't really know

    what it would have to return.

     

    Also I'm using mouse coordinates now for tanning the hides in the tanning screen,

    is there a better approach than using mouse coordinates?

     

    Thanks in advance

  10. if (!Settings.location.getArea().contains(myPosition())) { //If not in woodcutting area
      log("Left area, heading back...");
      targetPosition = Settings.location.getTreePosition(); //Get area centre position
      localWalker.walk(targetPosition, true); //Move to position
      break;
    }
    

    Sometimes when I'm walking, the player doesn't stop on the exact target location but nearby.

    When this happens the player doesn't want to move anymore.

    As you can see in the code sample, I'm catching this however the player doesn't start moving anymore on calling walk.

×
×
  • Create New...