jgs95 3 Share Posted April 25, 2021 Hello, I would like my script to respond to an increase in level of a combat skill, i.e. attack, strength, etc. I get that I need to write a class that implements the interface, but I don't know what the next step is. Thanks Link to comment Share on other sites More sharing options...
Bonfire 332 Featured Comment Share Posted April 25, 2021 28 minutes ago, jgs95 said: Hello, I would like my script to respond to an increase in level of a combat skill, i.e. attack, strength, etc. I get that I need to write a class that implements the interface, but I don't know what the next step is. Thanks Once you've implemented the interface, you can override one of the methods provided to you by the Experience Listener. Below is one such example of how you could log the user achieving a new level: @Override public void onLevelUp(ExperienceEvent event) { MethodProvider.log("Level up! " + event.getSkill() + " is now level " + Skills.getRealLevel(event.getSkill())); } You can find all of the methods provided by the listener here: https://dreambot.org/javadocs/org/dreambot/api/script/listener/ExperienceListener.html And you can see what information you can glean from the event itself here: https://dreambot.org/javadocs/org/dreambot/api/script/event/impl/ExperienceEvent.html Hopefully that helps! Link to comment Share on other sites More sharing options...
jgs95 3 Author Share Posted April 25, 2021 Cheers for the reply! The key thing that got it to work for me is to implement the interface on the AbstractScript class. I previously tried implementing it on another one and that didn't work. Hopefully this will help anyone reading this Link to comment Share on other sites More sharing options...
Pandemic 2708 Share Posted April 25, 2021 1 hour ago, jgs95 said: Cheers for the reply! The key thing that got it to work for me is to implement the interface on the AbstractScript class. I previously tried implementing it on another one and that didn't work. Hopefully this will help anyone reading this You can use another class, but you'll have to manually pass the class to our Instance#addEventListener method Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.