Jump to content

A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec


Apaec

Recommended Posts

  On 4/22/2015 at 3:03 PM, moore said:

 

Replace your getState() method with this

private State getState() {
		Entity FS = npcs.closest("Fishing spot");
		if (!inventory.isEmptyExcept("Small fishing net"))
			return State.DROP;
		if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving())
			return State.FISH;
		return State.WAIT;
	}

 

fixed

private State getState() {	
if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP;
else {
Entity FS = npcs.closest("Fishing spot");
if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) {
return State.FISH;
}                 
return State.WAIT;
}
Link to comment
Share on other sites

  On 4/22/2015 at 3:03 PM, moore said:

 

Replace your getState() method with this

private State getState() {
		Entity FS = npcs.closest("Fishing spot");
		if (!inventory.isEmptyExcept("Small fishing net"))
			return State.DROP;
		if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving())
			return State.FISH;
		return State.WAIT;
	}

 

 

  On 4/22/2015 at 3:40 PM, Botre said:

 

fixed

private State getState() {	
if (!inventory.isEmptyExcept("Small fishing net")) return State.DROP;
else {
Entity FS = npcs.closest("Fishing spot");
if (FS != null && !myPlayer.isAnimating() && !myPlayer.isMoving()) {
return State.FISH;
}                 
return State.WAIT;
}

Thanks both, got it working!

Link to comment
Share on other sites

Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously)

 

Errors in eclipse were: state cannot be resolved to a type 

Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable

 

My script

  Reveal hidden contents

 
 
Edited by Aart1
Link to comment
Share on other sites

  On 5/6/2015 at 10:15 AM, Aart1 said:

Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously)

Errors in eclipse were: state cannot be resolved to a type

Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable

My script

  Reveal hidden contents

Make it public enum State and not state.

Link to comment
Share on other sites

  On 5/6/2015 at 10:15 AM, Aart1 said:

 

Followed your guide and i really enjoyed it, i tried to make a simple lesser demon killer but i received a couple errors in eclipse as well as in OSbot (obviously)

 

Errors in eclipse were: state cannot be resolved to a type 

Errors in OSbot were: unknown source, wait and attack cannot be resolved to a variable

 

 

...

    case wait: 
    sleep(random(500, 700));
    break;

 

Another thing I noticed is that in your switch block, "wait" should be "WAIT". Your private enum has entries ATTACK and WAIT, and Java is case-sensitive. Case "wait" will never trigger as is. 

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...