Rumple Posted November 27, 2018 Share Posted November 27, 2018 Hi I am struggling a little bit with compiling. I want this to pump indefinntly until I stop getting str xp witch should be every 5 mins, then it should continue to the next object which is the coke and fill up until it recieves a message to continue (which mean all spades full x 28) then should move on to fill the stove with coke and wait for another message to continue, once it sees the message it should go back to pumping until the xp stop and loop again. public int onLoop() throws InterruptedException { int starting = getExperienceTracker().getGainedXP(Skill.STRENGTH); Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous)); if (nextObj != null && myPlayer().getInteracting() == null && !getDialogues().isPendingContinuation()) { if (nextObj.interact(nextObj.getActions()[0])) { new ConditionalSleep(10000) { @Override public boolean condition() throws InterruptedException { return getExperienceTracker().getGainedXP(Skill.STRENGTH) < starting; } }.sleep(); } if (getExperienceTracker().getGainedXP(Skill.STRENGTH) > starting){ previous = nextObj; } } return 250; } Please help. http://prntscr.com/lnqzk2 Quote Link to comment Share on other sites More sharing options...
R I F T Posted November 27, 2018 Share Posted November 27, 2018 (edited) Had a quick google and found a stack overflow question which has seems to have a good answer on how to solve your problem: https://stackoverflow.com/questions/23211589/error1-1illegalcharacter-ufeff-when-compiling-on-android-studio Top answer: Quote That's a problem related to BOM (Byte Order Mark) character. Byte Order Mark BOM is a Unicode character used for defining a text file byte order and comes in the start of the file. Eclipse doesn't allow this character at the start of your file, so you must delete it. For this purpose, use a rich text editor, such as Notepad++, and save the file with encoding "UTF-8 without BOM." That should remove the problem. Incorrectly copy/pasting code from somewhere in the forums sometimes gives me syntax errors, so be careful when you're using snippets etc. Edited November 27, 2018 by R I F T Added possible cause Quote Link to comment Share on other sites More sharing options...
Rumple Posted November 29, 2018 Author Share Posted November 29, 2018 Thanks you resolved, got banned trying to write this script. -_- Quote Link to comment Share on other sites More sharing options...
Rumple Posted November 29, 2018 Author Share Posted November 29, 2018 Okay So i thought i did this right. @Override public int onLoop() throws InterruptedException { int starting = getExperienceTracker().getGainedXP(Skill.STRENGTH); Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) && Arrays.asList(actions).contains(obj.getActions()[0]) && (getMap().canReach(obj)) && !obj.equals(previous)); if(nextObj != null && myPlayer().getInteracting() == null && getExperienceTracker().getGainedXP(Skill.STRENGTH) > starting){ if(nextObj.interact(nextObj.getActions()[0])){ new ConditionalSleep(1000){ @Override public boolean condition() throws InterruptedException{ return getExperienceTracker().getGainedXP(Skill.STRENGTH) < starting; } }.sleep(); }if (getExperienceTracker().getGainedXP(Skill.STRENGTH) > starting && getDialogues().isPendingContinuation()) { previous = nextObj; } } return 250; } I want it to pump until it doesnt get str exp. which is 5 mins. once the xp stops it should move on the the next object which is the shoveling the coke until it sees a message (should do whole inv) move on to filling the furnace it should give another message when you are out of coke. then move on back to pumping and loop around like that, but it doesnt. just starts to pump and gets few exp then skips to furnace and stops when gets message. help pls. Quote Link to comment Share on other sites More sharing options...
R I F T Posted November 29, 2018 Share Posted November 29, 2018 I'm commuting home from work rn so I can't read the code, but I think people may be more inclined to help you if you broke some of that logic inside your onLoop into methods to make it easier to read Quote Link to comment Share on other sites More sharing options...
jca Posted November 30, 2018 Share Posted November 30, 2018 (edited) 19 hours ago, Rumple said: Okay So i thought i did this right. I want it to pump until it doesnt get str exp. which is 5 mins. once the xp stops it should move on the the next object which is the shoveling the coke until it sees a message (should do whole inv) move on to filling the furnace it should give another message when you are out of coke. then move on back to pumping and loop around like that, but it doesnt. just starts to pump and gets few exp then skips to furnace and stops when gets message. help pls. What you're doing seems a little strange... public int onLoop(){ if ( ! myPlayer().isAnimating() ){ if ( needsToRefuelStove() ){ refuelStove(); } else if ( needsToShovelCoke() ){ shovelCoke(); } else { operatePump(); } } return 200; } private void refuelStove(){} private void shovelCoke(){} private void operatePump(){ RS2Object pump = getObjects().closest("Pump"); if ( pump != null && pump.interact("Operate") ){ new ConditionalSleep(3000){ @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep() } } /* Booleans for you to fill */ private boolean needsToRefuelStove(){ return false; } private boolean needsToShovelCoke(){ return false; } By splitting your code out like this it's a lot easier to see what's going on. As far as checking strength XP, a better way would be to check if your player is animating, if so you don't need to do anything, if not then see which action is next. Edited November 30, 2018 by jca 2 Quote Link to comment Share on other sites More sharing options...
Rumple Posted November 30, 2018 Author Share Posted November 30, 2018 6 hours ago, jca said: What you're doing seems a little strange... public int onLoop(){ if ( ! myPlayer().isAnimating() ){ if ( needsToRefuelStove() ){ refuelStove(); } else if ( needsToShovelCoke() ){ shovelCoke(); } else { operatePump(); } } return 200; } private void refuelStove(){} private void shovelCoke(){} private void operatePump(){ RS2Object pump = getObjects().closest("Pump"); if ( pump != null && pump.interact("Operate") ){ new ConditionalSleep(3000){ @Override public boolean condition() throws InterruptedException { return myPlayer().isAnimating(); } }.sleep() } } /* Booleans for you to fill */ private boolean needsToRefuelStove(){ return false; } private boolean needsToShovelCoke(){ return false; } By splitting your code out like this it's a lot easier to see what's going on. As far as checking strength XP, a better way would be to check if your player is animating, if so you don't need to do anything, if not then see which action is next. Thats the thing is that you do not stop animating after 5 minutes u keep pumping except it is without exp. I either have to set a timer for 5 mins or check to make sure im getting str exp before continuing to pump. Quote Link to comment Share on other sites More sharing options...
jca Posted November 30, 2018 Share Posted November 30, 2018 (edited) 24 minutes ago, Rumple said: Thats the thing is that you do not stop animating after 5 minutes u keep pumping except it is without exp. I either have to set a timer for 5 mins or check to make sure im getting str exp before continuing to pump. I see. private long strengthXp; public int onLoop(){ if ( myPlayer().isAnimating() && hasGainedStrengthXp() ){ strengthXp = getExperienceTracker().getGainedXp(Skill.STRENGH); return 3000; } else { // do loop } return 200; } private boolean hasGainedStrenghtXp(){ return getExperienceTracker().getGainedXp(Skill.STRENGTH) > strengthXp; } This will check whether your player is animating and current strength experience is greater than previous strength experience, if it is then set new strength xp gauge and pause for 3 secs until the next check. You can improve this with a conditional sleep and interval to check. Edited November 30, 2018 by jca 1 Quote Link to comment Share on other sites More sharing options...