Heyy, i've been searching the internet for making a plugin for Runelite a client for Oldschool Runescape. I want to make a plugin where i can fight some monsters, basically its a bot. I know there are other clients out there that make it easier to write bot scripts.
My question is how do i make a "Fake" mouse that fires MouseEvent to a specific location on the screen and implement this inside a plugin. I've seen that i can create a new MouseEvent and pass the X and Y value's but i also need to pass a source for that. The source needs to be a component. I Tried using this snippet but "this" doesn't work in a plugin because its not a Component i guess.
I know i could use the class Robot from java.awt to create mouse movement etc but that hijacks my mouse on the pc. Also ofc this is for educational purposes. I just would really like to know how to create a bot, was always facinated by the thought of creating one.
ps: i found this video. i want to create something similar, this is the "fake" mouse i mean. the cross on the window.
this is the code i have at the moment:
package net.runelite.client.plugins.clicktest;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import javax.inject.Inject;
import java.awt.event.MouseEvent;
@Slf4j
@PluginDescriptor(
name = "ClickTestPlugin",
description = "Plugin for testing MouseEvents in Runelite"
)
public class clicktest extends Plugin {
@Inject
public Client client;
@Inject
public MouseEvent mouseEvent;
public clicktest() {
mouseEvent = new MouseEvent(this, MouseEvent.MOUSE_CLICKED,
System.currentTimeMillis(), 0, 10, 10, 1, false);
}
}