1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved Adding xp tracker

Discussion in 'Developer Support' started by jukkie, May 2, 2018.

  1. jukkie

    Joined:
    Apr 8, 2018
    Messages:
    44
    Likes Received:
    6
    I just created a seren stone bot that works quite well. Now an xp tracker would be nice to see how well the bot performs. But I have no idea how to go about doing this. I have seen that there are tutorial to creating an embaddableui but how do I make the bot actually keep track of the xp? Like the character can also gain additional xp through decorated mining urns and the furnace perk.
     
  2. Best Answer:
    Post #2 by screamopancakes, May 2, 2018
  3. screamopancakes

    Joined:
    Apr 19, 2018
    Messages:
    14
    Likes Received:
    3
    You will have to implement SkillListener which is the eventListener for XP gain or skill level ups. Then youll have to set your bot to listen for these events by putting this line of code in your onStart function
    Code (Text):
    1. getEventDispatcher().addListener(this);
    after thats done youll have to write a function called onExperienceGained(SkillEvent event) that will take the event information and push it through to your UI. you can see mine which just prints it out to the console in the picture that i linked.

    and heres a link to the related docs, Generated Documentation (Untitled) if you want to look there are also other listeners listed, inventoryListener is very helpful
     

    Attached Files:

    jukkie likes this.
  4. jukkie

    Joined:
    Apr 8, 2018
    Messages:
    44
    Likes Received:
    6
    Thank you for the help this works great! Do you also know how to get the integer value out of the SkillEvent object event?
    I would also like to make a cumulative xp tracker that adds the total gained xp.

    edit: I went into the documentation you linked and it's clear how to obtain the integer value from there by using the methods getChange() etc. of the SkillEvent class.
     
    #3 jukkie, May 3, 2018
    Last edited: May 3, 2018
  5. screamopancakes

    Joined:
    Apr 19, 2018
    Messages:
    14
    Likes Received:
    3
    glad that i could help. and yeah, event.getChange() then just add the change to a variable like totalXpGained or something.
     

Share This Page

Loading...