September Posted December 1, 2015 Share Posted December 1, 2015 (edited) 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, 2015 by flamingstick70 Quote Link to comment Share on other sites More sharing options...
Zappster Posted December 2, 2015 Share Posted December 2, 2015 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"); } 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted December 2, 2015 Share Posted December 2, 2015 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"); } Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted December 2, 2015 Share Posted December 2, 2015 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"); } 2 Quote Link to comment Share on other sites More sharing options...
Zappster Posted December 2, 2015 Share Posted December 2, 2015 public boolean doorIsClosed(RS2Object door) { return door.hasAction("Open"); } Much cleaner, thanks for that. Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted December 2, 2015 Share Posted December 2, 2015 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; } Quote Link to comment Share on other sites More sharing options...
topshop Posted February 22, 2016 Share Posted February 22, 2016 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 Quote Link to comment Share on other sites More sharing options...