Trivial Posted March 29, 2014 Posted March 29, 2014 (edited) i suck, pls help whats wrong with this idk looks good to me package Fisher; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; import org.osbot.script.rs2.model.Entity; import org.osbot.script.rs2.model.Player; import org.osbot.script.rs2.ui.Inventory; @ScriptManifest( author = "-", info = "--", name = "---", version = 0 ) public class BarbarianFisher extends Script { final String FISHINGSPOT_NAME = "Fishing spot"; public int onLoop() throws InterruptedException { Player player = client.getMyPlayer(); Inventory inv = client.getInventory(); if (!client.getInventory().isFull()) { // If inventory is not full then fish Entity fishSpot = closestObjectForName(FISHINGSPOT_NAME); if (fishSpot != null) { if (fishSpot.isVisible()) { if (!player.isAnimating()) { fishSpot.interact("Use-rod"); sleep(200 + random(400)); } } else { client.moveCameraToEntity(fishSpot); } } } else { // If inventory is full then drop all except feathers and rod inv.dropAllExcept(314,11323); } return 50; } } Edited March 29, 2014 by Damighty
Ande Posted March 30, 2014 Posted March 30, 2014 closestObjectForName(FISHINGSPOT_NAME); should be closestNPCForName(FISHINGSPOT_NAME);
Trivial Posted March 30, 2014 Author Posted March 30, 2014 Changed it, still does absolutely nothing.
Fay Posted March 30, 2014 Posted March 30, 2014 (edited) Let me guess it would turn the camera to the entity but not actually use the rod on the spot? This should fix it. Read my signature for my TOS lol. final String FISHINGSPOT_NAME = "Fishing spot"; final int rod = 11323; public int onLoop() throws InterruptedException { Player player = client.getMyPlayer(); Inventory inv = client.getInventory(); if (!client.getInventory().isFull()) { // If inventory is not full then fish Entity fishSpot = closestNPCForName(FISHINGSPOT_NAME); if (fishSpot != null) { if (fishSpot.isVisible()) { if (!player.isAnimating()) { inv.interactWithId(rod, "Use-rod"); selectOption(fishSpot, fishSpot.getMouseDestination(), "Use-rod"); sleep(200 + random(400)); } } else { client.moveCameraToEntity(fishSpot); } } } else { // If inventory is full then drop all except feathers and rod inv.dropAllExcept(314,rod); } return 50; } Edited March 30, 2014 by Fay
Trivial Posted March 30, 2014 Author Posted March 30, 2014 Seems like that did the trick, thank you! But I'm sure there should be a way to just make it simply click on the fishing spot instead of using the rod itself on the fishing spot, that seems kinda silly. It does it really fast though so I guess it'll be fine. Thanks a bunch for the help
Fay Posted March 30, 2014 Posted March 30, 2014 Seems like that did the trick, thank you! But I'm sure there should be a way to just make it simply click on the fishing spot instead of using the rod itself on the fishing spot, that seems kinda silly. It does it really fast though so I guess it'll be fine. Thanks a bunch for the help Yeah there is but you didn't ask for that, you just asked to fix the script .
Trivial Posted March 31, 2014 Author Posted March 31, 2014 I just removed the inv.interactWithId(rod, "Use-rod"); and now it does exactly what I wanted it to do, which is just click on the fishing spot. Thanks a lot for helping the noob though.