henrique190 8 Share Posted April 13, 2015 hi good night for all, how can i use the code for player im area, sorry for my bad english but i traying this: private final Area SPOT = new Area(3199, 3191, 3248,3240); SPOT.contains(getLocalPlayer()) Link to comment Share on other sites More sharing options...
DefCon 121 Share Posted April 13, 2015 Ur code should work fine, only problem i see is that u should make that variable name camelCase. http://dreambot.org/javadocs/org/dreambot/api/methods/map/Area.html contains public boolean contains(Entity e) Checks if an Area contains the Entity if(SPOT.contains(getLocalPlayer())){ // hey im in area } Link to comment Share on other sites More sharing options...
doTeam_root 5 Share Posted April 14, 2015 getLocalPlayer().getTile() Link to comment Share on other sites More sharing options...
Fran 99 Share Posted April 14, 2015 getLocalPlayer().getTile() This. private final Area SPOT = new Area(3199, 3191, 3248,3240); SPOT.contains(getPlayers().myPlayer().getTile()); E: Don't forget the semicolons lol Link to comment Share on other sites More sharing options...
Computor 178 Share Posted April 14, 2015 This. private final Area SPOT = new Area(3199, 3191, 3248,3240); SPOT.contains(getPlayers().myPlayer().getTile()); E: Don't forget the semicolons lol His original code works fine. You don't need to do that extra shit. SPOT.contains(getLocalPlayer()) works fine. Link to comment Share on other sites More sharing options...
Fran 99 Share Posted April 14, 2015 His original code works fine. You don't need to do that extra shit. SPOT.contains(getLocalPlayer()) works fine. It won't work if he doesn't check the tile, per my understanding Link to comment Share on other sites More sharing options...
Novak 35 Share Posted April 14, 2015 It won't work if he doesn't check the tile, per my understanding local player most likely inherits the tile info by default, so getLocalPlayer() would be fine Link to comment Share on other sites More sharing options...
Vlad 216 Share Posted April 14, 2015 A Player is a Character which is an Entity. http://dreambot.org/javadocs/org/dreambot/api/methods/map/Area.html#contains-org.dreambot.api.wrappers.interactive.Entity- No need for the .getTile() part. Link to comment Share on other sites More sharing options...
henrique190 8 Author Share Posted April 15, 2015 Thanks all for the greatest support, with your help I did my first script! thank you all import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.Category; import org.dreambot.api.utilities.impl.Condition; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest(author = "henrique", name = "BR Chopper", version = 1.0, description = "Corta Arvores", category = Category.WOODCUTTING) public class main extends AbstractScript { private final Tile Fugir = new Tile(3000, 3000, 0); public boolean EmAtaque() { return getLocalPlayer().isInCombat(); } public boolean Correr() { // if (getWalking().isRunEnabled()) // return getWalking().walk(Fugir); // else { // getWalking().toggleRun(); return getWalking().walk(Fugir); // } } String Axe[] = { "Rune axe", "Bronze axe", "Iron axe", "Steel Axe", "Black axe", "Mithril axe", "Adamant axe" }; private final Tile IR_SPOT = new Tile(3177, 3250, 0); private final Area Spot = new Area(3177, 3178, 3250, 3254, 0); public boolean maldito() { GameObject Tree = getGameObjects().closest("Tree"); return Tree.distance() <= 5; } public Boolean movendo() { return getLocalPlayer().isMoving(); } public boolean Anima() { return getLocalPlayer().getAnimation() == -1; } public boolean invcheio() { return (getInventory().isFull()); } public boolean podecortar() { GameObject Tree = getGameObjects().closest("Tree"); return (Tree != null && Tree.isOnScreen()); } public boolean lugar() { return Spot.contains(getLocalPlayer().getTile()); } private enum State { IR, CORTAR, DROPAR, ESPERAR; }; private State getState() { if (lugar()) { log("lugar"); if (invcheio()) { log("inv"); return State.DROPAR; } else if (podecortar() && Anima() && !movendo() && lugar()) { log("pode cortar"); return State.CORTAR; } return State.ESPERAR; } else { log("IR"); return State.IR; } } public void onStart() { log("Iniciando"); log("Vamos"); } public void onExit() { log("Iniciando"); log("Obrigado por usar, volte sempre!!"); } @Override public int onLoop() { switch (getState()) { case IR: getWalking().walk(IR_SPOT); break; case CORTAR: if (maldito()) { GameObject Tree = getGameObjects().closest("Tree"); Tree.interact("Chop down"); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() == -1; } }, Calculations.random(1800, 2400)); } break; case DROPAR: getInventory().dropAllExcept(Axe); break; case ESPERAR: Calculations.random(500, 600); break; } return Calculations.random(500, 600); } } Link to comment Share on other sites More sharing options...
Fran 99 Share Posted April 15, 2015 Thanks all for the greatest support, with your help I did my first script! thank you all import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.map.Area; import org.dreambot.api.methods.map.Tile; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.Category; import org.dreambot.api.utilities.impl.Condition; import org.dreambot.api.wrappers.interactive.GameObject; @ScriptManifest(author = "henrique", name = "BR Chopper", version = 1.0, description = "Corta Arvores", category = Category.WOODCUTTING) public class main extends AbstractScript { private final Tile Fugir = new Tile(3000, 3000, 0); public boolean EmAtaque() { return getLocalPlayer().isInCombat(); } public boolean Correr() { // if (getWalking().isRunEnabled()) // return getWalking().walk(Fugir); // else { // getWalking().toggleRun(); return getWalking().walk(Fugir); // } } String Axe[] = { "Rune axe", "Bronze axe", "Iron axe", "Steel Axe", "Black axe", "Mithril axe", "Adamant axe" }; private final Tile IR_SPOT = new Tile(3177, 3250, 0); private final Area Spot = new Area(3177, 3178, 3250, 3254, 0); public boolean maldito() { GameObject Tree = getGameObjects().closest("Tree"); return Tree.distance() <= 5; } public Boolean movendo() { return getLocalPlayer().isMoving(); } public boolean Anima() { return getLocalPlayer().getAnimation() == -1; } public boolean invcheio() { return (getInventory().isFull()); } public boolean podecortar() { GameObject Tree = getGameObjects().closest("Tree"); return (Tree != null && Tree.isOnScreen()); } public boolean lugar() { return Spot.contains(getLocalPlayer().getTile()); } private enum State { IR, CORTAR, DROPAR, ESPERAR; }; private State getState() { if (lugar()) { log("lugar"); if (invcheio()) { log("inv"); return State.DROPAR; } else if (podecortar() && Anima() && !movendo() && lugar()) { log("pode cortar"); return State.CORTAR; } return State.ESPERAR; } else { log("IR"); return State.IR; } } public void onStart() { log("Iniciando"); log("Vamos"); } public void onExit() { log("Iniciando"); log("Obrigado por usar, volte sempre!!"); } @Override public int onLoop() { switch (getState()) { case IR: getWalking().walk(IR_SPOT); break; case CORTAR: if (maldito()) { GameObject Tree = getGameObjects().closest("Tree"); Tree.interact("Chop down"); sleepUntil(new Condition() { public boolean verify() { return getLocalPlayer().getAnimation() == -1; } }, Calculations.random(1800, 2400)); } break; case DROPAR: getInventory().dropAllExcept(Axe); break; case ESPERAR: Calculations.random(500, 600); break; } return Calculations.random(500, 600); } } Dat Portuguese Nice job henrique Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.