Jump to content

RS13159265

Members
  • Posts

    7
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

RS13159265's Achievements

Newbie

Newbie (1/10)

0

Reputation

  1. Similarly, inventory.dropAll(f) always returns true, regardless of whether or not it dropped an item.
  2. @Explv ahh that makes sense, thank you very much. How did you manage to get the source code?
  3. package MasterScripts; import org.osbot.rs07.api.Bank; import org.osbot.rs07.api.ui.EquipmentSlot; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author="RS", info="Test small snippets", logo="", name="TestFunctions", version=1) public class TestFunctions extends Script { @Override public void onStart() {} @Override public int onLoop() throws InterruptedException { try { boolean ew = getEquipment().equip(EquipmentSlot.WEAPON, "Iron axe"); log("Result of equip: "+ew); } catch (Exception e) { log("Exception occurred: "+e); } stop(false); } } Equip a bronze axe. Load an iron axe into your inventory. The above script equips the axe, BUT returns false. Bug?
  4. Thanks. For my understanding: 1) What does new Bank() do / refer to? 2) And, reiterating, why does a non-null object raise a Null exception?
  5. The following code: package MasterScripts; import org.osbot.rs07.api.Bank; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author="Me", info="NA", logo="", name="TestFunctions", version=1) public class TestFunctions extends Script { @Override public int onLoop() throws InterruptedException { log("Starting script..."); Bank b = new Bank(); log("b is "+b); if (b == null) { log("b is null"); } try { log("Calling b.open()"); b.open(); } catch (Exception e) { log("b.open() generating exception e: "+e); } return 10000; } } Generates What??? As we check, b is a valid pointer, not null. Despite that, calling b.open() generates a NullPointerException. I really have no idea what could be going on. Ideas?
  6. Hey, I would like some way to count the number of times the bot clicks. My primary motive for this is that I want to make sure that the conditional sleeps are performing correctly i.e. after clicking on a tree the bot doesn't click again until the tree is dead. I took a look at BotMouseListener, and got that to work (in a somewhat hacky manner). Unfortunately, while that seems to be correctly counting my manual clicks on the screen, it is not recording the clicks that the bot itself makes. (AAARRGHRGHRGHR). I searched through the snippets and such but I wasn't able to find any post addressing this. Any help would be appreciated. (If someone wants to tell me the none hacky way of implementing BotMouseListener that would also be great) ClickCounter File: package Helpers; import java.awt.event.MouseEvent; import static java.awt.event.MouseEvent.MOUSE_CLICKED; import org.osbot.rs07.input.mouse.BotMouseListener; import org.osbot.rs07.script.MethodProvider; public class ClickCounter extends BotMouseListener { // This allows us to reroute our output to the same log console as our main script. // The script writes, "ClickCounter.MP = this". public static MethodProvider MP = null; public static int clickCount = 0; @Override public void checkMouseEvent(MouseEvent mouseEvent) { MP.log(mouseEvent); if (mouseEvent.getID() == MOUSE_CLICKED) { assert(MP != null); MP.log("MINE: Mouse Clicked!"); clickCount++; } } } Script File: package Attempt1; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import Helpers.ClickCounter; @ScriptManifest(author="RS3141", info="Test1", logo="", name="Example Script 1", version=1) public class ExampleScript1 extends Script { @Override public void onStart() { // Allow the ClickCounter to log to the output. ClickCounter.MP = this; this.bot.addMouseListener(new ClickCounter()); } @Override public int onLoop() throws InterruptedException { // Do stuff return 500; } }
×
×
  • Create New...