Jump to content

Twin

Members
  • Posts

    1334
  • Joined

  • Last visited

  • Feedback

    100%

Posts posted by Twin

  1. Hey right now i can only show xp/hour for a specific skill

     experienceTracker.getGainedXPPerHour(Skill.STRENGTH) 

    How can i show all the skills in Xp/hour 

     

    If i'm understanding your question correctly, just check to ssee what stat is gaining exp. Then, set that as the xp to show, and if they're training on balanced make sure they can all show.

     

    du talar svenska?

  2. So are you asking for someone to do the work for you? Look up how to use window builder/whatever jframe builder you prefer. Check to see if a warrior is around, and if he is, check if he's reachable, and if he's not reachable open the nearest door.

    Look at pugs guide for learning paint, it's on the scripting help section, and I'm sure you can find a snippet on te scripting help forum for banking and walking a path.

  3. Hi i used IntelliJ as my IDE and now i finished the foundation of my script and i wanted to test it out, but I don't know how to test out my script using IntelliJ. If someone could help me it would great, thanks in advance.

    Are you trying to export it to use it in game? If so, just compile it and put the jar in the osbot/script folder.

  4. Any update on the script?

    I heard that someone who is a better scripter than me would be making a dragons script but it doesn't look like he has. I may take this on again, but I'm just being lazy about it.

  5. thanks everyone, okay so heres my newest version lol..it now sort of runs away from the Mugger behind the castle because it was aggressive so yeah no more of that!

     

    so my next thing is cutting oaks once skill reaches level 15+

     

    could anybody maybe show me how? biggrin.png

     

    import org.osbot.rs07.api.model.Entity;

    import org.osbot.rs07.api.model.NPC;

    import org.osbot.rs07.script.Script;

    import org.osbot.rs07.script.ScriptManifest;

    import org.osbot.rs07.utility.Area;

    import java.awt.*;

    @ScriptManifest(author = "Chris", info = "Chops and Drops Trees Lumbridge", name = "Level3TreeKiller", version = 0.1, logo = "")

    public class FuckYouTrees extends Script {

        final Area CHOPPING_AREA = new Area(3160, 3225, 3200, 3243);

        @Override

        public void onStart() {

            log("Kill All The Trees!");

            log("Fuck The World"); // /Shit the script says at the beginning

            log("Dont Get Banned Get Bank");

        }

        private enum State {

            CHOPPING_LOGS, DROPPING_LOGS, SEARCH_FOR_TREE, WAIT, RUNNINGAWAY // //"Modes"

                                                                                // my

            // character can

            // be in

        };

        private State getState() {

            NPC npc = npcs.closest("Mugger");

            Entity tree = objects.closest("Tree");

            if (inventory.isFull())

                return State.DROPPING_LOGS;

            if (npc != null)

                return State.RUNNINGAWAY;

            if (tree != null)

                if (!myPlayer().isAnimating()) // how to decide which mode to be

                    return State.CHOPPING_LOGS;

            if (myPlayer().isAnimating())

                return State.WAIT;

            else

                return State.SEARCH_FOR_TREE;

        }

        @Override

        public int onLoop() throws InterruptedException {

            switch (getState()) {

            case DROPPING_LOGS:

                log("Dropping Shit");

                inventory.isFull(); // what happens when in this case

                inventory.deselectItem();

                log("is inventory full?");

                inventory.dropAll();

                log("decided to drop");

                break;

            case CHOPPING_LOGS:

                log("Work Work");

                Entity tree = objects.closest("Tree");

                inventory.deselectItem();

                if (tree != null) {

                    log("is tree there?");

                    if (tree.isVisible()) {

                        log("is tree visible?"); // /what happens when in this case

                        if (!myPlayer().isAnimating())

                            log("am i already animating?");

                        if (myPlayer().isMoving())

                            log("Am i already moving?");

                        tree.interact("Chop Down");

                        log("actually chopping");

                        sleep(gRandom(400, 750));

                        log("sleeping");

                        break;

                    }

                }

            case SEARCH_FOR_TREE:

                log("Looking for a new tree");

                Entity newtree = objects.closest("Tree");

                if (newtree != null) // what happens when in this case

                    camera.toEntity(newtree);

                newtree.interact("Chop Down");

                break;

            case WAIT:

                random(1000, 2500);

                log("waiting"); // what happens when in this case

                if (myPlayer().isAnimating())

                    break;

            case RUNNINGAWAY:

                NPC npc = npcs.closest("Mugger");

                if (npc != null)

                    log("attempting to runaway");

                    getLocalWalker().walk(CHOPPING_AREA, true);

                log("running from Mugger");

                break;

            }

            return random(200, 300);

        }

        @Override

        public void onExit() {

            log("Done Already?");

        }

        @Override

        public void onPaint(Graphics2D g) {

        }

    }

     

    i may need to add a sleep timer in the running away case, because it kinda took a while and ran back and forth sort of awkwardly..would that be the way to stop that from occuring?

    You can either have 2 different cases, CUTOAK, CUTTREE, or you can do a boolean inside your chop case. So if(oak &&oakTree!=null || tree&&regTree!=null)

     

    Or for the two different cases you can do get the skill level, then check to see if it's greater than or equal to 15, and if it is, cut oaks, and if not, cut trees.

  6. No, it was just an example of fetching a directory.

     

    Also, @ op, yes, you need to copy and paste those. I'm not going to tell you exactly how to do it, it is paramount you learn yourself. But i've shown you how to grab and write elements to a file.

     

    Also, you can see that i've done it without arrays. This is probably the best way of doing it if you have 2-3 lines but after that it may become somewhat strenuous. So you'll need to implement arrays if you have more than 6 lines, just to make it tidier.

     

    apa

     

    blush.png Awkward. I just saw the osbot directory and thought it was what you sent me like 4 months ago

  7. Nice and straightforward, perfect way to practice file interaction

     

    Here's a method which botre sent me a while back, should do the trick for loading the data. (modified the onLoadData() method to show you how to load ints, Strings and booleans).

    	public void loadData() {
    		FileReader fileReader = null;
    		try {
    			fileReader = new FileReader(OSBDirectory.GUI_DIRECTORY
    					+ OSBDirectory.separator + "test.txt"); //example directory
    		} catch (FileNotFoundException e) {
    			return;
    		}
    		BufferedReader bufferedReader = new BufferedReader(fileReader);
    		onLoadSettings(bufferedReader);
    		try {
    			bufferedReader.close();
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    	}
    
    public void onLoadData(BufferedReader bufferedReader) {
    		try {
    			boolean b = Boolean.parseBoolean(bufferedReader.readLine()); //reads first line and saves into local var b as a boolean.
    		} catch (NumberFormatException | IOException e) {
    			e.printStackTrace();
    		}
    		try {
    			int i = Integer.parseInt(bufferedReader.readLine()); //reads second line and saves into local var i as an int.
    		} catch (IOException e) {
    			e.printStackTrace();
    		} catch (NumberFormatException e) {
    			e.printStackTrace();
    		}
    		try {
    			String s = (bufferedReader.readLine()); //reads the 3rd line outputting the line into local variable s as a String.
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
    }
    

    As for saving the settings:

    public void saveSettings() {
    		PrintWriter writer = null;
    		try {
    			writer = new PrintWriter(OSBDirectory.GUI_DIRECTORY
    					+ OSBDirectory.separator + "test.txt", "UTF-8"); //example directory, look at docs for exact implementation of PrintWriter()
    		} catch (FileNotFoundException e) {
    			e.printStackTrace();
    		} catch (UnsupportedEncodingException e) {
    			e.printStackTrace();
    		}
    		onSaveSettings(writer);
    		writer.flush();
    		writer.close();
    	}
    
    	public void onSaveSettings(PrintWriter writer) {
    		writer.println(boolean b);
    		writer.println(int i);
    		writer.println(String s);
    	}
    
    ** Saves the format into a file in the given directory under the name test.txt in the form:
    
    b
    i
    s
    
    dont forget the file needs creating.
    **
    

    You should hopefully find it really straight forward after I ggave you that as a starting point hehe

     

    Apa

     

    I was so confused on why you were telling him to read from the osbot directiory, then I realized this was from your rock crab script.

     

  8. I am using Apaecs guide, but added wood cutting instead of thieving tea from stalls. I am trying to bank the oak logs that I have chopped. Any ideas?
    
    
    
    package sixshots2;
    
    import org.osbot.rs07.api.Bank;
    import org.osbot.rs07.api.*;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    
    import java.awt.*;
    
    @ScriptManifest(author = "CaptWingo", info = "My first script", name = "OakCutting", version = 1.01, logo = "")
    public class sixshots extends Script {
    
    	@Override
    	public void onStart() {
    		
    	}
    
    	private enum State {
    		Chop, Wait, Bank
    	};
    
    	private State getState() {
    		Entity Oak = objects.closest("Oak");
    		if (!inventory.isEmpty())
    			return State.Bank;
    		if (Oak != null)
    			return State.Chop;
    		return State.Wait;
    	}
    
    	@Override
    	public int onLoop() throws InterruptedException {
    		switch (getState()) {
    		case Chop:
    			Entity Oak = objects.closest("Oak");
    			if (Oak != null) {
    				Oak.interact("Chop-down");
    			}
    			break;
    		case Bank:
    			inventory.store.Deposit(OakLogs);
    			break;
    		case Wait:
    			sleep(random(500, 700));
    			break;
    		}
    		return random(200, 300);
    	}
    
    	@Override
    	public void onExit() {
    		
    	}
    
    	@Override
    	public void onPaint(Graphics2D g) {
    
    	}
    
    } 

     

    You need 4 states. Bank, WalkToBank, Chop, and WalkToTrees. They should be as follows

    if(inventory.isFull()&&!BANKAREA.contains(myPlayer())
    return State.WALKTOBANK;
    if(inventory.isFull()&&BANKAREA.CONTAINS(myPlayer())
    return State.BANK;
    if(!inventory.isFull()&&TREEAREA.contains(myPlayer())
    return State.CHOP;
    if(!inventory.isFull()&&!TREEAREA.conntains(myPlayer())
    return State.WALKTOTREES;
    

    So you're going to need to make paths for walking to the bank, walking to tthe trees, and areas for the bank and the area you want to cut oaks.

     

    Then for banking, it should look something like this

    if(bank.isOpenn())
    {
    Entity bankBooth = objects.closest("Bank booth")
    bankBooth.interact("Bank");
    bank.depositAll("Oak logs");
    sleep(random(500,1000));
    bank.close;
    }
    else
    bankBooth.interact("Bank");
    sleep(random(500,1000));
    
    • Like 1
  9. Or, parents can teach their children to stop being homophobic pieces of shit, resulting in the child with 2 moms / 2 dads not having to deal with any shit about it. Puke.gif

     

    I blame it on religion. It has done more wrong for the world than right. This isn't some edgy atheist post(I'm not even atheist), It's just my opinion.

    • Like 2
×
×
  • Create New...