I'm trying to implement this in my script, but it seems that Client.getMousePosition has been replaced with Client.getCanvas().getMousePosition()
I made that change in the code, but now when I run my script I get erratic mouse movement and these errors. It seems for some reason Client.getCanvas().getMousePosition() is returning null. Could you help me solve this?
9:02:48 PM: [WARN] This script threw an error, contact the script writer.
9:02:48 PM: [ERROR] Exception has occurred while running! Please report error to developer if problem persists:
java.lang.NullPointerException: Cannot read field "y" because "p2" is null
at WindMouse.distance(WindMouse.java:247)
at WindMouse.windMouse2(WindMouse.java:62)
at WindMouse.handleMovement(WindMouse.java:35)
at org.dreambot.api.input.event.impl.mouse.impl.MoveEvent.run(MoveEvent.java:41)
at org.dreambot.api.input.Mouse.0(Mouse.java:615)
at org.dreambot.api.input.Mouse.move(Mouse.java:523)
at org.dreambot.api.input.Mouse.click(Mouse.java:374)
at org.dreambot.api.input.Mouse.click(Mouse.java:346)
at org.dreambot.api.input.event.impl.InteractionEvent.1(InteractionEvent.java:399)
at org.dreambot.api.input.event.impl.InteractionEvent.interact(InteractionEvent.java:206)
at org.dreambot.api.input.event.impl.InteractionEvent.interact(InteractionEvent.java:91)
at org.dreambot.api.wrappers.widgets.WidgetChild.interact(WidgetChild.java:683)
at org.dreambot.api.methods.magic.Magic.castSpell(Magic.java:81)
at Main.onLoop(Main.java:44)
at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:224)
at java.base/java.lang.Thread.run(Thread.java:833)