Snorunt Posted January 17, 2016 Share Posted January 17, 2016 (edited) Hey guys new scripter here I was just wondering what is the correct command for executing a state if a player is within a certain area? hope that makes sense!Thanks in advance! Please move to scripting help! Sorry! Edited January 17, 2016 by Snorunt Quote Link to comment Share on other sites More sharing options...
ikk Posted January 17, 2016 Share Posted January 17, 2016 Area Bank = new Area(x,y, x,y): If (Bank.contains(S.myPlayer()){ //do stuff } This is how I do it, sorry if syntax is off, I'm on my phone Quote Link to comment Share on other sites More sharing options...
Snorunt Posted January 17, 2016 Author Share Posted January 17, 2016 Much appreciated, thank you very much! Quote Link to comment Share on other sites More sharing options...
Snorunt Posted January 17, 2016 Author Share Posted January 17, 2016 http://pastebin.com/RjMwwdMF Anybody got any ideas on whats up in this? Quote Link to comment Share on other sites More sharing options...
ikk Posted January 17, 2016 Share Posted January 17, 2016 http://pastebin.com/RjMwwdMF Anybody got any ideas on whats up in this? It would help if you also mentioned what you are expecting this piece of code to do for you. From me looking at it, it looks like it probably will activate the "Start" state, but it doesnt seem that you've defined what the start state does yet, only the conditions which initiate it. So because you haven't really made the start state anywhere the script technically won't do anything yet. I recommend that you download some scripts in the downloadable section, decompile the .jar with JD GUI (http://jd.benow.ca/) and see how other people write their scripts. I personally write my scripts using nodes instead of states, I'm still new at java so I'm not so sure of the difference, other than it being a little bit more optimized because you're doing things in actual object oriented programming instead of having most of your lines of code in one .java. If you want an example of a node based script you could compile and learn from, click my signature for ikkWarriors, that's decompilable Quote Link to comment Share on other sites More sharing options...
Acerd Posted January 17, 2016 Share Posted January 17, 2016 http://osbot.org/forum/topic/58775-a-beginners-guide-to-writing-osbot-scripts-where-to-get-started-by-apaec/ check this out too. Quote Link to comment Share on other sites More sharing options...
Snorunt Posted January 18, 2016 Author Share Posted January 18, 2016 I was trying to go off of that tutorial Guys thanks so much for your help! Really great community! Quote Link to comment Share on other sites More sharing options...
Snorunt Posted January 18, 2016 Author Share Posted January 18, 2016 (edited) So its running, but it is spam clicking the npc; I tried adding a wait but its just going far too fast, any way to make it stop clicking when a dialogue box opens? Edited January 18, 2016 by Snorunt Quote Link to comment Share on other sites More sharing options...
Acerd Posted January 18, 2016 Share Posted January 18, 2016 (edited) you could use conditionalsleep Example; This will sleep for 500 if condition is true (which is if the specific widget is not visible.) new ConditionalSleep(500) { @Override public boolean condition() throws InterruptedException { return !getWidgets().isVisible(parent,child); } }.sleep(); Edited January 18, 2016 by Assnerd Quote Link to comment Share on other sites More sharing options...
Snorunt Posted January 18, 2016 Author Share Posted January 18, 2016 (edited) Do you have Skype so you could TV me and explain? also check my code if possible. If you dont have time its cool Snoruntaioservices is my Skype if anybody wouldnt mind answering a couple of questions ! Edited January 18, 2016 by Snorunt Quote Link to comment Share on other sites More sharing options...