darkjack7 4 Share Posted May 18, 2016 import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Timer; @ScriptManifest(name = "GOBLINS", description = "", author = "", version = 0, category = Category.COMBAT) public abstract class main extends AbstractScript implements MouseListener { Timer t; int xpos; int ypos; Rectangle screen = new Rectangle(); void eventOutput(String eventDescription, MouseEvent e) { log(eventDescription + " detected on " + e.getComponent().getClass().getName() + "." + String.valueOf(xpos)); } public void mousePressed(MouseEvent e) { eventOutput("Mouse pressed (# of clicks: " + e.getClickCount() + ")", e); } public void mouseReleased(MouseEvent e) { eventOutput("Mouse released (# of clicks: " + e.getClickCount() + ")", e); } public void mouseEntered(MouseEvent e) { eventOutput("Mouse entered", e); } public void mouseExited(MouseEvent e) { eventOutput("Mouse exited", e); } public void mouseClicked(MouseEvent e) { eventOutput("Mouse clicked (# of clicks: " + e.getClickCount() + ")", e); } public void onPaint(Graphics2D g) { } } this is what i have so far but db doesn't even recognize it help pls i really want to do this Link to comment Share on other sites More sharing options...
Lem0nz 33 Share Posted May 18, 2016 As I said in the chatbox not sure if you've seen, I've implemented the interface on a class of my own and it works just fine. Btw, I don't think you want your main to be abstract. ^ this is the problem. Implement onLoop() and should be just fine. Hf. Link to comment Share on other sites More sharing options...
Constuck 13 Share Posted May 19, 2016 ^ If your class is abstract, then the script cant be run. Bible is right. Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted May 19, 2016 ^ If your class is abstract, then the script cant be run. Bible is right. The class NEEDS to be abstract to be able to run in the DB client lol. You just need to implement the onLoop(), because thats basically your "public static void main(String[] args)" method. A Java program will look for the main method on startup, this is the way Java works, and executes the code in the body. DreamBot does this by the onLoop(). Could be that im wrong, but thats what i think how dreambot works oh and, @darkjack7, a Java Class starts with an uppercase letter. always. So change "main" to "Main" And remove the abstract callsign, you implement AbstractScript which is abstract lol. (see below) public class Main extends AbstractScript implements MouseListener { Link to comment Share on other sites More sharing options...
Hopewelljnj 46 Share Posted May 19, 2016 No the class cannot be abstract. AbstractScript is abstract which is why you have to implement methods. But the class that is running cannot be abstract But he is correct. Because you extend AbstractScript you do need an onLoop even if it does nothing. Link to comment Share on other sites More sharing options...
Cardozz 46 Share Posted May 19, 2016 No the class cannot be abstract. AbstractScript is abstract which is why you have to implement methods. But the class that is running cannot be abstract But he is correct. Because you extend AbstractScript you do need an onLoop even if it does nothing. Thats what i tried to say lol. Thanks for the support Link to comment Share on other sites More sharing options...
Constuck 13 Share Posted May 20, 2016 Yeah, I think we are all on the same page here. We figured this out a little later in the chat by implementing onLoop(). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.