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

RSBotStats - Script Stat Tracking API | Easily Track Your Script Stats!

Discussion in 'Projects' started by YoHoJo, Mar 14, 2018.

  1. YoHoJo

    Joined:
    Nov 8, 2013
    Messages:
    2
    Likes Received:
    1
    Runescape Bot Stats

    RSBotStats is an API that allows scripters to easily track tasks their scripts bots have accomplished.
    Add stats tracking to your script bot with a simple JSON POST request!
    Use to showoff and market your script bot!

    Check it out here.
    [​IMG]
    Real stats from a cooking script bot!

    Getting Started with the API
    Example Request

    URL:
    http://pure-woodland-47666.herokuap...user_email=YOUR_EMAIL&user_token=YOUR_API_KEY

    Body:
    Code (Text):
    1. {
    2.    "commit":{
    3.      "script_id":"X5VTnp",
    4.      "user_id":"qN4tOb",
    5.      "runtime":75.666,
    6.      "stats_attributes":[
    7.         {
    8.            "task":"Trout Caught",
    9.            "amount":28
    10.         },
    11.         {
    12.            "task":"Lobster Caught",
    13.            "amount":70
    14.         }
    15.      ]
    16.    }
    17. }
    Parameter Notes
    • At the very least, a commit requires script_id, user_id, and runtime
    • runtime is in minutes
    • stats_attributes are for tracking any sorts of tasks your script bot does. ex: Fish Caught, Yews Chopped, XP Gained, GP gained, etc.
    • user_id: qN4tOb is the catch-all user. Use this as default.
    More To Come
    Eager to continue development of this, open to all suggestions and constructive criticism!

    Example Java JSON POST method:
    I'm not too familiar with Java.
    If someone could share a method to create a JSON post request, "that would be great".
    Here's are two examples from scripters:
    java integration for scriptwriters by anondinh · Pull Request #14 · AakLak/rs_script_stats
    public static void commit(long runtime, int experience) {
    try {
    runtime = (int)(runtime / 1000 / 60000);
    String payload =
    "{\"commit\":{\"script_id\": \"" + SCRIPT_ID + "\",\"user_id\": \"qN4tOb\",\"runtime\": " + runtime + ",\"stats_attributes\": [{\"task\": \"XP Gained\", \"amount\": " + experience + "}]}}";
    URL url = new URL(URL + "?user_email=" + EMAIL + "&user_token=" + API_KEY);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();

    conn.setDoOutput(true);
    conn.setDoInput(true);
    conn.setRequestMethod("POST");
    conn.setRequestProperty("Content-Type", "application/json");

    conn.connect();

    byte[] data = payload.getBytes(StandardCharsets.UTF_8);
    DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
    wr.write(data);
    wr.flush();

    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    StringBuilder stb = new StringBuilder();
    String line;
    while ((line = rd.readLine()) != null) {
    stb.append(line).append("\n");
    }

    wr.close();
    rd.close();

    if (conn.getResponseCode() == 201) {
    Logging.debug("Successfully sent script bot statistics to RS script bot Stats.");
    } else {
    Logging.debug(stb.toString());
    }
    conn.disconnect();
    } catch (IOException ignored) {

    }
    }


    : - ] Please integrate and enjoy!
     
    tyb51 likes this.
  2. Defeat3d

    Defeat3d Primate

    Joined:
    Oct 30, 2014
    Messages:
    3,072
    Likes Received:
    1,894
    Interesting project, kind of a simple version of RWS.
     
    YoHoJo, Cloud and Derk like this.
  3. YoHoJo

    Joined:
    Nov 8, 2013
    Messages:
    2
    Likes Received:
    1
    Thanks for checking it out!
    Was going to check our RWS, but I see that it has been discontinued :/.

    Developers, please integrate = - ]
     

Share This Page

Loading...