diff --git a/src/assets/colours.ts b/src/assets/colours.ts new file mode 100644 index 0000000..041a52a --- /dev/null +++ b/src/assets/colours.ts @@ -0,0 +1,15 @@ +import { combineRgb } from '@companion-module/base' + +export const White = combineRgb(255, 255, 255) +export const Black = combineRgb(0, 0, 0) + +export const PlaybackGreen = combineRgb(51, 158, 78) +export const PlaybackRed = combineRgb(228, 40, 30) +export const PauseOrange = combineRgb(192, 86, 33) +export const RollBlue = combineRgb(2, 116, 182) + +export const ActiveBlue = combineRgb(43, 90, 188) + +export const NormalGray = combineRgb(211, 211, 211) +export const WarningOrange = combineRgb(255, 171, 51) +export const DangerRed = combineRgb(237, 51, 51) diff --git a/src/enums.ts b/src/enums.ts index 06945d0..2eba9b4 100644 --- a/src/enums.ts +++ b/src/enums.ts @@ -18,6 +18,8 @@ export enum ActionId { TimerBlackout = 'TimerBlackout', TimerBlink = 'TimerBlink', MessageVisibility = 'setMessageVisibility', + MessageVisibilityAndText = 'setMessageVisibilityAndText', + MessageSecondarySource = 'setMessageSecondarySource', MessageText = 'setMessage', AuxTimerDuration = 'auxTimerDuration', @@ -52,7 +54,9 @@ export enum feedbackId { ColorPlayback = 'colorPlayback', ColorAddRemove = 'state_color_add_remove', OnAir = 'onAir', + MessageVisible = 'messageVisible', + MessageSecondarySourceVisible = 'messageSecondarySourceVisible', TimerBlink = 'timerBlink', TimerBlackout = 'timerBlackout', TimerPhase = 'timerPhase', @@ -121,6 +125,8 @@ export enum variableId { TimerMessageVisible = 'timerMessageVisible', TimerBlink = 'timerBlink', TimerBlackout = 'timerBlackout', + ExternalMessage = 'externalMessage', + TimerSecondarySource = 'timerSecondarySource', AuxTimerDurationMs = 'auxTimer_duration_ms', AuxTimerPlayback = 'auxTimer_playback', diff --git a/src/v3/actions/message.ts b/src/v3/actions/message.ts index c3c3494..99afe8d 100644 --- a/src/v3/actions/message.ts +++ b/src/v3/actions/message.ts @@ -3,42 +3,75 @@ import { socketSendJson } from '../connection' import { ActionId } from '../../enums' import { ActionCommand } from './commands' import { OntimeV3 } from '../ontimev3' -import { MessageState } from '../ontime-types' + +enum ToggleOnOff { + Off = 0, + On = 1, + Toggle = 2, +} export function createMessageActions(ontime: OntimeV3): { [id: string]: CompanionActionDefinition } { function messageVisibility(action: CompanionActionEvent): void { - const destination = action.options.destination as keyof MessageState - const visible = action.options.value === 2 ? !ontime.state.message[destination].visible : action.options.value - socketSendJson('message', { [destination]: { visible } }) + const value = action.options.value as ToggleOnOff + const visible = value === ToggleOnOff.Toggle ? !ontime.state.message.timer.visible : value + socketSendJson('message', { timer: { visible } }) + } + + function messageVisibilityAndText(action: CompanionActionEvent): void { + const value = action.options.value as ToggleOnOff + const text = action.options.text as string + const textIsDifferent = text !== ontime.state.message.timer.text + const thisTextIsVisible = ontime.state.message.timer.visible && !textIsDifferent + switch (value) { + case ToggleOnOff.Off: + if (thisTextIsVisible) { + socketSendJson('message', { timer: { visible: false } }) + } + break + case ToggleOnOff.On: + socketSendJson('message', { timer: { visible: true, text } }) + break + case ToggleOnOff.Toggle: + if (thisTextIsVisible) { + socketSendJson('message', { timer: { visible: false, text } }) + } else { + socketSendJson('message', { timer: { visible: true, text } }) + } + break + } } function timerBlackout(action: CompanionActionEvent): void { - const blackout = action.options.value === 2 ? !ontime.state.message.timer.blackout : action.options.value + const value = action.options.value as ToggleOnOff + const blackout = value === ToggleOnOff.Toggle ? !ontime.state.message.timer.blackout : value socketSendJson(ActionCommand.Message, { timer: { blackout } }) } function timerBlink(action: CompanionActionEvent): void { - const blink = action.options.value === 2 ? !ontime.state.message.timer.blink : action.options.value + const value = action.options.value as ToggleOnOff + const blink = value === ToggleOnOff.Toggle ? !ontime.state.message.timer.blink : value socketSendJson(ActionCommand.Message, { timer: { blink } }) } + function setSecondarySource(action: CompanionActionEvent): void { + const value = action.options.value as ToggleOnOff + const source = action.options.source + const isActive = ontime.state.message.timer.secondarySource === source + const shouldShow = value === ToggleOnOff.Toggle ? !isActive : value + const secondarySource = shouldShow ? source : 'off' + socketSendJson(ActionCommand.Message, { timer: { secondarySource } }) + } + return { [ActionId.MessageVisibility]: { name: 'Toggle/On/Off visibility of message', options: [ - { - type: 'dropdown', - choices: [{ id: 'timer', label: 'Timer' }], - default: 'timer', - id: 'destination', - label: 'Message Destination', - }, { type: 'dropdown', choices: [ - { id: 2, label: 'Toggle' }, - { id: 1, label: 'On' }, - { id: 0, label: 'Off' }, + { id: ToggleOnOff.Toggle, label: 'Toggle' }, + { id: ToggleOnOff.On, label: 'On' }, + { id: ToggleOnOff.Off, label: 'Off' }, ], default: 2, id: 'value', @@ -50,17 +83,6 @@ export function createMessageActions(ontime: OntimeV3): { [id: string]: Companio [ActionId.MessageText]: { name: 'Set text for message', options: [ - { - type: 'dropdown', - choices: [ - { id: 'timer', label: 'Timer' }, - { id: 'lower', label: 'Lower' }, - { id: 'public', label: 'Public' }, - ], - default: 'timer', - id: 'destination', - label: 'Message Destination', - }, { type: 'textinput', label: 'Timer message', @@ -70,19 +92,43 @@ export function createMessageActions(ontime: OntimeV3): { [id: string]: Companio ], callback: ({ options }) => socketSendJson(ActionCommand.Message, { - [options.destination as string]: { text: options.value }, + timer: { text: options.value }, }), }, - + [ActionId.MessageVisibilityAndText]: { + name: 'Toggle/On/Off visibility and text for message', + description: + 'Combined action for setting the text and visibility. "Toggle" will replace the current message. "Off" will disable the message visibility', + options: [ + { + type: 'textinput', + label: 'Timer message', + id: 'text', + required: true, + }, + { + type: 'dropdown', + choices: [ + { id: ToggleOnOff.Toggle, label: 'Toggle' }, + { id: ToggleOnOff.On, label: 'On' }, + { id: ToggleOnOff.Off, label: 'Off' }, + ], + default: 2, + id: 'value', + label: 'Action', + }, + ], + callback: messageVisibilityAndText, + }, [ActionId.TimerBlackout]: { - name: 'Toggle/On/Off Blackout of timer', + name: 'Toggle/On/Off blackout timer', options: [ { type: 'dropdown', choices: [ - { id: 2, label: 'Toggle' }, - { id: 1, label: 'Blackout On' }, - { id: 0, label: 'Blackout Off' }, + { id: ToggleOnOff.Toggle, label: 'Toggle' }, + { id: ToggleOnOff.On, label: 'On' }, + { id: ToggleOnOff.Off, label: 'Off' }, ], default: 2, id: 'value', @@ -97,9 +143,9 @@ export function createMessageActions(ontime: OntimeV3): { [id: string]: Companio { type: 'dropdown', choices: [ - { id: 2, label: 'Toggle' }, - { id: 1, label: 'On' }, - { id: 0, label: 'Off' }, + { id: ToggleOnOff.Toggle, label: 'Toggle' }, + { id: ToggleOnOff.On, label: 'On' }, + { id: ToggleOnOff.Off, label: 'Off' }, ], default: 2, id: 'value', @@ -108,5 +154,32 @@ export function createMessageActions(ontime: OntimeV3): { [id: string]: Companio ], callback: timerBlink, }, + [ActionId.MessageSecondarySource]: { + name: 'Toggle/On/Off visibility of secondary source', + options: [ + { + type: 'dropdown', + choices: [ + { id: 'external', label: 'External' }, + { id: 'aux', label: 'Aux timer' }, + ], + default: 'external', + id: 'source', + label: 'Source', + }, + { + type: 'dropdown', + choices: [ + { id: ToggleOnOff.Toggle, label: 'Toggle' }, + { id: ToggleOnOff.On, label: 'On' }, + { id: ToggleOnOff.Off, label: 'Off' }, + ], + default: 2, + id: 'value', + label: 'Action', + }, + ], + callback: setSecondarySource, + }, } } diff --git a/src/v3/connection.ts b/src/v3/connection.ts index b25b3fb..3e21bdc 100644 --- a/src/v3/connection.ts +++ b/src/v3/connection.ts @@ -117,12 +117,19 @@ export function connect(self: OnTimeInstance, ontime: OntimeV3): void { ontime.state.message = val self.setVariableValues({ [variableId.TimerMessage]: val.timer.text, + [variableId.ExternalMessage]: val.external, [variableId.TimerMessageVisible]: val.timer.visible, [variableId.TimerBlackout]: val.timer.blackout, [variableId.TimerBlink]: val.timer.blink, + [variableId.TimerSecondarySource]: val.timer.secondarySource as string, }) - self.checkFeedbacks(feedbackId.MessageVisible, feedbackId.TimerBlackout, feedbackId.TimerBlink) + self.checkFeedbacks( + feedbackId.MessageVisible, + feedbackId.TimerBlackout, + feedbackId.TimerBlink, + feedbackId.MessageSecondarySourceVisible + ) } const updateRuntime = (val: Runtime) => { @@ -260,9 +267,15 @@ export function connect(self: OnTimeInstance, ontime: OntimeV3): void { } case 'version': { clearTimeout(versionTimeout as NodeJS.Timeout) - const majorVersion = payload.split('.').at(0) - if (majorVersion === '3') { - self.updateStatus(InstanceStatus.Ok, payload) + const version = payload.split('.') + self.log('info', `Ontime version "${payload}"`) + self.log('debug', version) + if (version.at(0) === '3') { + if (Number(version.at(1)) < 6) { + self.updateStatus(InstanceStatus.BadConfig, 'Ontime version is too old (required >3.6.0) some features are not available') + } else { + self.updateStatus(InstanceStatus.Ok, payload) + } fetchAllEvents(self, ontime).then(() => { self.init_actions() const prev = findPreviousPlayableEvent(ontime) diff --git a/src/v3/feedbacks/auxTimer.ts b/src/v3/feedbacks/auxTimer.ts index b0429ea..b9f1287 100644 --- a/src/v3/feedbacks/auxTimer.ts +++ b/src/v3/feedbacks/auxTimer.ts @@ -1,8 +1,9 @@ -import { CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' import { feedbackId } from '../../enums' import { SimplePlayback } from '../ontime-types' import { getAuxTimerState } from '../../utilities' +import { DangerRed, PlaybackGreen, White } from '../../assets/colours' export function createAuxTimerFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { return { @@ -11,8 +12,8 @@ export function createAuxTimerFeedbacks(ontime: OntimeV3): { [id: string]: Compa name: 'Aux Timer Playback state', description: 'Indicator colour for playback state', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(0, 204, 0), + color: White, + bgcolor: PlaybackGreen, }, options: [ { @@ -43,8 +44,8 @@ export function createAuxTimerFeedbacks(ontime: OntimeV3): { [id: string]: Compa name: 'Aux Timer negative', description: 'Indicator colour for Aux Timer negative', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(0, 204, 0), + color: White, + bgcolor: DangerRed, }, options: [ { diff --git a/src/v3/feedbacks/message.ts b/src/v3/feedbacks/message.ts index f667215..9a5df7e 100644 --- a/src/v3/feedbacks/message.ts +++ b/src/v3/feedbacks/message.ts @@ -1,46 +1,67 @@ -import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' import { feedbackId } from '../../enums' -import { MessageState } from '../ontime-types' +import { ActiveBlue, White } from '../../assets/colours' export function createMessageFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { function messageVisible(feedback: CompanionFeedbackBooleanEvent): boolean { - const source = feedback.options.source as keyof MessageState - const { text, visible } = ontime.state.message[source] as { text: string; visible: boolean } + const { text, visible } = ontime.state.message.timer as { text: string; visible: boolean } return feedback.options.reqText ? visible && text === feedback.options.text : visible } + function secondaryVisible(feedback: CompanionFeedbackBooleanEvent): boolean { + const secondarySource = ontime.state.message.timer.secondarySource as string + + return ( + (feedback.options.source === 'any' && secondarySource !== null) || secondarySource === feedback.options.source + ) + } + return { [feedbackId.MessageVisible]: { type: 'boolean', name: 'Message visibility', description: 'Change the colors if message is visible', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(255, 0, 0), + color: White, + bgcolor: ActiveBlue, + }, + options: [ + { type: 'checkbox', id: 'reqText', default: false, label: 'Require matching text' }, + { type: 'textinput', id: 'text', label: 'Text', isVisible: (options) => options.reqText == true }, + ], + callback: messageVisible, + }, + [feedbackId.MessageSecondarySourceVisible]: { + type: 'boolean', + name: 'Message secondary source visibility', + description: 'Change the colors if secondary source is visible', + defaultStyle: { + color: White, + bgcolor: ActiveBlue, }, options: [ { type: 'dropdown', id: 'source', label: 'Source', - default: 'timer', + default: 'external', choices: [ - { id: 'timer', label: 'Timer' }, + { id: 'external', label: 'External' }, + { id: 'aux', label: 'Aux timer' }, + { id: 'any', label: 'Any' }, ], }, - { type: 'checkbox', id: 'reqText', default: false, label: 'Require matching text' }, - { type: 'textinput', id: 'text', label: 'Text', isVisible: (options) => options.reqText == true }, ], - callback: messageVisible, + callback: secondaryVisible, }, [feedbackId.TimerBlink]: { type: 'boolean', name: 'Timer is blinking', description: 'Change the colors of a button if timer is blinking', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(229, 62, 62), + color: White, + bgcolor: ActiveBlue, }, options: [], callback: () => ontime.state.message.timer.blink, @@ -50,8 +71,7 @@ export function createMessageFeedbacks(ontime: OntimeV3): { [id: string]: Compan name: 'Timer is blacked out', description: 'Change the colors of a button if timer is blacked out', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(229, 62, 62), + bgcolor: ActiveBlue, }, options: [], callback: () => ontime.state.message.timer.blackout, diff --git a/src/v3/feedbacks/offset.ts b/src/v3/feedbacks/offset.ts index a73e387..0ab7226 100644 --- a/src/v3/feedbacks/offset.ts +++ b/src/v3/feedbacks/offset.ts @@ -1,6 +1,7 @@ -import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' import { feedbackId } from '../../enums' +import { DangerRed, White } from '../../assets/colours' export function createOffsetFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { function offset(feedback: CompanionFeedbackBooleanEvent): boolean { @@ -27,7 +28,8 @@ export function createOffsetFeedbacks(ontime: OntimeV3): { [id: string]: Compani name: 'Rundown Offset', description: 'Colour of indicator for rundown offset state', defaultStyle: { - bgcolor: combineRgb(255, 0, 0), + color: White, + bgcolor: DangerRed, }, options: [ { diff --git a/src/v3/feedbacks/playback.ts b/src/v3/feedbacks/playback.ts index 7fa7c50..a436a4b 100644 --- a/src/v3/feedbacks/playback.ts +++ b/src/v3/feedbacks/playback.ts @@ -1,7 +1,8 @@ -import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackBooleanEvent, CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' import { feedbackId } from '../../enums' import { Playback } from '../ontime-types' +import { PauseOrange, PlaybackGreen, White } from '../../assets/colours' export function createPlaybackFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { function addTime(feedback: CompanionFeedbackBooleanEvent): boolean { @@ -28,8 +29,8 @@ export function createPlaybackFeedbacks(ontime: OntimeV3): { [id: string]: Compa name: 'Playback state', description: 'Indicator colour for playback state', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(0, 204, 0), + color: White, + bgcolor: PlaybackGreen, }, options: [ { @@ -53,8 +54,8 @@ export function createPlaybackFeedbacks(ontime: OntimeV3): { [id: string]: Compa name: 'Added/removed time', description: 'Indicator colour for whether timer has user added time', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(254, 124, 19), + color: White, + bgcolor: PauseOrange, }, options: [ { diff --git a/src/v3/feedbacks/progress.ts b/src/v3/feedbacks/progress.ts index 8051369..15eeeb4 100644 --- a/src/v3/feedbacks/progress.ts +++ b/src/v3/feedbacks/progress.ts @@ -1,8 +1,9 @@ -import { CompanionFeedbackAdvancedEvent, CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackAdvancedEvent, CompanionFeedbackDefinition } from '@companion-module/base' import { OntimeV3 } from '../ontimev3' import { feedbackId } from '../../enums' import { graphics } from 'companion-module-utils' import { TimerPhase } from '../ontime-types' +import { DangerRed, NormalGray, WarningOrange } from '../../assets/colours' export function createProgressFeedbacks(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition } { function progressbar(feedback: CompanionFeedbackAdvancedEvent) { @@ -70,9 +71,9 @@ export function createProgressFeedbacks(ontime: OntimeV3): { [id: string]: Compa description: 'Progressbar indicating the main timer progression', options: [ { type: 'checkbox', id: 'big', label: 'Big graphic', default: false }, - { type: 'colorpicker', id: 'normal', label: 'Normal', default: combineRgb(207, 207, 207) }, - { type: 'colorpicker', id: 'warning', label: 'Warning', default: combineRgb(255, 171, 51) }, - { type: 'colorpicker', id: 'danger', label: 'Danger', default: combineRgb(237, 51, 51) }, + { type: 'colorpicker', id: 'normal', label: 'Normal', default: NormalGray }, + { type: 'colorpicker', id: 'warning', label: 'Warning', default: WarningOrange }, + { type: 'colorpicker', id: 'danger', label: 'Danger', default: DangerRed }, ], callback: (feedback) => progressbar(feedback), }, @@ -82,9 +83,9 @@ export function createProgressFeedbacks(ontime: OntimeV3): { [id: string]: Compa description: 'Progressbar across multiple buttons indicating the main timer progression', options: [ { type: 'checkbox', id: 'big', label: 'Big graphic', default: true }, - { type: 'colorpicker', id: 'normal', label: 'Normal', default: combineRgb(207, 207, 207) }, - { type: 'colorpicker', id: 'warning', label: 'Warning', default: combineRgb(255, 171, 51) }, - { type: 'colorpicker', id: 'danger', label: 'Danger', default: combineRgb(237, 51, 51) }, + { type: 'colorpicker', id: 'normal', label: 'Normal', default: NormalGray }, + { type: 'colorpicker', id: 'warning', label: 'Warning', default: WarningOrange }, + { type: 'colorpicker', id: 'danger', label: 'Danger', default: DangerRed }, { type: 'number', id: 'amount', label: 'Amount', default: 3, min: 1, max: 8 }, { type: 'number', diff --git a/src/v3/feedbacks/timerPhase.ts b/src/v3/feedbacks/timerPhase.ts index 666820b..90ba617 100644 --- a/src/v3/feedbacks/timerPhase.ts +++ b/src/v3/feedbacks/timerPhase.ts @@ -1,7 +1,8 @@ -import { CompanionFeedbackDefinition, combineRgb } from '@companion-module/base' +import { CompanionFeedbackDefinition } from '@companion-module/base' import { TimerPhase } from '../ontime-types.js' import { feedbackId } from '../../enums.js' import { OntimeV3 } from '../ontimev3.js' +import { DangerRed, White } from '../../assets/colours.js' export function createTimerPhaseFeedback(ontime: OntimeV3): { [id: string]: CompanionFeedbackDefinition @@ -12,8 +13,8 @@ export function createTimerPhaseFeedback(ontime: OntimeV3): { name: 'Timer phase', description: 'Timer phase use Ontimes warn and danger times to change colour depending on timer progress', defaultStyle: { - color: combineRgb(255, 255, 255), - bgcolor: combineRgb(255, 0, 0), + color: White, + bgcolor: DangerRed, }, options: [ { diff --git a/src/v3/ontime-types.ts b/src/v3/ontime-types.ts index 6b0473c..21fef3a 100644 --- a/src/v3/ontime-types.ts +++ b/src/v3/ontime-types.ts @@ -142,12 +142,15 @@ export enum TimeStrategy { export type MessageState = { timer: TimerMessage - external: Message + external: string } -type TimerMessage = Message & { +export type TimerMessage = { + text: string + visible: boolean blink: boolean blackout: boolean + secondarySource: 'aux' | 'external' | null } // Custom fields diff --git a/src/v3/presets.ts b/src/v3/presets.ts index 15ee66a..b1f4f3b 100644 --- a/src/v3/presets.ts +++ b/src/v3/presets.ts @@ -2,29 +2,28 @@ import { CompanionButtonPresetDefinition, CompanionButtonStyleProps, CompanionPresetDefinitions, - combineRgb, } from '@companion-module/base' import * as icons from '../assets/icons' import { ActionId, feedbackId } from '../enums' import { TimerPhase } from './ontime-types' import { graphics } from 'companion-module-utils' +import { + ActiveBlue, + Black, + DangerRed, + NormalGray, + PauseOrange, + PlaybackGreen, + PlaybackRed, + RollBlue, + WarningOrange, + White, +} from '../assets/colours' export function presets(): CompanionPresetDefinitions { - return { ...playbackPresets, ...timerPresets, ...auxTimerPresets, ...rundownPresets } + return { ...playbackPresets, ...timerPresets, ...auxTimerPresets, ...rundownPresets, ...messagePresets } } -const White = combineRgb(255, 255, 255) -const Black = combineRgb(0, 0, 0) - -const PlaybackGreen = combineRgb(51, 158, 78) -const PlaybackRed = combineRgb(228, 40, 30) -const PauseOrange = combineRgb(192, 86, 33) -const RollBlue = combineRgb(2, 116, 182) - -const NormalGray = combineRgb(211, 211, 211) -const WarningOrange = combineRgb(255, 171, 51) -const DangerRed = combineRgb(237, 51, 51) - const defaultStyle: CompanionButtonStyleProps = { size: '24', color: White, @@ -411,6 +410,132 @@ const rundownPresets: { [id: string]: CompanionButtonPresetDefinition } = { }, } +const messagePresets: { [id: string]: CompanionButtonPresetDefinition } = { + showMessage: { + type: 'button', + category: 'Message', + name: 'Show Message', + style: { + ...defaultStyle, + size: '18', + text: 'Time\'s up', + }, + previewStyle: { + ...defaultStyle, + size: '18', + text: 'Time\'s up', + }, + steps: [ + { + down: [ + { actionId: ActionId.MessageText, options: { value: 'Your time is up' } }, + { actionId: ActionId.MessageVisibility, options: { value: 2 } }, + ], + up: [], + }, + ], + feedbacks: [ + { + feedbackId: feedbackId.MessageVisible, + options: { reqText: true, text: 'Your time is up' }, + style: { + bgcolor: ActiveBlue, + }, + }, + ], + }, + showSelectedMessage: { + type: 'button', + category: 'Message', + name: 'Show Selected Message', + style: { + ...defaultStyle, + size: 'auto', + text: 'Show\n$(ontime:timerMessage)', + }, + previewStyle: { + ...defaultStyle, + size: 'auto', + text: 'Show\nSelected Message', + }, + steps: [ + { + down: [{ actionId: ActionId.MessageVisibility, options: { value: 2 } }], + up: [], + }, + ], + feedbacks: [ + { + feedbackId: feedbackId.MessageVisible, + options: {}, + style: { + bgcolor: ActiveBlue, + }, + }, + ], + }, + selectMessage1: { + type: 'button', + category: 'Message', + name: 'Selected Message 1', + style: { + ...defaultStyle, + size: 'auto', + text: 'Select Msg 1', + }, + previewStyle: { + ...defaultStyle, + size: 'auto', + text: 'Select Msg 1', + }, + steps: [ + { + down: [{ actionId: ActionId.MessageText, options: { value: 'Message 1' } }], + up: [], + }, + ], + feedbacks: [ + { + feedbackId: feedbackId.MessageVisible, + options: { reqText: true, text: 'Message 1' }, + style: { + bgcolor: ActiveBlue, + }, + }, + ], + }, + selectMessage2: { + type: 'button', + category: 'Message', + name: 'Selected Message 2', + style: { + ...defaultStyle, + size: 'auto', + text: 'Select Msg 2', + }, + previewStyle: { + ...defaultStyle, + size: 'auto', + text: 'Select Msg 2', + }, + steps: [ + { + down: [{ actionId: ActionId.MessageText, options: { value: 'Message 2' } }], + up: [], + }, + ], + feedbacks: [ + { + feedbackId: feedbackId.MessageVisible, + options: { reqText: true, text: 'Message 2' }, + style: { + bgcolor: ActiveBlue, + }, + }, + ], + }, +} + const timerPresets: { [id: string]: CompanionButtonPresetDefinition } = { add_1_min: { type: 'button', diff --git a/src/v3/state.ts b/src/v3/state.ts index 382d253..1be93d1 100644 --- a/src/v3/state.ts +++ b/src/v3/state.ts @@ -17,8 +17,8 @@ const stateobj: RuntimeStore = { }, onAir: false, message: { - timer: { text: '', visible: false, blink: false, blackout: false }, - external: { text: '', visible: false }, + timer: { text: '', visible: false, blink: false, blackout: false, secondarySource: null }, + external: '', }, runtime: { numEvents: 0, diff --git a/src/v3/variables.ts b/src/v3/variables.ts index a2143e0..4e8573c 100644 --- a/src/v3/variables.ts +++ b/src/v3/variables.ts @@ -89,6 +89,14 @@ export function variables(): CompanionVariableDefinition[] { name: 'Timer Blinking', variableId: variableId.TimerBlink, }, + { + name: 'External Message', + variableId: variableId.ExternalMessage, + }, + { + name: 'Timer Message Secondary Source', + variableId: variableId.TimerSecondarySource, + }, { name: 'Number of events', variableId: variableId.NumberOfEvents,