December 1, 201510 yr Hello everyone. I got into scripting yesterday and I am currently working on a chicken killing script. Sometimes the bot will get stuck outside. Here is my gate opening code. Why doesn't it work? if(chatbox.contains(MessageType.GAME, "I can't reach that!")) { Entity gate = objects.closest("Gate"); if(gate != null) { gate.interact("Open"); } I know this isn't the smartest way to implement a check. As if it happens once it will continue to try opening the gate because the message will remain in the chat. But i will fix it later. For now i just want to know why it won't work. Edit: Solved the problem. Edited December 1, 201510 yr by flamingstick70
December 2, 201510 yr If anyone else has this problem, a solution is to check if the gate is open already, and if it's not open, that's when you run your open command. Credit to Explv for giving me this in the chat box public boolean doorIsClosed(RS2Object door) { return Arrays.asList(door.getDefinition().getActions()).contains("Open"); }
December 2, 201510 yr If anyone else has this problem, a solution is to check if the gate is open already, and if it's not open, that's when you run your open command. Credit to Explv for giving me this in the chat box public boolean doorIsClosed(RS2Object door) { return Arrays.asList(door.getDefinition().getActions()).contains("Open"); }
December 2, 201510 yr If anyone else has this problem, a solution is to check if the gate is open already, and if it's not open, that's when you run your open command. Credit to Explv for giving me this in the chat box public boolean doorIsClosed(RS2Object door) { return Arrays.asList(door.getDefinition().getActions()).contains("Open"); } public boolean doorIsClosed(RS2Object door) { return door.hasAction("Open"); }
December 2, 201510 yr public boolean doorIsClosed(RS2Object door) { return door.hasAction("Open"); } Much cleaner, thanks for that.
December 2, 201510 yr Much cleaner, thanks for that. You could actually just have something like this: public boolean openNearestGate() { Entity closedGate = getObjects().closest("Gate", (e) -> (e.hasAction("Open"))); //may be incorrect syntax for Objects#closest if (closedGate != null) return closedGate.interact("Open"); return false; }
February 22, 20169 yr I need help. Every time i open the saved and downloaded "osbot" the from my computer it opens up windows.. How do I get the normal little box where you log in to open up?I'm not not really tech savvy so please explain EVERYTHING if you can. If you could MSG me or w/e they'll be awesome! Thanks
Create an account or sign in to comment