MarWo22 Posted March 19, 2018 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.
Woody Posted March 19, 2018 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
MarWo22 Posted March 19, 2018 Author Posted March 19, 2018 thank you stupid of me that I didnt think of that myself
Chikan Posted March 19, 2018 Posted March 19, 2018 10 minutes ago, Chris said: dont use states its trash just throw it all on loop bro 1
HeyImJamie Posted March 19, 2018 Posted March 19, 2018 32 minutes ago, Chris said: dont use states its trash Ur trash
FrostBug Posted March 19, 2018 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
andrewboss Posted March 19, 2018 Posted March 19, 2018 1 hour ago, Chris said: dont use states its trash Why?
Chris Posted March 19, 2018 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
Woody Posted March 19, 2018 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?
Woody Posted March 19, 2018 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
gptaqbc Posted March 19, 2018 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.