Krys Posted December 1, 2015 Share Posted December 1, 2015 Nice guide Quote Link to comment Share on other sites More sharing options...
September Posted December 1, 2015 Share Posted December 1, 2015 Thanks for this guide Will surely get into scripting now. I tried to script earlier but the code looked so advanced and tricky. But when you explained each piece of the code i realized it was actually really easy. Quote Link to comment Share on other sites More sharing options...
Saiyan Posted December 7, 2015 Share Posted December 7, 2015 Ur tut does not apply to lemons api m8 Quote Link to comment Share on other sites More sharing options...
Apaec Posted December 23, 2015 Author Share Posted December 23, 2015 Replace this: With this: if (Willow != null) { if (Willow.isVisible()) { Willow.interact("Chop down"); } else { sleep(random(500, 700)); } } The Willow.isVisible will check if the willow actually is visible. If it's visible, then chop. Else, it's gonna sleep for 500 till 700 milliseconds. Randomly. Hope that works buddy. Nope, the name for a willow tree is Willow. But i'm sure you already knew that. interact already has visibility and camera handling checks and methods, so there's no need to call willow#isVisible at all. Infact, what kitiria had originally was probably much better, as your method will get in a continuous sleep loop if the willow isn't null but is off the screen. @Kitiria: If you really wanted to make it more efficient and not get permanently stuck, you can use a filter (a neat way of doing this is with streams, like so): objects.getAll().stream().filter(obj -> (obj.exists() && obj.getName().equals("Willow") && obj.hasAction("Chop-down") && getMap().distance(obj) <= 10)).collect(Collectors.toList()); which will reasonably efficiently generate a collection of all the nearby objects with the name willow and the interaction option chop down within a distance of 10 tiles from the player. you can then proceed to iterate through this collection and further filter it to find your desired tree, and then interact with it like so if (tree != null && tree.exists()) { tree.interact(); } ~apa Quote Link to comment Share on other sites More sharing options...
wolfman Posted December 23, 2015 Share Posted December 23, 2015 eclipse doesnt start for me Quote Link to comment Share on other sites More sharing options...
Apaec Posted December 23, 2015 Author Share Posted December 23, 2015 eclipse doesnt start for me How so? also you're probably better off searching for soultions online - I have very little experience with eclipse troubleshooting as mine's never failed me! apa Quote Link to comment Share on other sites More sharing options...
iTz EcLiPsE Posted January 8, 2016 Share Posted January 8, 2016 so im very confused lol i typed out ur code myself matched it exactly and it failed but i copy/paste urs and it works lol i pmed u the code i typed can u tell me where i went wrong lol Quote Link to comment Share on other sites More sharing options...
Tuwa Posted January 19, 2016 Share Posted January 19, 2016 Thanks a lot, really helpful guide! Quote Link to comment Share on other sites More sharing options...
Guest Posted January 25, 2016 Share Posted January 25, 2016 I am going to try make a script soon lol. Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 27, 2016 Share Posted January 27, 2016 (edited) nice Edited January 27, 2016 by Good4RsVid Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 28, 2016 Share Posted January 28, 2016 Don't worry about pestering me!: ) As for the code, FORMAT IT! From first glance it looks like you've got the bracket alignment wrong in the getState() switch. It's quite hard to read tho as it's all over the place. but generally, an NPE is an easy error to fix. It just means you forgot to null check something - in this case specifically on line 52 (as it says in the stacktrace). Take a look at that line and see if you can figure out what's wrong! (hint - nullcheck the cupboard ) apa See a lot of new questions and answers analysis code, I have also been able to write a simple script that just need to walk with the bank study using this code structure, but the code I clicked him, pages have been removed, impatient, you could get him that code issued to, or send a similar walk to the bank's case it Thank you Quote Link to comment Share on other sites More sharing options...
Good4RsVid Posted January 29, 2016 Share Posted January 29, 2016 如果(cow.getHealth()<8)// IM假设你取名为牛牛人大变量。 //基本上这将检查奶牛的健康,如果其在8也不会攻击它。 { cow.interact(“攻击”); } 你可以添加额外的检查也一样,如果(cow.getHealth()<8 &&!cow.isUnderAttack) 这样你可以有2个检查,看看,如果牛没有损坏,如果牛是不是underattack。如果你想添加第三个检查,您可以使用消息listenter让这句话在客舱“全国人大代表已经受到攻击”或什么做 @覆盖 公共无效的onMessage(消息消息)抛出InterruptedException的 { 如果(message.getMessage()。toString()方法。包括(“已受到攻击。”))//确保这一具有完全一样的短语,情况sensetive所有 { 日志(“这牛是已经受到攻击!”); //然后让你的角色到其他地方或有它做其他操作就得到这个之后。 } } 我不是最好的osbot API / java中一般,但是这应该有点帮助,apaec可能会能够给你更多的建议虽然。 我误解你的问题我不好,要离开,有柜面,虽然其他人是好奇。 你可以做的就是让你杀奶牛在cowpen的一个区域,然后你可以这样做 区COWPEN =新的区域(右上方X,右上方Y,左下方X,左下方Y); 如果(cow.isUnderAttack) { localWalker.walk(COWPEN.getRandomPosition(0)); //将获得一个随机的区域,在牛笔地跑了出去,然后将杀牛是不受到攻击,或者继续这样做,直到它找到一个。 } 挑衅更好的方法,但是这是后话,将工作。 I can write to you, know that the problem exists, but I can not own power or correction. I would like to write in a small area to move the script will not be attacked when there is no cow to walk around to find the target range set me please help me modify Thank you import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "You", info = "My first script", name = "Tea thiever", version = 0, logo = "") public class main extends Script { @Override public void onStart() { log("Welcome to Simple Tea Thiever by Apaec."); log("If you experience any issues while running this script please report them to me on the forums."); log("Enjoy the script, gain some thieving levels!."); } private enum State { WALK, WAIT }; private State getState() { Area COWPEN = new Area(422, 62,51, 332); NPC cow = npcs.closest("Cow"); if(cow.isUnderAttack() && cow.getHealth()<8 ) return State.WALK; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case WALK: NPC cow = npcs.closest("Cow"); if(cow.isUnderAttack() ) { localWalker.walk(COWPEN.getRandomPosition(0));//will get a random area in the cow pen to run off to, then will kill cows that aren't under attack, or keep doing this until it finds one. //} } break; case WAIT: sleep(random(500, 700)); break; } return random(200, 300); } @Override public void onExit() { log("Thanks for running my Tea Thiever!"); } @Override public void onPaint(Graphics2D g) { } } Quote Link to comment Share on other sites More sharing options...
sonda Posted February 4, 2016 Share Posted February 4, 2016 (edited) final Area BONE_AREA = new Area(3092,3298,3092,3512); final Area BANK_AREA = new Area(3097,3497,3093,3494); @Override public void onStart() { log("Initializing Script"); } private enum State { COLLECT, FULL, WAIT }; private State getState() { if (inventory.isFull()) return State.FULL; if (!inventory.isFull()) return State.COLLECT; return State.WAIT; } @Override public int onLoop() throws InterruptedException { GroundItem BONES = groundItems.closest("bones"); switch (getState()) { case COLLECT: BONES.interact("take"); break; case FULL: walk(BANK_AREA); ~~~~~~~~~~~~~ walk is underlined red and wants me to create a method, i tried following a guide and theirs doesn't come up with an error, what am i doing wrong? and i have this for paint so far. Graphics2D gr = (Graphics2D)g; gr.setColor(Color.MAGENTA); gr.setFont(new Font("comic sans",Font.PLAIN,12)); gr.drawString("Bones Collected", 25, 50); the guide i was following uses chat messages to grab the information for paint, there is no chat message in my script so, how would i get mine? case COLLECT: BONES.interact("take"); Id assume something in this bit Maybe something like if BONES.interact("take") (insert code for ++ paint here) ?? meant to message this.. lol Edited February 4, 2016 by sonda Quote Link to comment Share on other sites More sharing options...
lurviq Posted February 9, 2016 Share Posted February 9, 2016 "Add External archives" is missing from my Build Path drop down list. the only thing there is "Configure build path" Quote Link to comment Share on other sites More sharing options...
Poopy Posted February 10, 2016 Share Posted February 10, 2016 will deff give this a try! wish me luck Quote Link to comment Share on other sites More sharing options...