If you were developing bundles that relied on this bundle before v1.x was released, please check Migrating from v0.9 to v1.x.
Below is a list of the ways you can interact with this bundle from within your own layout bundles. This documentation assumes you have knowledge about NodeCG bundle development.
It is suggested you add this bundle as to your bundleDependencies when making your NodeCG bundle, see nodecg.bundleDependencies here; "nodecg-speedcontrol": "^1.0.0" or similar should be added there.
This bundle may contain more than what is documented on here. If it's not mentioned, assume it to be unsupported and that it may change in an update.
Various places in this bundle store information in the format we refer to as a "runData object".
Example object:
{
game: "WarioWare: Smooth Moves",
gameTwitch: "WarioWare: Smooth Moves",
system: "Wii",
region: "PAL",
release: "2006",
category: "Any%",
estimate: "00:53:00",
estimateS: 3180,
setupTime: "00:10:00",
setupTimeS: 600,
scheduled: "2018-07-26T09:29:00+02:00",
scheduledS: 1532590140,
teams: [
{
name: "Mario",
id: 0,
players: [
{
name: "ChriSoofy",
id: 0,
teamID: 0,
country: "de",
social: {
twitch: "chrisoofy"
}
}
]
},
{
name: "Luigi",
id: 1,
players: [
{
name: "Ellaapiie",
id: 1,
teamID: 1,
country: "nl",
social: {
twitch: "ellaapiie"
}
}
]
}
],
customData: {
gameShort: "Game (Short)"
},
id: 81
}
gameString The name of the game being ran.gameTwitchString The name of the game in the Twitch directory.systemString The system/platform/console the run is being done on.regionString Region the copy of the game is from.releaseString Stores information on when the game was released.categoryString Category that is being ran.estimateString Run estimate in a human readable string.estimateSInteger Same as above but in seconds.setupTimeString Run setup time (to be added to the end of the run) in a human readable string.setupTimeSInteger Same as above but in seconds.scheduledString Timestamp for when the run is scheduled, with the timezone. Only applicable for runs imported from Horaro.scheduledSInteger Same as above but as a unix timestamp.teamsArray Teams that are doing this run. Length can be 0 (no teams/players), 1 (single player run or co-op) or 2 or more (race and/or co-op race).customDataObject Containskey: "data"information; key is from your configuration for custom data.idInteger Unique run ID in the currently set schedule of runs.
The teams array will contain (if anything) "team objects".
nameString Custom name of the team, if one has been set.idInteger Unique team ID in this run only.playersArray Players in this team. Length could be 0 (but probably never), 1 (single player run or race, if there are more teams) or 2 or more (co-op and/or co-op race, if there are more teams).
The players array in "team objects" will contain (if anything) "player objects".
nameString Name of the player.idInteger Unique player ID in this run only.teamIDInteger ID of the team this player is on.countryString country code of the country where this player is from, usually pulled from speedrun.com.socialObject Contains information on this player's social media references.twitchString Username of this player on twitch.tv.
An array of runData objects (see above) of all of the runs that have been imported/added. This is the same thing that is used in the Run Player/Run Editor panels, and any reordering done in the Run Editor panel is also reflected here.
Either undefined if none is set, or a runData object (see above) of the currently active run as set by the Run Player panel.
An object with data on the current status of the timer, updated every 100ms.
The default object state:
{
time: "00:00:00",
state: "stopped",
milliseconds: 0,
timestamp: 0,
teamFinishTimes: {}
}
timeis the current human readable time it is at (same as printed on the Run Timer panel).stateis the current state; can bestopped(timer is at 0),running(timer is currently running),paused(timer was running but has been paused) orfinished(timer has been ended and is showing the final time).millisecondsis the current time, but in milliseconds for calculations.timestampis aDate.now()timestamp of when the run was started.teamFinishTimesis a keyed object for the time a team has finished, if this run was a race. The key is the teams ID; the value is a copy of thetimerreplicant at the time (minus theteamFinishTimesvalue).
An example of the object, during a race while the timer is still running but team with ID 1 has finished:
{
time: "00:14:51",
state: "running",
milliseconds: 891053,
timestamp: 1545591937067,
teamFinishTimes: {
1: {
time: "00:14:37",
state: "running",
milliseconds: 877274,
timestamp: 1545591923282
}
}
}
Emitted when a Twitch ad is successfully started via this bundle. Calls back with an object that contains duration which is an integer on how long the ads will run for.
Used to tell the Twitch API to run ads if applicable to your channel and you have the Twitch API integration enabled. Calls back with error, data format, data is an object that contains duration which is an integer on how long the ads will run for if successful.
- speedcontrol-simpletext, our own simple example bundle.