About
OSTracker is a Client-Server implementation designed to track important data from people using your scripts. It has been designed in a way that allows multiple clients (scripts & users) to upload and store data to one server which runs standalone from OSBot and utilises MySQL 8. OSTracker is allowed on the SDN.
Tracked Data (per user)
Experience gained for all skills
Items Received, Lost, or Spent (e.g. arrows and runes)
Time ran
Error logs (if setup)
Future Data
Script configurations
Requirements
For the server, you will need the following
Java JRE 8+ (Download)
MySQL Server 8 (Download)
Ability to build the jar using maven
A server to run OSTracker on
OSTracker-Server code (Download)
For the client, you will need the following
A script
The OSTracker client code within your script
OSTracker-Client code (Download)
Installation
MySQL Server
The MySQL 8 Server is the place all the user data is stored, and is required by OSTracker to function. MySQL Server should ideally be installed on the same server that the OSTracker server will run on, however that is not a requirement and it will work remotely with the correct setup on your end.
If you are using a Linux based operating system, I would recommend looking up specific instructions for setting up MySQL Server. If you are using Windows, you can see the instructions below.
OSTracker Server
To run the OSTracker server, you will need a Windows/Linux-based server to run it on. Depending on your users, having a server is ideal as it will allow you to track data 24/7.
Implementing the Server is quite easy using the instructions below.
OSTracker Client
The client implementation goes directly into your script, specifically into the onStart and onExit(), but you will need the entire OSTracker Client project source within your script.
Instructions:
Accessing the data
There is no easy way to explain this, but you will at least need some experience with SQL to reliably view your data in the most accurate and effective way. Once you have connected to your MySQL Server, whether its through terminal or a third party software such as MySQL Workbench, you gain access to powerful queries that will allow you to view the tracked data in all sorts of ways.
I have included some example queries below.
Viewing all items received by all players in the last 24 hours
SELECT username, itemname, status, sum(amount) AS cnt from `osbot-client`.`users`
inner join `osbot-client`.`scriptitems` on `osbot-client`.`users`.id = `osbot-client`.`scriptitems`.user
inner join `osbot-client`.`items` on `osbot-client`.`items`.id = `osbot-client`.`scriptitems`.item
inner join `osbot-client`.`itemstatus` on `osbot-client`.`scriptitems`.itemStatus = `osbot-client`.`itemstatus`.id
where status = "Received" and date > date_sub(date, INTERVAL 1 DAY)
group by status, itemName
having cnt > 1;
Viewing Total Time Ran for all users in milliseconds
SELECT username, sum(duration)
from `osbot-client`.`runtimes`
inner join `osbot-client`.`users` on `osbot-client`.`users`.id = `osbot-client`.`runtimes`.user
group by username;
Viewing Total Experience Gained for each user for a specific skill
SELECT username, skillName, exp
from `osbot-client`.`experiencegained`
inner join `osbot-client`.`users` on `osbot-client`.`users`.id = `osbot-client`.`experiencegained`.user
inner join `osbot-client`.`skills` on `osbot-client`.`skills`.id = `osbot-client`.`experiencegained`.skill
WHERE skillName = "STRENGTH"
group by username;
Advanced
Error Tracking
It's possible to track and upload things such as Stacktraces which allows scripters to get ahead of issues quickly before users even report it, see the example below.
In your onLoop, you could have something like the following
try {
// Logic Loop
} catch (Exception e) {
if (tracker != null) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
tracker.getSessionTracker().getSession().addLog(sw.toString().replaceAll("\r", "").replaceAll("\n", ""));
tracker.getSessionTracker().getSession().setVersion(getVersion());
}
}