BotArmy_Sabo Posted October 23, 2017 Share Posted October 23, 2017 Does anyone reccomend Eclipse today still? I have IntelliJ on my laptop but I'm having issues following step 2. on this guide. Trying to get a vers of eclipse if this doesnt work Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 23, 2017 Author Share Posted October 23, 2017 6 minutes ago, Rickest said: Does anyone reccomend Eclipse today still? I have IntelliJ on my laptop but I'm having issues following step 2. on this guide. Trying to get a vers of eclipse if this doesnt work I'm still using eclipse, not sure about set up for IntelliJ as i've not used it, but the idea is probably the same. I'm sure you can find an online tutorial for attaching a jar dependency for intelliJ somewhere! Quote Link to comment Share on other sites More sharing options...
BotArmy_Sabo Posted October 23, 2017 Share Posted October 23, 2017 I did, thanks a ton Apaec! Found out how through the interwebz 1 Quote Link to comment Share on other sites More sharing options...
Botislife Posted October 31, 2017 Share Posted October 31, 2017 (edited) I think i've followed everything correctly, even used the exact code. But when I go to run the script ingame it does nothing. NVM figured it out... Got it up in running. Nearly zero coding experience so this guide is great... Edited October 31, 2017 by Botislife 1 Quote Link to comment Share on other sites More sharing options...
Apaec Posted October 31, 2017 Author Share Posted October 31, 2017 3 hours ago, Botislife said: I think i've followed everything correctly, even used the exact code. But when I go to run the script ingame it does nothing. NVM figured it out... Got it up in running. Nearly zero coding experience so this guide is great... Glad you got it working! Sorry that the guide is a little disorganised at the moment, i'm working on re-writing it but I cannot do it all in one go! Good luck with your scripting journey, let me know if/when you need any help! (: Apa 2 Quote Link to comment Share on other sites More sharing options...
theinadequacy Posted November 2, 2017 Share Posted November 2, 2017 (edited) I got this code that teleports me to GE... The teleporting works fine but when I arrive at the GE it keeps teleporting until I run out of charges. Shouldn't the "if" statement only work if my player ISN'T inside the geArea? I know I can fix this by just adding more code after my character teleports... but that makes me wonder if "if" statements are even necessary or do they even work? I don't know much about Java but it seems like the script just ignores all of the "if" statements and executes all methods from top to bottom. Code: case TELEPORT: Area geArea = new Area(3165, 3480, 3161, 3476); //area of all possible squares in GE that you can get teleported to. Position current2 = myPlayer().getPosition(); log("STARTING"); if (!geArea.contains(myPlayer()));{ getEquipment().interact(EquipmentSlot.RING, "Grand exchange"); log("teleporting"); new ConditionalSleep(5000) { @Override public boolean condition() { return !myPlayer().getPosition().equals(current2); } }.sleep(); } sleep(random(500, 600)); break; Edited November 2, 2017 by theinadequacy Quote Link to comment Share on other sites More sharing options...
Apaec Posted November 2, 2017 Author Share Posted November 2, 2017 1 hour ago, theinadequacy said: I got this code that teleports me to GE... The teleporting works fine but when I arrive at the GE it keeps teleporting until I run out of charges. Shouldn't the "if" statement only work if my player ISN'T inside the geArea? I know I can fix this by just adding more code after my character teleports... but that makes me wonder if "if" statements are even necessary or do they even work? I don't know much about Java but it seems like the script just ignores all of the "if" statements and executes all methods from top to bottom. Code: case TELEPORT: Area geArea = new Area(3165, 3480, 3161, 3476); //area of all possible squares in GE that you can get teleported to. Position current2 = myPlayer().getPosition(); log("STARTING"); if (!geArea.contains(myPlayer()));{ getEquipment().interact(EquipmentSlot.RING, "Grand exchange"); log("teleporting"); new ConditionalSleep(5000) { @Override public boolean condition() { return !myPlayer().getPosition().equals(current2); } }.sleep(); } sleep(random(500, 600)); break; If statements do work! lol (: Your code looks well structured - nicely done! The reason it is failing is purely syntactical - you've got a rogue ';' on line 7. It may be a bit confusing, but long story short if you delete it, the code should work. The if statement is interpreted as a one-line (curly bracket-less) block and the empty expression is the conditional code. The curly brackets then form their own block which is always executed. Your code would look like this if properly formatted: case TELEPORT: Area geArea = new Area(3165, 3480, 3161, 3476); //area of all possible squares in GE that you can get teleported to. Position current2 = myPlayer().getPosition(); log("STARTING"); if (!geArea.contains(myPlayer())) ; { getEquipment().interact(EquipmentSlot.RING, "Grand exchange"); log("teleporting"); new ConditionalSleep(5000) { @Override public boolean condition() { return !myPlayer().getPosition().equals(current2); } }.sleep(); } sleep(random(500, 600)); break; Hopefully that makes sense. Careful where you put the ';'s! Apa 1 Quote Link to comment Share on other sites More sharing options...
b4k4l1m Posted November 2, 2017 Share Posted November 2, 2017 I followed your guide and started the tea stall script but it just stands there and does nothing. I changed RS2Object to entity maybe cuz of this? But if i write RS2Object it does underline in red..? Quote Link to comment Share on other sites More sharing options...
sonda Posted November 2, 2017 Share Posted November 2, 2017 Post your code, so we can see. Quote Link to comment Share on other sites More sharing options...
Apaec Posted November 2, 2017 Author Share Posted November 2, 2017 2 hours ago, b4k4l1m said: I followed your guide and started the tea stall script but it just stands there and does nothing. I changed RS2Object to entity maybe cuz of this? But if i write RS2Object it does underline in red..? 1 hour ago, sonda said: Post your code, so we can see. ^ Quote Link to comment Share on other sites More sharing options...
b4k4l1m Posted November 2, 2017 Share Posted November 2, 2017 3 hours ago, Apaec said: ^ import org.osbot.rs07.api.model.Entity; 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 { STEAL, DROP, WAIT }; private State getState() { Entity stall = getObjects().closest("Tea stall"); if (!inventory.isEmpty()) return State.DROP; if (stall != null) return State.STEAL; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case STEAL: Entity stall = getObjects().closest("Tea stall"); if (stall != null) { stall.interact("Steal-from"); } break; case DROP: inventory.dropAll(); 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 November 3, 2017 Share Posted November 3, 2017 (edited) What was the quick fix for rs2object when the redline last we’re under it? May just need to right click it and create a field. Edit, did you import - import org.osbot.rs07.api.model.RS2Object; ?, judging by what you posted - you did not. If not, change it back to rs2Object and right click it, select the import option. I am also learning and apa has helped me immensely, i will try to do my best to pay it forward when i can! Edited November 3, 2017 by sonda Quote Link to comment Share on other sites More sharing options...
Apaec Posted November 3, 2017 Author Share Posted November 3, 2017 8 hours ago, b4k4l1m said: import org.osbot.rs07.api.model.Entity; 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 { STEAL, DROP, WAIT }; private State getState() { Entity stall = getObjects().closest("Tea stall"); if (!inventory.isEmpty()) return State.DROP; if (stall != null) return State.STEAL; return State.WAIT; } @Override public int onLoop() throws InterruptedException { switch (getState()) { case STEAL: Entity stall = getObjects().closest("Tea stall"); if (stall != null) { stall.interact("Steal-from"); } break; case DROP: inventory.dropAll(); 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) { } } As Sonda said, You need the RS2Object import! Quote Link to comment Share on other sites More sharing options...
b4k4l1m Posted November 3, 2017 Share Posted November 3, 2017 13 hours ago, sonda said: What was the quick fix for rs2object when the redline last we’re under it? May just need to right click it and create a field. Edit, did you import - import org.osbot.rs07.api.model.RS2Object; ?, judging by what you posted - you did not. If not, change it back to rs2Object and right click it, select the import option. I am also learning and apa has helped me immensely, i will try to do my best to pay it forward when i can! Thanks, this worked for me. Now i have to figure out how to let the bot fill the inv and then drop all items, now its dropping immediately when 1 tea is in inv. Quote Link to comment Share on other sites More sharing options...
Apaec Posted November 3, 2017 Author Share Posted November 3, 2017 25 minutes ago, b4k4l1m said: Thanks, this worked for me. Now i have to figure out how to let the bot fill the inv and then drop all items, now its dropping immediately when 1 tea is in inv. Great! It's awesome that you're trying to expand the code. I will give you a hint. At the moment, we are moving to the drop state when '!inventory.isEmpty()'. You can do a similar check for whether the inventory is full, as follows: getInventory().isFull(); // Returns whether the inventory is currently full Good luck! Apa Quote Link to comment Share on other sites More sharing options...