Jump to content

Issue with localWaler.walkPath


omni4life

Recommended Posts

Thanks for understanding smile.png

Also, states are perfectly fine if you enjoy looking at 1000+ lines of code purely in onLoop. Now, for smaller scripts, this is no issue (2 of my scripts still use states, as do most of my private scripts), but of course when your scripts get larger management is a lot easier with a node system. Doing it earlier simply gets you used to using it which really does help, believe me.

Imagine all of these classes:

cc82a93632193feaa369702e137e5464.png

All clustered into one class, it gets pretty hectic (not saying it would all be there anyway, just using it as an example). Nodes also enforce an OOP programming style, which is infinitely more useful (think objects instead of global variables).

I think it might be worth my time to not try and dive head first into scripting overnight and instead take the time to take some Java courses first. I actually started John Purcell's "Java Tutorial for Complete Beginners" on Udemy and that's definitely going to help me out I think.

 

The next thing I want to tackle is GUI's because at the minute, I'm creating separate scripts for the same skill as I level (i.e. willow cutter, maple, iron miner, coal miner etc) so I think I might take a Swing class. Do you have any recommendations as to good resources for it?

Edited by omni4life
Link to comment
Share on other sites

I think it might be worth my time to not try and dive head first into scripting overnight and instead take the time to take some Java courses first. I actually started John Purcell's "Java Tutorial for Complete Beginners" on Udemy and that's definitely going to help me out I think.

 

The next thing I want to tackle is GUI's because at the minute, I'm creating separate scripts for the same skill as I level (i.e. willow cutter, maple, iron miner, coal miner etc) so I think I might take a Swing class. Do you have any recommendations as to good resources for it?

 

I'm definitely not a good example for learning, as I just dive in without looking at anything, much like assembling IKEA furniture ;)

I believe there are a few good GUI tutorials on here, so look around the tutorial section!

  • Like 1
Link to comment
Share on other sites

Hey guys, kinda new to OSBot and wanted to know how to define areas.

 

I looked at his code and even looked at what tiles at Barbarian Outpost his bank area is pointing to, and that just confused me more since most of them aren't even in the bank. I am thinking the area to just be a box with 4 points and anything within the box is the area... But since there are more than 4 positions (or tiles) being defined, it just confuses me.

 

Can someone clarify on how to define an area? Can an area be used like how I am explaining it? And, what exactly is he trying to do when defining the area with 6 poistions?

 

Thanks in advance.

Link to comment
Share on other sites

Hey guys, kinda new to OSBot and wanted to know how to define areas.

 

I looked at his code and even looked at what tiles at Barbarian Outpost his bank area is pointing to, and that just confused me more since most of them aren't even in the bank. I am thinking the area to just be a box with 4 points and anything within the box is the area... But since there are more than 4 positions (or tiles) being defined, it just confuses me.

 

Can someone clarify on how to define an area? Can an area be used like how I am explaining it? And, what exactly is he trying to do when defining the area with 6 poistions?

 

Thanks in advance.

Hey man, I guess it's my chance to return the help I got smile.png

 

You're correct in saying the area I defined was wrong and should only have two points. That was my fault, I didn't properly know how to use Divine Utility yet and I was clicking the tiles for the area I wanted as opposed to selecting the two corners. Using Divine Utility, you select your top right and bottom left corners (or whatever two corners you see fit).

 

This is the corrected code to define the area within the Barbarian Outpost bank:

	Area bankArea = new Area(new Position(2536, 3575, 0), new Position(2535, 3571, 0));

This defines the two corners and creates a square/rectangle between them.

 

To walk to the bank I did the following: 

private Position[] bankPos = new Position[] { new Position(2519, 3580, 0), new Position(2525, 3571, 0),
new Position(2531, 3571, 0), new Position(2533, 3573, 0), new Position(2535, 3574, 0),
new Position(2536, 3573, 0), };

private State getState() { 
	if (inventory.isFull()) {
		return State.WALK2BANK;
	}
}

 

public int onLoop() throws InterruptedException {
		switch (getState()) {
		case WALK2BANK:
			status = "Walking to bank";
			localWalker.walkPath(bankPos);
			break;
    }
}

My banking method was as follows. Note the area check in line three:

		case BANK:
			log("Case Change to Bank");
			if (inventory.isFull() && bankArea.contains(myPlayer())) {
				status = "Banking";
				log("Status Change and condition check");
				Entity chest = objects.closest(true, bankChest);
				if (!bank.isOpen()) {
					if (chest != null) {
						if (chest.isVisible()) {
							if (!myPlayer().isMoving()) {
								chest.interact("Use");
								sleep(random(1000, 1500));
							}
						}
					} else {
						camera.toEntity(chest);
					}
				} else if (getInventory().contains(
						"Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe")) {
					bank.depositAllExcept(
							"Bronze axe, Iron axe, Steel axe, Black axe, Mithril axe, Adamant axe, Rune axe, Dragon axe");
				} else {
					bank.depositAll();
					sleep(random(200, 300));
				}
			}
			break;

I hope this helps you, if you need any more help just say the word. I know the learning curve is steep, but it can be damn rewarding!

Edited by omni4life
Link to comment
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.

  • Recently Browsing   0 members

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