Bonnie 2 Share Posted September 28, 2015 public class main extends AbstractScript { Area generalArea = new Area(3327, 4751, 3327, 4752, 0); Area PortalArea = new Area(3326, 4768, 3334, 4761, 0); public void onStart() { log("Welcome"); } private enum State { PRAY, ENTER, GOIN }; private State getState() { GameObject stall = getGameObjects().closest("Free-for-all portal"); if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){ return State.PRAY; if (stall != null) return State.ENTER; if(generalArea.contains(getPlayers().localPlayer().getTile())) return State.GOIN; } public void onExit() } @Override public int onLoop() { switch (getState()) { case PRAY: sleep(922,4219); getPrayer().toggleQuickPrayer(true); break; case ENTER: sleep(722,3219); GameObject stall = getGameObjects().closest("Free-for-all portal"); if (stall != null) { stall.interact("Enter"); break; case GOIN: sleep(5867,8720); log("Walking to the middle"); Tile[] tiles = PortalArea.getTiles(); Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)]; if (randomTile != null) { getWalking().walk(randomTile); sleepUntil(new Condition() { public boolean verify() { return PortalArea.contains(getPlayers().localPlayer() .getTile()); } }, Calculations.random(1600, 1800)); } } } Really confused on getting rid of these syntax errors, been messing around 15minutes and everything i try just causes more problems If anyone could help that would be awesome. Link to comment Share on other sites More sharing options...
Zawy 964 Share Posted September 28, 2015 First error: public void onExit() { } Actually, You forgot a bracelet at your getState() again. Basically, you keep forgetting to close your methods. Link to comment Share on other sites More sharing options...
Bonnie 2 Author Share Posted September 28, 2015 First error: public void onExit() { } Actually, You forgot a bracelet at your getState() again. Basically, you keep forgetting to close your methods. Thanks, i got that part sorted but i cant figure out the last error, i feel so retarded lol First day ever trying to mess with scripts, just want to move on to the paint tutorial but cant get past this public class main extends AbstractScript { Area GeneralArea = new Area(3327, 4751, 3327, 4752, 0); Area PortalArea = new Area(3326, 4768, 3334, 4761, 0); public void onStart() { log("Welcome"); } private enum State { PRAY, ENTER, GOIN }; private State getState() { GameObject stall = getGameObjects().closest("Free-for-all portal"); if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){ return State.PRAY; if (stall != null) return State.ENTER; if(GeneralArea.contains(getPlayers().localPlayer().getTile())) return State.GOIN; } } public void onExit() { } @Override public int onLoop() { switch (getState()) { case PRAY: sleep(922,4219); getPrayer().toggleQuickPrayer(true); break; case ENTER: sleep(722,3219); GameObject stall = getGameObjects().closest("Free-for-all portal"); if (stall != null) { stall.interact("Enter"); } break; case GOIN: sleep(5867,8720); log("Walking to the middle"); Tile[] tiles = PortalArea.getTiles(); Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)]; if (randomTile != null) { getWalking().walk(randomTile); sleepUntil(new Condition() { public boolean verify() { return PortalArea.contains(getPlayers().localPlayer() .getTile()); } }, Calculations.random(1600, 1800)); } } } Link to comment Share on other sites More sharing options...
Zawy 964 Share Posted September 28, 2015 Thanks, i got that part sorted but i cant figure out the last error, i feel so retarded lol First day ever trying to mess with scripts, just want to move on to the paint tutorial but cant get past this public class main extends AbstractScript { Area GeneralArea = new Area(3327, 4751, 3327, 4752, 0); Area PortalArea = new Area(3326, 4768, 3334, 4761, 0); public void onStart() { log("Welcome"); } private enum State { PRAY, ENTER, GOIN }; private State getState() { GameObject stall = getGameObjects().closest("Free-for-all portal"); if(getSkills().getBoostedLevels(Skill.HITPOINTS) > 1){ return State.PRAY; if (stall != null) return State.ENTER; if(GeneralArea.contains(getPlayers().localPlayer().getTile())) return State.GOIN; } } public void onExit() { } @Override public int onLoop() { switch (getState()) { case PRAY: sleep(922,4219); getPrayer().toggleQuickPrayer(true); break; case ENTER: sleep(722,3219); GameObject stall = getGameObjects().closest("Free-for-all portal"); if (stall != null) { stall.interact("Enter"); } break; case GOIN: sleep(5867,8720); log("Walking to the middle"); Tile[] tiles = PortalArea.getTiles(); Tile randomTile = tiles[Calculations.random(0, tiles.length - 1)]; if (randomTile != null) { getWalking().walk(randomTile); sleepUntil(new Condition() { public boolean verify() { return PortalArea.contains(getPlayers().localPlayer() .getTile()); } }, Calculations.random(1600, 1800)); } } } Add another bracelet at the end to close your loop. Link to comment Share on other sites More sharing options...
Bonnie 2 Author Share Posted September 28, 2015 Add another bracelet at the end to close your loop. When i tried that i ended up with more errors so i thought it was wrong, so confused this is what happens when i add another bracket Link to comment Share on other sites More sharing options...
Zawy 964 Share Posted September 28, 2015 When i tried that i ended up with more errors so i thought it was wrong, so confused this is what happens when i add another bracket I suggest taking some Java courses. You can't make a script if you don't know what you're doing. Link to comment Share on other sites More sharing options...
Bonnie 2 Author Share Posted September 28, 2015 I suggest taking some Java courses. You can't make a script if you don't know what you're doing. I would if i was getting super into it, just need to add a few more things to this and i probly wont ever do it again. ended up remaking it without states since i cant figure it out Link to comment Share on other sites More sharing options...
Nuclear Nezz 2061 Share Posted September 28, 2015 You really should at least know the basics of java before trying to script. I don't think many people will want to hold you hand through the absolute basics. Link to comment Share on other sites More sharing options...
Bonnie 2 Author Share Posted September 28, 2015 You really should at least know the basics of java before trying to script. I don't think many people will want to hold you hand through the absolute basics. Ye i understand, finally figured it out and finished the NS bot Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted September 28, 2015 I started from 0 haha and now I get scripting lessons at school. but it's indeed the wrong way to do it, you can learn yourself though like with http://www.w3schools.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.