VTFTK
Types
SoundModel
Represents a sound within VTFTK
Property | Type | Description |
---|---|---|
id | string | ID of the sound |
name | string | Name of the sound |
src | string | URL for the sound file that can be played |
volume | number | Volume the sound should be played at (0 - 1) |
order | number | Order the sound is shown within the UI |
created_at | string | ISO date time of when the sound was created |
SoundSeq
Represents a sound in a sequence of sounds to play
Property | Type | Description |
---|---|---|
src | string | URL for the sound file that can be played |
volume | number | Volume the sound should be played at (0 - 1) |
ItemModel
Represents an item within VTFTK
Property | Type | Description |
---|---|---|
id | string | ID of the item |
name | string | Name of the item |
image | ItemModelImage | Item image configuration |
order | number | Order the item is shown within the UI |
created_at | string | ISO date time of when the sound was created |
impact_sound_ids | string[] | List of IDs for the sounds that can play when this item impacts |
ItemModelImage
Image configuration for an item
Property | Type | Description |
---|---|---|
src | string | URL for the item image |
weight | number | Weight of the item on impact |
scale | number | Scale of the image |
pixelate | boolean | Whether to pixelate when scaling |
ItemsWithSounds
Items with their loaded impact sounds
Property | Type | Description |
---|---|---|
items | ItemModel[] | List of items |
sounds | SoundModel[] | List of impact sounds |
BarrageConfig
Configuration for how a barrage is thrown
Property | Type | Description |
---|---|---|
totalAmount | number | Total number of items to throw for the barrage |
amountPerThrow | number | Amount of items per throw of the barrage |
frequency | number | The time between each barrage (ms) |
Functions
playSound
Function (src: string, volume?: number) => Promise<void>
Tells the overlay to play a sound by URL
Argument | Type | Example | Description |
---|---|---|---|
src | string | URL of the sound to play | |
volume Optional | number | 0.5 | Optional volume to play the sound at (0 - 1) defaults to 1 |
playSoundSeq
Function (sounds: SoundSeq[]) => Promise<void>
Tells the overlay to play a sequence of sounds one after another. Waits for the previous sound to complete before the next is started
Argument | Type | Example | Description |
---|---|---|---|
sounds | SoundSeq[] | List of sounds to play |
playSoundByName
Function (name: string, ignoreCase?: boolean, volume?: number) => Promise<void>
Tells the overlay to play a sound by name (Sound must exist in VTFTK)
Argument | Type | Example | Description |
---|---|---|---|
name | string | Name of the sound to play | |
ignoreCase Optional | boolean | Whether to ignore case when matching the name (Default: false) | |
volume Optional | number | 0.5 | Optional volume to play the sound at (0 - 1) (Default: 1) |
playSoundByID
Function (id: string, volume?: number) => Promise<void>
Tells the overlay to play a sound by ID
Argument | Type | Example | Description |
---|---|---|---|
id | string | UUID of the sound to play | |
volume Optional | number | 0.5 | Optional volume to play the sound at (0 - 1) (Default: 1) |
getSoundByName
Function (name: string, ignoreCase?: boolean) => Promise<SoundModel | null>
Get a sound by name(Sound must exist in VTFTK) returns a SoundModel or null if the sound does not exist
Argument | Type | Example | Description |
---|---|---|---|
name | string | Name of the sound to find | |
ignoreCase Optional | boolean | Whether to ignore case when matching the name (Default: false) |
getSoundsByName
Function (name: string, ignoreCase?: boolean) => Promise<SoundModel[]>
Gets multiple sounds by name (Sound must exist in VTFTK) returns a SoundModel list
Argument | Type | Example | Description |
---|---|---|---|
name | string | Name of the sound to find | |
ignoreCase Optional | boolean | Whether to ignore case when matching the name (Default: false) |
getSoundsByNames
Function (names: string, ignoreCase?: boolean) => Promise<SoundModel[]>
Gets multiple sounds from a collection of sound names (Sound must exist in VTFTK) returns a SoundModel list of all matching sounds
Argument | Type | Example | Description |
---|---|---|---|
names | string | Name of the sound to find | |
ignoreCase Optional | boolean | Whether to ignore case when matching the name (Default: false) |
getSoundByID
Function (id: string) => Promise<SoundModel | null>
Get a sound by ID (Sound must exist in VTFTK) returns a SoundModel or null if the sound does not exist
Argument | Type | Example | Description |
---|---|---|---|
id | string | ID of the sound to find |
getSoundsByIDs
Function (id: string) => Promise<SoundModel[]>
Gets multiple sounds by ID (Sound must exist in VTFTK) returns a SoundModel list
Argument | Type | Example | Description |
---|---|---|---|
id | string | ID of the sound to find |
getItemsWithSounds
Function (items: ItemModel[]) => Promise<ItemsWithSounds>
Loads the impact sounds for a collection of items returns a ItemsWithSounds list
This is only really intended to be used with throwBarrage, throwItems, and throwAll but using the ByNames (i.e throwAllByNames) and ByIds functions are preferred
Argument | Type | Example | Description |
---|---|---|---|
items | ItemModel[] | Item models to load the sounds for |
getItemByName
Function (name: string, ignoreCase?: boolean) => Promise<ItemModel | null>
Finds an ItemModel by name returning null if the model is not found
Argument | Type | Example | Description |
---|---|---|---|
name | string | Name of the item to find | |
ignoreCase Optional | boolean | Whether to ignore case when searching for the item (Default: false) |
getItemsByName
Function (name: string, ignoreCase?: boolean) => Promise<ItemModel[]>
Finds any number of ItemModel by name
Argument | Type | Example | Description |
---|---|---|---|
name | string | Name of the item to find | |
ignoreCase Optional | boolean | Whether to ignore case when searching for the item (Default: false) |
getItemsByNames
Function (names: string[], ignoreCase?: boolean) => Promise<ItemModel[]>
Finds any number of ItemModel from a collection of names
Argument | Type | Example | Description |
---|---|---|---|
names | string[] | List of item names to find | |
ignoreCase Optional | boolean | Whether to ignore case when searching for the item (Default: false) |
getItemById
Function (id: string) => Promise<ItemModel | null>
Finds an ItemModel by ID returning null if the model is not found
Argument | Type | Example | Description |
---|---|---|---|
id | string | ID of the item to find |
getItemsByIds
Function (ids: string[]) => Promise<ItemModel[]>
Finds multiple ItemModels from a collection of IDs
Argument | Type | Example | Description |
---|---|---|---|
ids | string[] | IDs of the items to find |
throwAllByIds
Function (ids: string[], amount?: number) => Promise<void>
Throws a bunch of items all at once from a collection of item IDs
Argument | Type | Example | Description |
---|---|---|---|
ids | string[] | IDs of the items to throw | |
amount Optional | number | Number of items to throw (Default: 10) |
throwAllByNames
Function (names: string[], ignoreCase?: number, amount?: number) => Promise<void>
Throws a bunch of items all at once from a collection of item names
Argument | Type | Example | Description |
---|---|---|---|
names | string[] | Names of the items to throw | |
ignoreCase Optional | number | Whether to ignore case when finding the items by name (Default: false) | |
amount Optional | number | Number of items to throw (Default: 10) |
throwAll
Function (items: ItemsWithSounds, amount?: number) => Promise<void>
Throws a bunch of items all at once from a collection of item names
Argument | Type | Example | Description |
---|---|---|---|
items | ItemsWithSounds | Items to throw | |
amount Optional | number | Number of items to throw (Default: 10) |
throwBarrage
Function (items: ItemsWithSounds, config?: BarrageConfig) => Promise<void>
Throws a barrage of items
Argument | Type | Example | Description |
---|---|---|---|
items | ItemsWithSounds | Items to throw | |
config Optional | BarrageConfig | Config for the barrage |
throwBarrageByIds
Function (ids: string[], config?: BarrageConfig) => Promise<void>
Throws a barrage of items by the IDs of the items to throw
Argument | Type | Example | Description |
---|---|---|---|
ids | string[] | IDs of the items to throw | |
config Optional | BarrageConfig | Config for the barrage |
throwBarrageByNames
Function (names: string[], ignoreCase?: boolean, config?: BarrageConfig) => Promise<void>
Throws a barrage of items by the names of the items to throw
Argument | Type | Example | Description |
---|---|---|---|
names | string[] | Names of the items to throw | |
ignoreCase | string[] | Whether to ignore case when finding items (Default: false) | |
config Optional | BarrageConfig | Config for the barrage |
throwItemsByIDs
Function (ids: string[], config: ThrowItemConfig) => Promise<void>
Throws items by IDs. Low level primitive for the throwBarrageByIds and throwAllByIds functions
Argument | Type | Example | Description |
---|---|---|---|
ids | string[] | IDs of the items to throw | |
config | ThrowItemConfig | Config for the throw |
throwItemsByNames
Function (names: string[], ignoreCase: boolean, config: ThrowItemConfig) => Promise<void>
Throws items by names. Low level primitive for the throwBarrageByNames and throwAllByNames functions
Argument | Type | Example | Description |
---|---|---|---|
names | string[] | Names of the items to throw | |
ignoreCase | boolean | Whether to ignore case when matching names | |
config | ThrowItemConfig | Config for the throw |
throwItems
Function (items: ItemsWithSounds, config: ThrowItemConfig) => Promise<void>
Throws items. Low level primitive for the throwBarrage and throwAll functions
Argument | Type | Example | Description |
---|---|---|---|
items | ItemsWithSounds | Items to throw | |
config | ThrowItemConfig | Config for the throw |
triggerVTHotkey
Function (hotkeyID: string) => Promise<void>
Trigger a VTube Studio hotkey by ID.
Argument | Type | Description |
---|---|---|
hotkeyID | string | ID of the hotkey |
triggerVTHotkeyByName
Function (hotkeyID: string, ignoreCase?: boolean) => Promise<void>
Trigger a VTube Studio hotkey by name.
Argument | Type | Description |
---|---|---|
hotkeyName | string | Name of the hotkey |
ignoreCase Optional | boolean | Whether to ignore case when matching the hotkey name (Default: false) |