[Userscript] OC 2.0 overview (PDA compatible) | Tools & Usersc…

[Userscript] OC 2.0 overview (PDA compatible)

    • callmericky [3299880]
    • Role: Civilian
    • Level: 57
    • Posts: 13
    • Karma: 98
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Thread created on 21:14:38 - 10/01/25 (3 months ago)
    |
    Last replied 14:53:35 - 15/04/25 (3 days ago)

    I tried coding another OC 2.0 "who's slacking?" script before realizing there's at least two other OC 2.0 scripts that already do that. 

    Let's just add this to the pile. 

     

    Features

    • Adds a list of members available for OC 2.0 (optional toggle to view crimes + members in each crime).
    • Allows you to exclude members from the available member lists from the settings page (eg members away for long periods of time) 
    • View crime timers, member's item availability, member success rate, and member status all in one spot, even when traveling.
    • While travelling, this list is added to the top of your faction page. So you don't need to wait until you land to get lazy butts into OCs.
    • Adds an optional TornTools-like notifier to the sidebar if you are not in an OC. 
    • Highlights yourself in the OC list with a nice green colour because reading is hard.
    • Will potentially break horrendously when the unstable v2/faction/crimes endpoint is changed

     

    Instructions:
    Requires Minimal API key with faction access.
    Browser Users: Input the API key in the settings menu. 
    TornPDA Users: Script will use the API Key provided to TornPDA.

     

    Compatibility
    Should work on most modern browsers

    Works independently as well as together with TornTools extension.
    Works on tornPDA.

    Styled to work with both light and dark mode (refresh after changing modes to fix styles).

    API calls per page load:
    2 when viewing faction/crimes page (1 to get member+crime info, 1 to load item names)
    1 when viewing other pages (for the sidebar notifier)

    0 API calls if the sidebar is not visible

     

    Legality:

    This script only uses information available from the API, and does not make any non-API requests to Torn. 

     

    Link: https://greasyfork.org/en/scripts/522974-oc-2-0-helper

     

    ---------------------------------------------------------------------------------------------------------

    We were featured in a newspaper article

    Shoutout to Roberto [2613418] for a great explanation of the OC 2.0 system

    ---------------------------------------------------------------------------------------------------------

     

     

    Screenshots:

     

    6eeb16ec-899f-4502-bc47-3f7a1e515e69-3299880.png

     

    9e48b2ee-ce16-49f6-92a0-9c7f6f6b7a15-3299880.png


       sidebar%20notification.png

     

    TornPDA Screenshot: 

     

    615602b3-33eb-46f2-b8c3-736ab9e54b84-3299880.png

     

     

    Updates:

    [01:45:00 11/01/25 TCT] v3.3 - Fixed script not working in Tampermonkey (turns out Tampermonkey does not have native jquery support!)

    [11:38:00 13/01/25 TCT] v4.0

    • Added the ability to sort the OC's displayed by level or time (click on the relevant option to swap between ascending/descending order)
    • Made the member list more compact on to save screen real estate (2 columns instead of 1)
      • TornPDA users: unfortunately the small screen stays because devices have small screens
      • If anyone is using TornPDA on a device with a large enough screen such that the styles are broken, please let me know! I do not have such a device and am unable to test how the styles work on it!
    • Removed the [12345] id number next to member names to allow for more compact styling, and made the member name itself a link. Please let me know if this is annoying.

    [13:10:00 21/01/25 TCT] v5.0: Settings page added, new indicator and sorting features added. See link for more info.

    [07:52:00 22/01/25 TCT] v5.0.1: Fixed a bug preventing the inserted table from working properly during travel

    [09:31:00 22/01/25 TCT] v5.0.2: Fixed some test placeholder text when hovering over available member names (oops) 

    [01:05:00 04/02/25 TCT] v5.1

    • Fixed a bug that counted recruits in the number of available members. A list of recruits (if you have any) now show up if you hover over the "x/y members available" text. 
    • Changed the hover text for members not in crimes - now shows last OC joined and last activity in one single hover instead of in separate hovers.
    • Improved the UX for screen readers (particularly for those that navigate using keyboard)
      • Please reach out if anyone using a screen reader still has issues with using the script!

    [03:27:00 08/02/25 TCT] v5.1.1: Added a setting option to toggle the sidebar information on/off

    [10:11:00 05/03/25 TCT] v5.2.0

    • Added a button to toggle open/shut all crimes in that sub-section
    • Added an option to allow the timer to continue counting down after reaching 0. After reaching 0, the timer will turn red and start counting up. This can be used to see how long a crime has been waiting for a player to join, or to be executed. 
      • Enable this option in the settings page!
      • I have not had a chance to bugtest this as much as I'd like, so please let me know if it breaks!
    • Added the option to view the crime preparation status of each member in a crime. It is written as a percentage, in parenthesis after the member's name. 
      • Enable this option in the settings page.
    • Added indicators to crimes if members are either missing an item, or are below a user-set success chance. 
      • This success chance is set in the settings page.
      • By default, user success chances are yellow at 51% - 75%, and red for under 50%
      • Setting a minimum success chance will also force-color the members' success chance as red if they are under your set chance. 
      • Set this the value to 0 to disable the success chance indicator
    • Changed the API test wording to better explain when the user does not have access to faction API
    • Removed the 'user inactive' icon (looks like a person) next to member names, as this was not very useful.
      • Instead, member names will turn red if they are inactive for longer than your set threshold (set in settings)
      • This will hopefully stop longer names from being misaligned in small screens. 
    • Members in federal will now correctly have their status shown as red. Additionally, fedded members' names will turn red and have a strikethrough in the member list.
    • Fixed a bug where changing the display window of the browser (resizing your browser window, or swapping from portrait to landscape mode) will cause all crimes to be shown. Resizing the window now maintains your previous view.
    • Fixed a bug where the buttons on the settings page are sometimes rendered too far to the right of the screen in certain viewport sizes.
    • Fixed a bug where some browsers display a big fat ugly square next to the crime slot number, instead of the beautiful triangles that I hoped people saw.
    Last edited by callmericky on 12:00:04 - 05/03/25 (1 month ago)
    • Lewri [1762864]
    • Role: Civilian
    • Level: 98
    • Posts: 1,134
    • Karma: 449
    • Last Action: 54 minutes
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 22:24:05 - 10/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Looks sick as f**k. Nice work.

     

    I had just started work a minute ago on the next update for our one, but I might instead have a look at your code. Will send you changes I make if you are interested in them.

    cpomyHC.png

    • callmericky [3299880]
    • Role: Civilian
    • Level: 57
    • Posts: 13
    • Karma: 98
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 23:51:42 - 10/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Thank you! 

     

    I'm more than happy for you to edit/improve/steal the code as much as you like. Also super interested in changes that you make

    I took a look at your script and your code looks so efficient!

     

     

     

     

    • masheen [2625139]
    • Role: Civilian
    • Level: 100
    • Posts: 5,455
    • Karma: 7,136
    • Last Action: 6 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 09:49:00 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    So cool. Well done, this is super useful.

    Like that you have mini profiles so you can nag people not in a OC (faster).

    ◉_◉

    • Hemidonk [2081559]
    • Role: Civilian
    • Level: 40
    • Posts: 597
    • Karma: 311
    • Last Action: 6 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 12:19:56 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Very good, but as a suggestion if possible at last time online next to status or change color to red if offline more than 1day.

    • Allenone [2033011]
    • Role: Civilian
    • Level: 89
    • Posts: 269
    • Karma: 532
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:20:34 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    beautifully done. This is what i was hoping someone would make when i threw something together.

     

    a couple suggestions/requests

     

    1. could we get 2-4 columns instead of 1? this change would make it a lot better on PC so it's not taking up an entire page.961f6b83-15d7-4a62-8ac8-3f7cc79587f6-2033011.png
    2. can i get the ability to filter out members inactive over x many days? for members on military leave/vacation.
    • RenegadeRuss [1295794]
    • Role: Civilian
    • Level: 100
    • Posts: 2,756
    • Karma: 1,873
    • Last Action: 7 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:20:05 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Can we see what the people not doing a Oc have done previously so we know if they just don't do them full stop

    • Allenone [2033011]
    • Role: Civilian
    • Level: 89
    • Posts: 269
    • Karma: 532
    • Last Action: 1 hour
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:09:39 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    RenegadeRuss [1295794]

    Can we see what the people not doing a Oc have done previously so we know if they just don't do them full stop

    That's probably out of the scope of this tbh. it'd fit better into a google sheet.

     

    c09d3e91-eb81-426a-8cf8-6e484d1d1665-2033011.png

    • Lewri [1762864]
    • Role: Civilian
    • Level: 98
    • Posts: 1,134
    • Karma: 449
    • Last Action: 54 minutes
      • 1
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:33:08 - 11/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    RenegadeRuss [1295794]

    Can we see what the people not doing a Oc have done previously so we know if they just don't do them full stop

    Allenone [2033011]

    That's probably out of the scope of this tbh. it'd fit better into a google sheet.

     

    c09d3e91-eb81-426a-8cf8-6e484d1d1665-2033011.png

    Can add something stating how long it's been since the last OC they were in finished though. I plan on trying to add that if I get time tomorrow.

     

    Here's a Python script that prints it out as an example: https://pastebin.com/6VscaZQY

     

     

    cpomyHC.png

    • callmericky [3299880]
    • Role: Civilian
    • Level: 57
    • Posts: 13
    • Karma: 98
    • Last Action: 1 minute
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 11:36:21 - 13/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Update v4: 

    • Added the ability to sort the OC's displayed by level or time (click on the relevant option to swap between ascending/descending order)
    • Made the member list more compact on to save screen real estate (2 columns instead of 1)
      • TornPDA users: unfortunately the small screen stays because devices have small screens
      • If anyone is using TornPDA on a device with a large enough screen such that the styles are broken, please let me know! I do not have such a device and am unable to test how the styles work on it!
    • Removed the [12345] id number next to member names to allow for more compact styling, and made the member name itself a link. Please let me know if this is annoying.

    422f25f5-c1ec-4aac-9ad6-8160ed27ebf5-3299880.png

     

     

    Future goals:

    • Ability to add members to a manually maintained 'ignore' list so that they don't show up in the members not in OCs list. 
    • Some sort of settings/preferences page that allows you to slightly tweak your experience (eg. default sort mode, the aforementioned ignore list, number of columns for non-participating members etc.)
    • An indicator to highlight non-participating members who have not joined an OC for X amount of time
    • An indicator for members that have been offline of X time and are not on the ignore list 

     


     

    [...] as a suggestion if possible at last time online next to status or change color to red if offline more than 1day.

     

    You can sort of do this by long-pressing on the member name. It will produce a small window that shows the last action. 

    Torn does this by default on anything that links to a user's profile!

    I do plan to have some sort of indicator for members that have been away for a while, look forward to a future update!

    634bd17a-d2d3-41da-89a0-277d3fd7b108-3299880.png

     

    Thanks everyone for giving my script a try!

    Feel free to reach out in any way you'd like if you have any questions/suggestions/concerns. I promise I do read them although I may not reply straight away. 

     

    By default, the script should ignore Recruits and Fallen members, but I can't test it directly. If your faction has any of those and they are showing up on the non-participating list, please let me know!

     

     

    Last edited by callmericky on 11:40:31 - 13/01/25 (3 months ago)
    • masheen [2625139]
    • Role: Civilian
    • Level: 100
    • Posts: 5,455
    • Karma: 7,136
    • Last Action: 6 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 16:02:42 - 13/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Thank you so much for the update, it's awesome.

    ◉_◉

    • masheen [2625139]
    • Role: Civilian
    • Level: 100
    • Posts: 5,455
    • Karma: 7,136
    • Last Action: 6 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 10:56:33 - 16/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    bump because it's good.

    ◉_◉

    • PurpleFire [2868362]
    • Role: Committee
    • Level: 89
    • Posts: 1,015
    • Karma: 944
    • Last Action: 49 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 11:49:18 - 16/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Is accessible for screen readers.
    Love the links to profiles of people not in an OC.

    • PurpleFire [2868362]
    • Role: Committee
    • Level: 89
    • Posts: 1,015
    • Karma: 944
    • Last Action: 49 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 13:13:26 - 16/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Is there any way to get a timer to show how long each person has not been in an OC?

    Something like:

    Rhiannone: 18h 12m

    Moldex: never


    My faction has something like this going in a Google Sheet, but it would be so nice to have it all there on the same page.


    Edit:

    Should mention that the timers to show how long they have not been in an OC are important to have now that we are not asking people to 'set in' OCs to help run down timers lol.

    Now need a way to tell the difference in those who are waiting for an OC they are suitable for and those who have difficulty pressing a button.

     

     

    Last edited by PurpleFire on 13:20:20 - 16/01/25 (3 months ago)
    • Isca [672082]
    • Role: Civilian
    • Level: 100
    • Posts: 212
    • Karma: 401
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 17:08:27 - 16/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Can you make it so the whole thing collapses? - i'm sure with lower members not participating its not as big a deal. but it would be nice to have the option to look at it when i want. and hide it when i don't. (like the hide crimes link) but for the whole list.

    • Static1589 [2693019]
    • Role: Civilian
    • Level: 52
    • Posts: 83
    • Karma: 52
    • Last Action: 5 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 19:42:30 - 17/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    I've installed this script on PDA, but nothing happens. (Installed through the link, changed nothing)

     

    Any clues to what might be wrong?

    6_2693019.png

    • Lewri [1762864]
    • Role: Civilian
    • Level: 98
    • Posts: 1,134
    • Karma: 449
    • Last Action: 54 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 20:26:51 - 17/01/25 (3 months ago)
    Post link copied to clipboard Copy post link

    Static1589 [2693019]

    I've installed this script on PDA, but nothing happens. (Installed through the link, changed nothing)

     

    Any clues to what might be wrong?

    You need faction API access

    cpomyHC.png

    • Simik13l [3193350]
    • Role: Civilian
    • Level: 42
    • Posts: 576
    • Karma: 425
    • Last Action: 3 hours
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 06:24:27 - 19/01/25 (2 months ago)
    Post link copied to clipboard Copy post link

    callmericky [3299880]

    I tried coding another OC 2.0 "who's slacking?" script before realizing there's at least two other OC 2.0 scripts that already do that. 

    Let's just add this to the pile. 

     

    Features

    • Adds a list of members available for OC 2.0 (optional toggle to view crimes + members in each crime).
    • Allows you to exclude members from the available member lists from the settings page (eg members away for long periods of time) 
    • View crime timers, member's item availability, member success rate, and member status all in one spot, even when traveling.
    • While travelling, this list is added to the top of your faction page. So you don't need to wait until you land to get lazy butts into OCs.
    • Adds an optional TornTools-like notifier to the sidebar if you are not in an OC. 
    • Highlights yourself in the OC list with a nice green colour because reading is hard.
    • Will potentially break horrendously when the unstable v2/faction/crimes endpoint is changed

     

    Instructions:
    Requires Minimal API key with faction access.
    Browser Users: Input the API key in the settings menu. 
    TornPDA Users: Script will use the API Key provided to TornPDA.

     

    Compatibility
    Should work on most modern browsers

    Works independently as well as together with TornTools extension.
    Works on tornPDA.

    Styled to work with both light and dark mode (refresh after changing modes to fix styles).

    API calls per page load:
    2 when viewing faction/crimes page (1 to get member+crime info, 1 to load item names)
    1 when viewing other pages (for the sidebar notifier)

    0 API calls if the sidebar is not visible

     

    Legality:

    This script only uses information available from the API, and does not make any non-API requests to Torn. 

     

    Link: https://greasyfork.org/en/scripts/522974-oc-2-0-helper

     

    ---------------------------------------------------------------------------------------------------------

    We were featured in a newspaper article

    Shoutout to Roberto [2613418] for a great explanation of the OC 2.0 system

    ---------------------------------------------------------------------------------------------------------

     

     

    Screenshots:

     

    6eeb16ec-899f-4502-bc47-3f7a1e515e69-3299880.png

     

    9e48b2ee-ce16-49f6-92a0-9c7f6f6b7a15-3299880.png


       sidebar%20notification.png

     

    TornPDA Screenshot: 

     

    615602b3-33eb-46f2-b8c3-736ab9e54b84-3299880.png

     

     

    Updates:

    [01:45:00 11/01/25 TCT] v3.3 - Fixed script not working in Tampermonkey (turns out Tampermonkey does not have native jquery support!)

    [11:38:00 13/01/25 TCT] v4.0

    • Added the ability to sort the OC's displayed by level or time (click on the relevant option to swap between ascending/descending order)
    • Made the member list more compact on to save screen real estate (2 columns instead of 1)
      • TornPDA users: unfortunately the small screen stays because devices have small screens
      • If anyone is using TornPDA on a device with a large enough screen such that the styles are broken, please let me know! I do not have such a device and am unable to test how the styles work on it!
    • Removed the [12345] id number next to member names to allow for more compact styling, and made the member name itself a link. Please let me know if this is annoying.

    [13:10:00 21/01/25 TCT] v5.0: Settings page added, new indicator and sorting features added. See link for more info.

    [07:52:00 22/01/25 TCT] v5.0.1: Fixed a bug preventing the inserted table from working properly during travel

    [09:31:00 22/01/25 TCT] v5.0.2: Fixed some test placeholder text when hovering over available member names (oops) 

    [01:05:00 04/02/25 TCT] v5.1

    • Fixed a bug that counted recruits in the number of available members. A list of recruits (if you have any) now show up if you hover over the "x/y members available" text. 
    • Changed the hover text for members not in crimes - now shows last OC joined and last activity in one single hover instead of in separate hovers.
    • Improved the UX for screen readers (particularly for those that navigate using keyboard)
      • Please reach out if anyone using a screen reader still has issues with using the script!

    [03:27:00 08/02/25 TCT] v5.1.1: Added a setting option to toggle the sidebar information on/off

    [10:11:00 05/03/25 TCT] v5.2.0

    • Added a button to toggle open/shut all crimes in that sub-section
    • Added an option to allow the timer to continue counting down after reaching 0. After reaching 0, the timer will turn red and start counting up. This can be used to see how long a crime has been waiting for a player to join, or to be executed. 
      • Enable this option in the settings page!
      • I have not had a chance to bugtest this as much as I'd like, so please let me know if it breaks!
    • Added the option to view the crime preparation status of each member in a crime. It is written as a percentage, in parenthesis after the member's name. 
      • Enable this option in the settings page.
    • Added indicators to crimes if members are either missing an item, or are below a user-set success chance. 
      • This success chance is set in the settings page.
      • By default, user success chances are yellow at 51% - 75%, and red for under 50%
      • Setting a minimum success chance will also force-color the members' success chance as red if they are under your set chance. 
      • Set this the value to 0 to disable the success chance indicator
    • Changed the API test wording to better explain when the user does not have access to faction API
    • Removed the 'user inactive' icon (looks like a person) next to member names, as this was not very useful.
      • Instead, member names will turn red if they are inactive for longer than your set threshold (set in settings)
      • This will hopefully stop longer names from being misaligned in small screens. 
    • Members in federal will now correctly have their status shown as red. Additionally, fedded members' names will turn red and have a strikethrough in the member list.
    • Fixed a bug where changing the display window of the browser (resizing your browser window, or swapping from portrait to landscape mode) will cause all crimes to be shown. Resizing the window now maintains your previous view.
    • Fixed a bug where the buttons on the settings page are sometimes rendered too far to the right of the screen in certain viewport sizes.
    • Fixed a bug where some browsers display a big fat ugly square next to the crime slot number, instead of the beautiful triangles that I hoped people saw.

    So I was looking around for something that might display my personal OC CSR on occupied OC roles. (Potentially next to or near the role occupants OC CSR, not replacing it)

     

    I would like to document my CSR and monitor changes and growth without waiting for OCs to spawn with open roles so I can document the % in my notes before someone steps into the spot and thus replacing my CSR with theirs, would this potentially help with my spreadsheet and OC 2 research paper? Or might it be something you would consider adding to your script? 

    • ReconDalek [2741093]
    • Role: Civilian
    • Level: 99
    • Posts: 128
    • Karma: 139
    • Last Action: 2 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 18:29:07 - 19/01/25 (2 months ago)
    Post link copied to clipboard Copy post link

    For those that use torn on browser - like running Kiwibrowser with Violentmonkey, you just need to replace the "PDA KEY" with your API key and it will work as intended

    Would love to see an icon showing when you are in an OC but i can understand the limitation with this script being on a single page only, and the need for API calls - wouldn't want an API call on every page to insert the image.
    Hopefully torn add this themselves soon

    • Dsla [2807954]
    • Role: Civilian
    • Level: 15
    • Posts: 1,843
    • Karma: 3,612
    • Last Action: 47 minutes
      • 0
    • Reason:
      Are you sure you want to report this post to staff?
      Cancel
    Posted on 15:11:29 - 20/01/25 (2 months ago)
    Post link copied to clipboard Copy post link

    Doesn't work for faction leaders- or at least for me anymore. Says I don't have OC perms.

    27ecacc7-4a02-4222-8293-25148e96882a-2807954.png

Reply
Thread Title: