1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

[Help]List of online outfit members

Discussion in 'Census: Planetside 2' started by Tyr52, Oct 30, 2014.

  1. Tyr52

    Tyr52 Guest

    So I've been teaching myself how to work with javascript and the api, but I've hit a snag and would love some help. I'm currently working to make a query that returns a list of an outfit's members that are online. What I currently have is the below query that returns all members and their online status, which I then use a javascript loop to extract just the members who are online. That works just fine, but I was wondering if there was a way to filter out the api's response in the query, as I would like to get the characters_skill for the online members and pulling every spent cert point for all 500 members is impractical.

    How do I filter out the offline members from the below response?
    How do I request just online members of an outfit?


    Thanks for the assist.
  2. Trooper454

    Trooper454 Guest

    I did something similar with PHP and MySQL, but I was also doing logging (tracking best time for ops and such).

    As far as I could tell there is no way to filter by online status.
  3. Tyr52

    Tyr52 Guest

    Thanks for the response. I guess I'll have to decide between making that one big query or rapid fire numerous small queries in order to get the skills.
  4. Trooper454

    Trooper454 Guest

    Heres a pastebin of what I did (mostly annotated):

    You can see the results here:

    In the time that it takes the page to load the following is happening:
    - I clear out the mysql table Im using
    - I grab a dump of outfit_member from the census (resolving online_status)
    - I insert that data into the mysql table
    - I query the table for only online members
    - I use those query results to create a table showing the character name and rank of the players online

    At one point I was working on a version to let the outfit_id in the API call be inputted, but I got distracted by another, bigger project.
  5. Tyr52

    Tyr52 Guest

    Awesome! I can't say I know php or sql, but just looking over the code it makes sense.
    As part of my readings I came across the callback method (I believe to be called JSONP) and am using that data to build a string I then plug into the website with document.getElementByID().innerHTML . Besides the callback, it's basic javascript and html.
    I've also pushed myself to learn the c:join to replace the c:resolve because it's supposedly more powerful. The below gets you essentially the same thing as the query you shared, but if you just add a ",characters_skill^list:1" you can add on the skills of every member.

    I've decided not to pull the skill list for every member of the outfit, as that takes forever, so I just stored the character_id of the members online in a javascript array and make separate calls for each member. Gets me every online member's skill without taking too long.

    The idea is to add an icon for certain skills that add functionality, such as a light assault icon if the member has 2 bricks of c4 for demo runs. The problem I'm running into is that the names attached to the skills don't seem to be accurate. For example, there is a tank mine 2, which appears to be the cert that provides 3 tank mines, but there is no tank mine 1, and there is three skills with the name "Charge 1". I think a separate thread is required to figure out the skills.
    Last edited by a moderator: Dec 14, 2016
  6. Trooper454

    Trooper454 Guest

    Interesting. I tried to figure out c:join for a while, but my SQL is better than my understanding of REST API calls, so I just dump data and do it all in MySQL :)

    Ive noticed inconsistencies in other areas. There are item_ids that exist in event, but dont exist in item. There are also quite a few character ids that exist in event but dont exist in any of the character tables at all. Makes it frustrating when your trying to match data up.

Share This Page