Back To Top
  • Hey Guest,
    If you are interested in ghosting, the Ghosting Awards from February 2025 all the way up to June 2025 have just been announced:

    Statement regarding the delays

    Ghosting Awards for February 2025

    Ghosting Awards for March 2025

    Ghosting Awards for April 2025

    Ghosting Awards for May 2025

    Ghosting Awards for June 2025
    Dismiss Notice
  • API Wrapper

    Discussion in 'Third Party Scripting & Development' started by Calculus, Aug 13, 2021.

    Tags:
    1. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      I've added various administrative endpoints to the Client. I don't believe forum admins can use them, but Brett and Eric sure can. I know SparkleMotion had this kind of power as well. Most administrative functions/methods end with 'AsAdmin;' i.e., 'banAsAdmin.'

      List of changes:
      - Removed the signup method
      - Merged defaultLogin with the login method (login with a token or an object containing username/password)
      - Added various administrative endpoints
      - Added the ability to (un)feature tracks
      - Added a 'toggle featured' method
      - Added createImageData, putImageData and getImageData to the Builder API
      - Moved various methods to their appropriate parent managers
      ... too many changes. I can't be bothered writing them. Send me a PM if you want further details.

      Featuring tracks, unlike other methods and functions, uses a setter to change the featured status on the track. Hence, you'll need to write code similar to the following code:
      Code:
      const client = new Client();
      
      client.on("ready", async function() {
          const track = await this.tracks.fetch("1001");
      
          track.featured = true;
          // or
          track.toggleFeatured();
      });
      
      client.login("token");
      
      Further changes may be edited into this message. That'll be all.

      Changes: https://github.com/Calculamatrise/f...54a4e5de9984caec16af38ab2c059f15ea736caf23b50
       
    2. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      v0.0.4-gamepad

      A new constructor is being introduced. I added the Builder API for track-makers, it's time I added the Gamepad API for players. I wasn't entirely sure on how to go about making this, so I've added a few options. Here's a sample code:
      Code:
      import frhd, { Gamepad } from "frhd";
      
      // const Gamepad = frhd.Gamepad;
      const gamepad = new Gamepad();
      
      gamepad.on("complete", function(records) {
          console.log(records);
      });
      
      gamepad.on("tick", function(ticks) {
          this.toggleKey(this.keymap[Math.floor(Math.random() * ticks) % 5]);
          this.tick(10);
      });
      
      // Result: (this result will not be persistent)
      {
        up_down: [ 0, 2 ],
        up_up: [ 1, 8 ],
        left_down: [ 3, 5, 10 ],
        left_up: [ 4, 9 ],
        right_down: [ 6 ],
        right_up: [ 7 ]
      }
      
      Second sample:
      Code:
      import frhd, { Gamepad } from "frhd";
      
      // const Gamepad = frhd.Gamepad;
      const gamepad = new Gamepad();
      
      gamepad.on("complete", function(records) {
          console.log(records);
      });
      
      gamepad.setKeyDown("up");
      gamepad.setKeyDown("left");
      gamepad.tick();
      gamepad.setKeyUp("up");
      gamepad.toggleKey("left");
      gamepad.complete();
      
      // Result:
      { up_down: [ 0 ], up_up: [ 1 ], left_down: [ 0 ], left_up: [ 1 ] }
      
      The first parameter for the tick method is the maximum number of ticks. As soon as that tick count is reached, the tick event will no longer be triggered. Alternatively, you can call the complete method to forcefully prevent the event from being triggered. There's no limit to what you could do with this. If anyone has any suggestions, you may post a discussion on the GitHub repository.

      Cheers
       
      Last edited: Mar 25, 2022
      revelcw and AfterImage like this.
    3. revelcw

      revelcw Member Official Author

      Damn this looks like I could make some tas stuff with it. :trollface:
       
    4. Symantec

      Symantec Well-Known Member Official Author

      :ugh:
       
    5. B1g_N0ob

      B1g_N0ob Member Official Author

      what is this codex thing how does one with no knowledge use it :confused:
       
      Symantec likes this.
    6. Foxler2010

      Foxler2010 Member Team Blob Official Author

      I really need to learn JS like for real. It’s the most important programming language that I think I should know, and yet I don’t.
       
    7. Handful_Of_Ants

      Handful_Of_Ants Member Official Author

      what does deepClean do?
       
    8. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      I don't recall. Most likely something to do with the mass removal of ghosts Totoca12 and I were working on b4 he was banned.
       
      AfterImage and Totoca12 like this.
    9. AfterImage

      AfterImage Well-Known Member Team Balloon Official Author

      Awarded Medals
      wait but he's not banned anymore...did he just like quit on it or...
       
    10. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      I believe he was asked to quit whilst they reviewed my script (which, I don't believe they ever did), but I don't recall. We definitely stopped though. Although, we did get through a good number of tracks.
       
      AfterImage and ShamatoZ like this.
    11. AfterImage

      AfterImage Well-Known Member Team Balloon Official Author

      Awarded Medals
      That’s ridiculous. Thanks for trying.
       
      Calculus likes this.
    12. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      I've started working on the update to the python version of this API wrapper. It's incomplete, but I did get the basic parts done. As of right now, there are only a handful of resources. Your abilities are very much limited; however, it's certainly better than what we had before. I haven't yet updated the module on pypi. I will update it as soon as I finish unit testing.

      Source:
      https://github.com/Calculamatrise/frpy
       
    13. B1g_N0ob

      B1g_N0ob Member Official Author

      Appreciated.
       
    14. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      https://pypi.org/project/frpy/
       
      B1g_N0ob, Fluoride and FIREBEATS like this.
    15. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      loge_0 likes this.
    16. Calculus

      Calculus Community Developer Staff Member Administrator

      Awarded Medals
      Updated the Python library. It is now more inline with Python best-practices and standards. All methods using camelCase are now using snake_casing. Also fixed some issues regarding imports, I believe the previous distributions were not packaged correctly. See more information here: Version 0.3.1
       
      pawflix, TPlacella and Blank_Guy like this.

    Share This Page