Jump to content

getState() with multiple if statements


MarWo22

Recommended Posts

private enum State{
		BANK,
		MAKE,
		GRANDEXCHANGE,
	}
	
	private State getState() {
		
		if(inventory.contains(227) && inventory.contains(HighestMarginHerbId))
			return State.MAKE;
		return State.BANK;
	}

First of all im a beginner in scripting and in java.

Im trying to make getState() return GRANDEXCHANGE when bank does not contain the item 227 and HighestMarginHerbId. But it keeps giving me errors. 

Link to comment
Share on other sites

if(!getBank().contains(227) || !getBank.contains(HighestMarginHerbId)) {
  return State.GRANDEXCHANGE;
}

Put that into your getState() method.

If the bank does not contain any of the items with id 227 OR HighestMarginHerbId, it will return to state GRANDEXCHANGE.

Edited by Woody
Link to comment
Share on other sites

1 hour ago, Woody said:

if(!getBank().contains(227) || !getBank.contains(HighestMarginHerbId)) {
  return State.GRANDEXCHANGE;
}

Put that into your getState() method.

If the bank does not contain any of the items with id 227 OR HighestMarginHerbId, it will return to state GRANDEXCHANGE.

Should be && instead of || for the result you describe

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