MarWo22 Posted March 19, 2018 Share Posted March 19, 2018 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. Quote Link to comment Share on other sites More sharing options...
Woody Posted March 19, 2018 Share Posted March 19, 2018 (edited) 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 March 19, 2018 by Woody Quote Link to comment Share on other sites More sharing options...
MarWo22 Posted March 19, 2018 Author Share Posted March 19, 2018 thank you stupid of me that I didnt think of that myself Quote Link to comment Share on other sites More sharing options...
Chris Posted March 19, 2018 Share Posted March 19, 2018 dont use states its trash 1 Quote Link to comment Share on other sites More sharing options...
Chikan Posted March 19, 2018 Share Posted March 19, 2018 10 minutes ago, Chris said: dont use states its trash just throw it all on loop bro 1 Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted March 19, 2018 Share Posted March 19, 2018 32 minutes ago, Chris said: dont use states its trash Ur trash Quote Link to comment Share on other sites More sharing options...
Chris Posted March 19, 2018 Share Posted March 19, 2018 17 minutes ago, HeyImJamie said: Ur trash 1 Quote Link to comment Share on other sites More sharing options...
FrostBug Posted March 19, 2018 Share Posted March 19, 2018 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 Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted March 19, 2018 Share Posted March 19, 2018 11 minutes ago, Chris said: 3 Quote Link to comment Share on other sites More sharing options...
andrewboss Posted March 19, 2018 Share Posted March 19, 2018 1 hour ago, Chris said: dont use states its trash Why? Quote Link to comment Share on other sites More sharing options...
Chris Posted March 19, 2018 Share Posted March 19, 2018 1 hour ago, andrewboss said: Why? Because you're a beginner in java and osbot scripting. PLus states are garbage to learn from 1 Quote Link to comment Share on other sites More sharing options...
Woody Posted March 19, 2018 Share Posted March 19, 2018 2 hours ago, FrostBug said: Should be && instead of || for the result you describe But then it will only return to GRANDEXCHANGE if both of the items are missing Am I missing something? Quote Link to comment Share on other sites More sharing options...
Woody Posted March 19, 2018 Share Posted March 19, 2018 1 hour ago, andrewboss said: Why? Don't listen to them. You should learn how state machine works because you're new to java and it's a good start for you. 1 Quote Link to comment Share on other sites More sharing options...
gptaqbc Posted March 19, 2018 Share Posted March 19, 2018 They want you to use the onLoop() method to do sequential instead of using the states as it is "easier to learn java with" as they said. Quote Link to comment Share on other sites More sharing options...