The client is offline due to RuneScape update. You may see instance errors but this is due to the update and not actual instance errors. This should be resolved soon. Join our Discord for more information.

RSPeer SkillListener example



  • Snippet for testing SkillListener

    import org.rspeer.runetek.api.component.tab.Skill;
    import org.rspeer.runetek.event.listeners.SkillListener;
    import org.rspeer.runetek.event.types.SkillEvent;
    import org.rspeer.script.Script;
    import org.rspeer.script.ScriptMeta;
    import org.rspeer.script.events.LoginScreen;
    import org.rspeer.ui.Log;
    
    @ScriptMeta(desc = "Skill Event Tester", developer = "absolute trash", name = "SkillEventTest")
    public class SkillEventTest extends Script implements SkillListener {
    
    
        @Override
        public void onStart() {
            this.removeBlockingEvent(LoginScreen.class);
        }
    
    
        @Override
        public int loop() {
            return 500;
        }
    
    
        public void notify(SkillEvent e) {
            if (e.getType() == 0)       //Experience gained event, ignore
                return;
            else if(e.getType() == 1)
                Log.info("Level up event");
            else if(e.getType() == 2)
                Log.info("Temporary level up event");
    
             /*
            Note: upon leveling up, both type 1 and type 2 events fire for some reason
            */
    
            Log.info("Skill name: "+ e.getSource());
            if(e.getSource() == Skill.COOKING){
                Log.info("Cooking event");
            }
    
        }
    
    
    }
    

    When leveling up, two events fire at the same time - for type 1 (normal level up) and type 2 (temporary level up/boosts). Is this intended?


  • Contributor Sponsor Staff Director

    yes. temporary is the top number (also includes boosts, drains etc). use the constants in SkillEvent


 

58
Online

15.4k
Users

1.3k
Topics

18.6k
Posts