-
Wont stop looping!
Oh very true! I just wanted to see if I would beable to make a simple bot, I wont actually use this until I make it better. Im experimenting with different things and seeing what I can get to work and what I cant. I do have the API opened on the other monitor to help me while I'm writing a script. Thank you for the advice I'll keep searching around and looking at other codes for quick and easy help
-
Wont stop looping!
I'm just looking for help because I'm still learning. I am far from great at it and that was the original code, I did not paste it incorrectly. If you aren't interested in helping then please, poke fun somewhere else.
-
Wont stop looping!
case BUY: if (inventory.isEmptyExcept("Coins")){ RS2Object Chest = objects.closest("Chest"); if (Chest.interact("Buy-food")){ sleep(random(600,800)); if (mouse.move(377, 130)){ sleep(random(600,900)); mouse.click(true); sleep(1000); mouse.move(364, 198); mouse.click(false); sleep(random(200,800)); } } }break; It just opens the chest, moves the mouse to destination and then hovers it for a few seconds and then closes the chest interface and keeps looping through it. Any ideas on how I would be able to fix this? Again..sorry for the every other white line...Still not quite sure on how to make them go away lulz.
-
Bot wont stop clicking!
Lmao, I'm still learning! cut me some slack! How else could I make the bot stop clicking?
-
Bot wont stop clicking!
I tried, still did the clicking
-
Bot wont stop clicking!
case SPIN: if (!player.isAnimating()){ if (SPIN_AREA.contains(player) && (inventory.contains("Flax"))){ objects.closest("Spinning wheel").interact("Spin"); sleep(random(200,600)); Inter.interactWithChild(459, 91, "Make X"); sleep(random(1000, 1500)); RS2Interface Inter = interfaces.get(118); if (Inter.getMessage(118) != null){ keyboard.typeString("99"); sleep(random(2000,4000)); }else{ sleep(random(60000, 62000)); } } } break; Why does my bot keep clicking on the spinning wheel even when it starts to spin flax? I tried making it sleep(random(60000, 62000)) but that didn't work...
-
ERROR when starting script?
I don't recall removing anything from the script before posting it What does the error mean?
-
ERROR when starting script?
Heh, Thank you. I wasn't quite sure how to get rid of those every-other white line.
-
ERROR when starting script?
import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.Area; import org.osbot.rs07.api.Client; import org.osbot.rs07.api.Interfaces; import java.awt.*; @ScriptManifest(author = "ME", info = "My second script", name = "FlaxSpinner", version = 0, logo = "") public class Main extends Script { @Override public void onStart() { log("Let's get started!"); } final int BANK_BOOTH_ID = 18491; RS2Object bankBooth = objects.closest("Bank booth"); private static final Area SPIN_AREA = new Area(3208, 3212, 3211, 3216); RS2Object Spinning_wheel = objects.closest("Spinning wheel"); Interfaces Inter = objects.getInterfaces(); Client client = objects.getClient(); Player player = myPlayer(); RS2Object Stair_Case = objects.closest("Staircase"); RS2Object Door = objects.closest("Door"); private enum State{ SPIN, BANK, WALK_TO_WHEEL, WALK_TO_BANK; } private State getState() { if (inventory.contains("Flax") && SPIN_AREA.contains(player.getPosition())){ return State.SPIN; } else if(!inventory.contains("Flax") && SPIN_AREA.contains(player.getPosition())){ return State.BANK; } else if(inventory.contains("Flax") && !SPIN_AREA.contains(player.getPosition())){ return State.WALK_TO_WHEEL; } else{ return State.WALK_TO_BANK; } } private boolean checkDoorIsOpen(){ if(Door != null) { for(String actions: Door.getDefinition().getActions()) { if(actions.contains("Open")) { return true; } } } return false; } @Override public int onLoop() throws InterruptedException { switch(getState()){ case SPIN: outerIf: if(!myPlayer().isAnimating()){ sleep(random(500, 1000)); if(!inventory.contains("Flax")){ sleep(random(600, 800)); break outerIf; } while(!player.isAnimating()){ sleep(random(50, 100)); Spinning_wheel.interact("Spin"); Inter.interactWithChild(459, 91, "Make X"); if (Inter.containingText("Enter amount:") != null){ sleep(random(1000,2000)); keyboard.typeString("99"); break outerIf; } } } break; case BANK: if(bankBooth != null){ if(bankBooth.interact("Bank")){ while(!bank.isOpen()){ sleep(random(250, 400)); } bank.depositAll("Bow string"); if(bank.contains("Flax")){ bank.withdraw("Flax", 28); } else{ stop(); } bank.close(); } } break; case WALK_TO_BANK: localWalker.walk(new Position(3208, 3214, 1)); if(checkDoorIsOpen()){ String status = "Opening the door"; Door.interact("Open"); }else if(!checkDoorIsOpen()){ sleep(random(500,700)); localWalker.walk(new Position(3205,3209,1)); if (Stair_Case != null){ Stair_Case.interact("Climb"); sleep(random(200,300)); Inter.interactWithChild(459, 91, "Climb up the stairs."); localWalker.walk(new Position(3208,3220,2)); } } break; case WALK_TO_WHEEL: localWalker.walk(new Position(3205, 3209, 2)); if(Stair_Case != null){ Stair_Case.interact("Climb-down"); if(checkDoorIsOpen()){ String status = "Opening the door"; Door.interact("Open"); }else if(!checkDoorIsOpen()){ localWalker.walk(new Position(3209, 3213, 1)); } } break; } return random(200, 300); } @Override public void onExit() { log("Thanks for running my FlaxSpinner!"); } @Override public void onPaint(Graphics2D g) { } }
-
ERROR when starting script?
[ERROR][01/22 08:08:24 PM]: Failed to start script [FlaxSpinner] java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.osbot.coM1.run(ve:146) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at Main.<init>(Main.java:18) ... 8 more Prints this out when I try to start a script I've been working on. Do I need to post my script up here also?
-
Walking to and accessing banks?
Thank you very much! I greatly appreciate your quick response!
-
Walking to and accessing banks?
I recently started learning about scripting with Java and I feel like I'm catching on fairly quickly but I am, by all means, no expert. I was wondering if someone could help me with making the bot walk to the bank and access it and deposit all the items in the inventory. I'm completely lost on how to make it do that. Pretty please with a cherry on top Sorry if this isn't in the right place to post this. Just let me know where to post it and I'll post it there asap. Thaaaaaaaaaaaaaaaaaaaaanks!