-
Posts
10 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Male
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Otterblast's Achievements
Newbie (1/10)
0
Reputation
-
Ok so I was able to make the class work but now its having an error in runtime. I try to run a little tester script package scripts; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import api.General; @ScriptManifest(author = "Otterblast", name = "tester", info = "tests scripts", version = 0.1, logo = "") public class tester extends Script { public void onStart() throws InterruptedException{ log("started"); } public int onLoop() throws InterruptedException { int[] gobID = {3029,3031,3032,3033,3034,3035}; Player player = myPlayer(); log("loop"); NPC goblin = npcs.closest(gobID); if(goblin != null && !player.isUnderAttack()) { goblin.interact("Attack"); General.actionSleep(player); } return 50; } } But whenever it gets to the General.actionSleep(player) I get an error as follows ERROR][Bot #1][12/09 05:06:35 PM]: Error in bot executor or from Error class (and not Exception)! java.lang.NoClassDefFoundError: api/General at scripts.tester.onLoop(tester.java:28) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(al:291) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: api.General at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more I tried looking up some stuff and it looks like the problem I am having is that means that the class is present in the classpath at Compile time, but it doesn't exist in the classpath at Runtime. Is there a way to make this work? Here is the code for the actionSleep() public class General extends MethodProvider{ public static void actionSleep(Player myPlayer) throws InterruptedException{ sleep(random(1000,1500)); StopWatch timer = new StopWatch(); timer.start(); while(timer.getElapsedSeconds() < 1.5) { if(myPlayer.isAnimating() || myPlayer.isMoving() || myPlayer.isUnderAttack() || myPlayer.getAnimation() == 426){ timer.reset(); } int X = random(1,7); if(X == 4) { antiBans.shortTermAntiban(); } } } } Any help appreciated! EDIT: I was able to solve this by moving the api to a new project then including it in the build path of the project containing my script.
-
Hello, I am trying to condense my code by making my own API consisting of some small but helpful methods. Some of the problems I am having is when converting the methods from non-static into static so that I can be able to call them. I have been able to fix this for stuff like camera and mouse movements by initializing a new camera/mouse. Now I am working on a method that will sleep while under combat (don't need to add eating in yet). The problem comes when I try to import it into a different script and use it there. When I try to call upon the method it says it needs to be a static method. I make the change to public static void, but then I get an error because myPlayer() is not a static method. So I either need to initialize the class before I call on the method or somehow make it so I can get the same result without using myPlayer() or initialize a Player that I can use. I am not really sure how to solve this problem and my guesses may be way off, which is why I have come here seeking help. Here is the code for my method public static void actionSleep() throws InterruptedException{ sleep(random(1000,2000)); while(myPlayer().isAnimating() || myPlayer().isMoving() || myPlayer().isUnderAttack() || myPlayer().getAnimation() == 426){ int X = random(1,7); if(X == 4) { antiBans.shortTermAntiban(); } sleep(random(300,500)); } } I also have another version based on the entity that doesn't need changing to be static but the problem with it is that even if I use the same entity I was supposed to attack it sometimes gets mixed up and will then sleep forever. While you might say I could just put in a condition for if my player isn't under attack I then run into the same problem of myPlayer() method not being a static method. Also this was meant to work for ranging as well but if you are safe-spotting your health bar doesn't pop up and therefore you aren't considered "under attack" - which makes sense. public static void attackSleep(Entity X) throws InterruptedException{ while(X.isVisible()) { int y = random(1,7); if(y == 4) { antiBans.shortTermAntiban(); } sleep(random(300,500)); } } I could also pretty easily solve this if I could get a timer and then have a method with a loop like the following Timer time = new Timer(2000); //sets timer of length 2 seconds while(time.isRunning()){ if(myPlayer().getAnimation == X){ time.reset} sleep(500) } but again with the same problem of needing myPlayer() and I haven't been able to find or make a timer script to my liking (I'm not that good of a programmer tbh). So if anyone could help explain how to be able to use myPlayer() within a static method or reference a method as a non-static method I would greatly appreciate it. Also if you know of a timer script that would work in the way I would like that would be very useful. But most importantly I would like to learn a way to be able to either make my methods non-static so that I can reference them in different scripts, or how to initialize the stuff so that I can use OSBot's methods in a non-static way.
-
OMG thank you so much it worked!!
-
This is awesome thanks but still have the same problem of it not actually typing. Nothing shows up in the text box unless I manually type any knowledge on how to fix this? The loop is nice but my problem is it is not functioning/typing into the box
-
Hello I have looked through a lot of different support stuff but can't seem to find a way to type a key I looked up how to type a key into the game and am trying to randomly create a runescape name on tutorial island but having trouble here is where I got the key references, I know this works as I have used code 32 for space before and it works just fine https://stackoverflow.com/questions/15313469/java-keyboard-keycodes-list/31637206 here is my code so far public void randomKey() throws InterruptedException{ int X = random(0,31); if(X == 1) {log("started key press"); getKeyboard().pressKey(65);; sleep(random(100,200)); getKeyboard().releaseKey(65); }else if(X == 2) {log("started key press"); getKeyboard().pressKey(76); sleep(random(100,200)); getKeyboard().releaseKey(76); }else if(X == 3) {log("started key press"); getKeyboard().pressKey(73); sleep(random(100,200)); getKeyboard().releaseKey(73); }else if(X == 4) {log("started key press"); getKeyboard().pressKey(80); sleep(random(100,200)); getKeyboard().releaseKey(80); }else if(X == 5) {log("started key press"); getKeyboard().pressKey(82); sleep(random(100,200)); getKeyboard().releaseKey(82); }else if(X == 6) {log("started key press"); getKeyboard().pressKey(87); sleep(random(100,200)); getKeyboard().releaseKey(87); }else if(X == 7) {log("started key press"); getKeyboard().pressKey(77); sleep(random(100,200)); getKeyboard().releaseKey(77); }else if(X == {log("started key press"); getKeyboard().pressKey(85); sleep(random(100,200)); getKeyboard().releaseKey(85); }else if(X == 9) {log("started key press"); getKeyboard().pressKey(84); sleep(random(100,200)); getKeyboard().releaseKey(84); }else if(X == 10) {log("started key press"); getKeyboard().pressKey(79); sleep(random(100,200)); getKeyboard().releaseKey(79); }else if(X == 11) {log("started key press"); getKeyboard().pressKey(80); sleep(random(100,200)); getKeyboard().releaseKey(80); }else if(X == 12) {log("started key press"); getKeyboard().pressKey(89); sleep(random(100,200)); getKeyboard().releaseKey(89); }else if(X == 13) {log("started key press"); getKeyboard().pressKey(69); sleep(random(100,200)); getKeyboard().releaseKey(69); }else if(X == 14) {log("started key press"); getKeyboard().pressKey(83); sleep(random(100,200)); getKeyboard().releaseKey(83); }else if(X == 15) {log("started key press"); getKeyboard().pressKey(68); sleep(random(100,200)); getKeyboard().releaseKey(68); }else if(X == 16) {log("started key press"); getKeyboard().pressKey(70); sleep(random(100,200)); getKeyboard().releaseKey(70); }else if(X == 17) {log("started key press"); getKeyboard().pressKey(72); sleep(random(100,200)); getKeyboard().releaseKey(72); }else if(X == 18) {log("started key press"); getKeyboard().pressKey(71); sleep(random(100,200)); getKeyboard().releaseKey(71); }else if(X == 19) {log("started key press"); getKeyboard().pressKey(75); sleep(random(100,200)); getKeyboard().releaseKey(75); }else if(X == 20) {log("started key press"); getKeyboard().pressKey(88); sleep(random(100,200)); getKeyboard().releaseKey(88); }else if(X == 21) {log("started key press"); getKeyboard().pressKey(67); sleep(random(100,200)); getKeyboard().releaseKey(67); }else if(X == 22) {log("started key press"); getKeyboard().pressKey(86); sleep(random(100,200)); getKeyboard().releaseKey(86); }else if(X == 23) {log("started key press"); getKeyboard().pressKey(66); sleep(random(100,200)); getKeyboard().releaseKey(66); }else if(X == 24) {log("started key press"); getKeyboard().pressKey(78); sleep(random(100,200)); getKeyboard().releaseKey(78); }else if(X == 25) {log("started key press"); getKeyboard().pressKey(90); sleep(random(100,200)); getKeyboard().releaseKey(90); }else if(X == 26) {log("started key press"); getKeyboard().pressKey(48); sleep(random(100,200)); getKeyboard().releaseKey(48); }else if(X == 27) {log("started key press"); getKeyboard().pressKey(49); sleep(random(100,200)); getKeyboard().releaseKey(49); }else if(X == 28) {log("started key press"); getKeyboard().pressKey(50); sleep(random(100,200)); getKeyboard().releaseKey(50); }else if(X == 29) {log("started key press"); getKeyboard().pressKey(51); sleep(random(100,200)); getKeyboard().releaseKey(51); }else if(X == 30) {log("started key press"); getKeyboard().pressKey(52); sleep(random(100,200)); getKeyboard().releaseKey(52); }else if(X == 31) {log("started key press"); getKeyboard().pressKey(53); sleep(random(100,200)); getKeyboard().releaseKey(53); }else if(X == 32) {log("started key press"); getKeyboard().pressKey(54); sleep(random(100,200)); getKeyboard().releaseKey(54); }else if(X == 33) {log("started key press"); getKeyboard().pressKey(55); sleep(random(100,200)); getKeyboard().releaseKey(55); }else if(X == 30) {log("started key press"); getKeyboard().pressKey(56); sleep(random(100,200)); getKeyboard().releaseKey(56); }else if(X == 30) {log("started key press"); getKeyboard().pressKey(57); sleep(random(100,200)); getKeyboard().releaseKey(57); }else { log("something wrong with X in randomKey"); getKeyboard().pressKey(57); sleep(random(100,200)); getKeyboard().releaseKey(57); } } For reference I already have the bot interact with the namebar by clicking on it in a separate larger function that works fine, if I manually start typing it will go into the "please pick a unqiue display name" but for some reason typing won't? Any help appreciated!
-
Ok yeah I followed I think it was Alex's guide to set up Intellij and for some reason I can't see my script in OSBot. I haven't been given GIT access either even though its been about a week since I applied but I don't think that is necessary to just make local scripts
-
Any Idea how long it takes to get GIT access? Posted my application nearly a week ago. Also I set up everything like he did here and can't find the script I made in OSBot when I refresh after doing the build>build project. I have made multiple scripts in Eclipse and feel confident working on that IDE but was told Intellij was a bit better but seems so much more confusing to switch to.
-
Thanks, what do you mean by guilds?
-
Hey im having similar problem, I have java jdk 1.8.0_92 installed but not sure if I still have JDK 14, do I need to uninstall 14 if its still there or is it impossible for it to be there if I have 1.8? If all that is fine do I need to uninstall/reinstall eclipse? I have been able to make scripts but now they aren't showing up.
-
Otterblast changed their profile photo
-
hey for some reason the GIT url isnt working for me, i typed http://GIT_USERNAME:GIT_PASSWORD@osbot.org/gitweb/git/GIT_REPOSITORY.git and it spits out Remote URL test failed: repository 'http://osbot.org/gitweb/git/GIT_REPOSITORY.git/' not found Any help would be greatly appreciated!