Interacting with StacyPilot
StacyPilot has two main modules you can interact with: Core
which is responsible for recording and playing back recordings and Panels
which is used to add tracks to panels.
Core
You can require the core module like so:
local core = require(workspace.StacyPilot.Core)
After that you can use:
Managing recording
:StartRecording()
to start creating a recording
core:StartRecording()
:ChangeRecordingName()
with a new name as a parameter to change the name of the recording that's currently getting recorded (or will be recorded next). You should run this before :StopRecording()
core:ChangeRecordingName("interval")
:StopRecording()
to stop creating and save a recording. You should run :ChangeRecordingName()
before that
core:StopRecording()
:IsRecording()
to check if a recording is currently getting created.
local isRecording = core:IsRecording()
if isRecording then
print("A recording is currently being created")
else
print("A recording is not being created")
end
.Events.RecordingStarted
is fired when recording is started
core.Events.RecordingStarted:Connect(function()
print("Someone started recording")
end)
.Events.RecordingStopped
is fired when recording is stopped
core.Events.RecordingStopped:Connect(function()
print("Someone stopped recording")
end)
Managing playback
:Play()
to play recordings, you can play as many recordings as you want at once
core:Play("interval1", "interval2")
:StopPlaying()
to stop the playback of the current recording
core:StopPlaying()
:IsPlaying()
to check if a recording is currently being played
local isPlaying = core:IsPlaying()
if isPlaying then
print("A recording is currently playing")
else
print("No recording is currently playing")
end
.Events.PlaybackStarted
is fired when someone starts playing a recording, the event sends all pieces of data used in the recordings that started playing
core.Events.PlaybackStarted:Connect(function(data)
print("Playback started with data:", data)
end)
.Events.PlaybackStopped
is fired when someone stops a recording or when the recording ends
core.Events.PlaybackStopped:Connect(function()
print("Playback ended")
end)
.Events.PlaybackTick
is fired every Heartbeat when a recording is playing with the amount of time that has passed since the beginning of the playback
core.Events.PlaybackTick:Connect(function(timePassed)
print("Playback has been going for", timePassed, "seconds")
end)
.Events.PlaybackTickWithData
is the same as above, but you also get the data that has not yet been played
core.Events.PlaybackTickWithData:Connect(function(timePassed, remainingData)
print("Playback has been going for", timePassed, "seconds")
print("Next piece of data:", remainingData[1])
end)
.Events.PlaybackData
is fired whenever a piece of data is reached
core.Events.PlaybackData:Connect(function(data)
print("Current replaying:", data)
end)
Add-ons
For a more detailed explanation of methods in this section, go to the Create an add-on section
:Record()
to record a piece of data. The first argument is the name of the module / add-on, after that you can add as many things as you want
core:Record("Pyro", "On", 1)
:RegisterResponse()
to run a function whenever a piece of data is being replayed for a module / add-on
core:RegisterResponse("Pyro", function(data)
local onOrOff = data[1]
if onOrOff == "On" then
-- do stuff
end
end)
:GetReplayData()
returns all of the pieces of data of the currently playing recording. Pieces will be nil
if they have already been replayed.
local data = core:GetReplayData()
print(data)
:FilterData()
to filter data from :GetReplayData()
or events to only include data from a specific module
local filtered = core:FilterData(data, "Pyro")
Panels
You can require the core module like so:
local Panels = require(workspace.StacyPilot.Panels)
After that you can use:
:GetPixelsForTime()
to get the amount of pixels needed to fill out some seconds on the timeline of the panels
local pixels = Panels:GetPixelsForTime(2)
:AddTrack()
to add a track to the timelines on panels. There's a separator on the timelines with a display order of 0, so anything with higher display order will be below it
The parameters are:
- the symbol shown on the timeline
- the colour of the background of the symbol
- the display order of the track
- whether or not the track should scroll automatically
local track = Panels:AddTrack("🔥", Color3.fromRGB(255, 0, 0), 1, true)
This method returns a Track, you can see its methods below
Track
:PopulateWithData()
fills a track with data, this is used by add-ons. You can see example usage of this in the Create an add-on section.
:ChangeSymbol()
to change the track's symbol
track:ChangeSymbol("💧")
:ChangeColor()
to change the track's colour
track:ChangeColor(Color3.fromRGB(0, 255, 0))
:ChangeOrder()
to change the track's order
track:ChangeOrder(-1)
:ChangeAutoscroll()
to change whether or not a track can be scrolled automatically
track:ChangeAutoscroll(false)