Hello guys, so i recently developed a script that automatically tracks every faction member that delays oc's for whatever reason
How it works:
Its based on google sheets. Ive set up a trigger every 5 mins and it runs the code collects all the data on the logs sheet and basically takes it all and sums it to another sheet.
[image: i.ibb.co][image: i.ibb.co]
So in the first pic is the logs page which keeps track of everything and in the second pic ive set it up so it will show the 4 latest delays and it will show the total data for every person in the faction. It also makes sure to include/exclude people that joined/left the faction (without taking their name off the logs page tho beause thats to much work tbh)
MORE TECHNICAL THINGS AND COMMENTS
Script uses single players api key which also has faction api access. Because api dosent allow players to pull data about the exact condition of the crime (ex. member unavailable etc.), it does call api.torn.com/v2/faction/crimes?cat=planning&filters=ready_at...> and basically checks the time that every crime should be initiated once full and if its <= it gets every players conditions and once it finds people in hosp/jail/traveling/missing an item it puts their name in the log page.
I also tried it to make a stand alone extension that runs on torn that does the exact same thing so tracker can be more convinient, but i couldnt exactly code something that runs when the player who has it is offline.
I decided to work around it so i built an in torn extension which pulls the data from the sheet and displays it in the faction page.
[image: i.ibb.co]
This extension does not require players putting their api key to view the data as it only shows the data presented by the google sheets web server in json which have already been collected by the sheets script using 1 api key. For safety reasons anyone who uses the extension has to put a certain password to access all of it .
Final Comments
This is my first torn script and also first time working with Js/google apps script although im pretty good at using VBA and python i manged to make this work. I tried to be as specific as possible on how these things work, it might not be perfect but it runs great.
Feel free to make any suggestion and comments about it as im always trying to improve everything.
*My english is not great so for any questions or clarifications you can mail me
Hitter,