npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slippi-time-conversion-tool

v1.5.3

Published

Converts in-game time to frames and vice-versa with a given Slippi game

Downloads

160

Readme

Slippi Time Conversion Tool

Author: Sasank 'squatch/jbub' Vishnubhatla

Pipeline Status: Pipeline Status

Coverage Status: Coverage Status

Installation

To use this tool, install it via npm: npm install slippi-time-conversion-tool -g --save-dev.

Usage

As a npm Package

To use the Slippi Time Conversion Tool within your project, import TimeConverter. Then, we you have the path of a Slippi game, you can initialize a TimeConverter object as follows:

const tc: TimeConverter = new TimeConverter(slippi_fname, true);

The signature of a TimeConverter is: TimeConverter(file: string | null, _gameCheck: boolean = true). The _gameCheck: boolean option is an optional check of the game to ensure the time being converted exists within the game. When supplying no game, then this option should be supplied as false.

With a TimeConverter object, we can convert from frame number to time elapsed and back as follows:

// assume start_frame: number is the frame number we are converting from
const time: string | undefined = tc.toTime(start_frame); // from frame to time
const frame: number | undefined = tc.toFrame(time); // from time to frame

As a Command Line Tool

To use the Slippi Time Conversion Tool as a command line tool, all we have to use is the npx command.

slippi-time-conversion-tool [--verision | -v] [--help | -h] <command> <arg> [--file=<file>]

The Slippi Time Conversion Tool is a fast tool to quickly convert between frame number and time elapsed, and vice-versa for a Slippi game.

Options

  • <arg>

    • The argument to the Slippi Time Conversion Tool. The format of the argument depends on the command. If the command is 'time' then the argument must be a non-negative integer. If the command is 'frame' then the argument must match the following regex expression: [0-9]{1,2}:[0-9]{2}. This expression equates to a string representing the minutes and seconds elapsed, i.e 'mm:ss'.
  • --version, -v

    • Prints the Slippi Time Conversion Tool version.
  • --help, -h

    • Prints the synopsis and a list of the commands.
  • --file=<file>

    • When a file is supplied, the Slippi Time Conversion Tool will check that the resulting conversion time/frame exists within the supplied game. The file must be a valid Slippi game recording.

Slippi Time Conversion Tool Commands

There are two available commands: 'time' and 'frame'.

  • time

    • The 'time' command signals to the Slippi Time Conversion Tool that the input argument will be converted to the standard time elapsed format of "mm:ss". Therefore, the input argument must be a single integer representing the frame number.
  • frame

    • The 'frame' command signals to the Slippi Time Conversion Tool that the input argument will be converted to an integer representing the frame number. Therefore, the input argument must be in the time elapsed format.

Examples

Convert a time elapsed to a frane number with no Slippi game checks:

slippi-time-conversion-tool time 1000

Convert a time elapsed to a frame number with Slippi game checks:

slippi-time-conversion-tool time 1000 --file=game.slp

Convert a frame number to time elapsed with no Slippi game checks:

slippi-time-conversion-tool frame 02:45

Convert a frame number to time elapsed with Slippi game checks:

slippi-time-conversion-tool frame 02:24 --file=game.slp

Interactive

When no inputs are given, then the tool will enter interactive mode.

Here, the user will be able to see a simple repl:

stct >

The following commands exist and will change the behavior of the repl:

  • help
    • Prints the synopsis and a list of the commands.
  • version
    • Prints the version of the Slippi Time Conversion Tool.
  • load
    • Prompts the user to load a file in for Slippi game checks. The prompt will look as follows:
***Enter path of Slippi game file to load***
stct-loader >
  • time
    • Prompts the user for an integer representing a frame number to convert to the time elapsed. If a Slippi game is loaded, then the game will be used for the Slippi game checks. The prompt will look as follows:
***Enter the frame number***
stct-to-time >
  • frame
    • Prompts the user for a time elapsed input to convert to a frame number. If a Slippi game is loaded, then the game will be used for the Slippi game checks. The prompt will look as follows:
*** Enter the time elapsed (format = mm:ss) **
stct-to-frame >