Viz Trio User Guide

Version 3.2 | Published June 29, 2021 ©

Events

There are two types of events in scripts: template scripts with template events and show scripts with show events. Although they look similar, they are not the same. When used in scripts, the events will be called only if the specific event described by the event-handler occurs.

IMPORTANT! Template scripts are loaded only when a page/template is read. Some template events are triggered only if the template or a page using this template is read.

This section contains reference information on the following topics:

Template Event Callbacks

  • OnContinue(): Called when the Continue button is pressed or a continue macro command is executed. Only triggered if the template or a page using this template is read.

  • OnInitialize: Called when the Initialize button is pressed or an initialize macro command is executed.

  • OnBeforeSave(): This procedure is called before Trio saves the current page. The script can cancel the saving by returning false (OnBeforeSave = false).

  • OnSave: Called when the Save button is pressed or a save macro command is executed.

  • OnBeforeTake(): This function is called before Trio runs take on the current page. The script can cancel the take action by returning false (OnBeforeTake = false). Only triggered if the template or a page using this template is read.

  • OnTake(): Called when the Take button is pressed or a take macro command is executed. Only triggered if the template or a page using this template is read.

  • OnTakeOut(): Called when the Take Out button is pressed or a take out macro command is executed. Only triggered if the template or a page using this template is read.

  • OnUpdate(): Called when an update action is executed in Viz Trio (See keyboard shortcut list on control page).

  • OnUserClick(): Called when the user clicks the Run macro button or when the Viz Trio macro command execute_script is executed.

  • OnValueChanged(PropertyName,NewPropertyValue): Used with template scripts. The event is called when a property in the page is changed. It sends in the name of the property and the new value.

  • OnSocketDataReceived: Called when socket data is received on the defined port. A socket object must be configured on the configuration page.

  • OnPropertyFocused(PropertyName): Called when a tab-field editor gets focus in the Viz Trio user interface. It sends the property name into the function that uses the event.

  • OnShowVariableChanged(Name, Value): This procedure is called when a global variable is changed or added. All Trio clients (including the client where this command was issued) that have the same show open will receive the event when the command show:set_variable is used .

  • OnGlobalVariableChanged(Name, Value): This procedure is called when a show variable is changed or added. All Trio clients that are connected to the same Media Sequencer with the same show open will receive the event when the command trio:set_global_variable is used.

Show Event Callbacks

  • OnShowOpen(): Called when show is opened.

  • OnShowClose(): Called when show is closed.

  • OnRead(): Called when the Read button is pressed or a read macro command is executed.

  • OnRead(PageName): Called when a spesific page is read.

  • OnContinue(PageName): Called when the Continue button is pressed or a continue macro command is executed.

  • OnInitializeShow(): same as OnInitialize for template scripts

  • OnCleanupRenderers(): Called when the trio:cleanup_renderers or trio:cleanup_all_channels commands are executed.

  • OnBeforeSave(PageName): Called before a specific page is saved.

  • OnSave(PageName): Called when a specific page is saved.

  • OnBeforeTake(PageName): Called before a specific page is taken.

  • OnTake(): Called when the Take button is pressed or a take macro command is executed.

  • OnTake(PageName): Called when a specific page is taken.

  • OnTakeOut: Called when the Take Out button is pressed or a take out macro command is executed.

  • OnTakeOut(PageName): Called when a specific page is taken out.

  • OnUpdate(PageName): Called when a specific page is updated.

  • OnValueChanged(PageName, PropertyName,NewPropertyValue): Used with show scripts to specify the page (PageName) that is called. The event is called when a property in a show’s page is changed. It sends in the name of the page, the name of the property and the new value.

  • OnSocketDataReceived(data): Called when data received on socket.

  • OnPropertyFocused(PageName, PropertyName): Called when property focused.

  • OnCopy(OldName, NewName): Called when a page is copied. The event is only available to show scripts.

  • OnCopy(OldName, NewName): Called when page copied from old to new.

  • OnMove(OldName, NewName): Called when a page is moved or renamed. The event is only available to show scripts.

  • OnDelete(PageName): Called when a page is deleted. The script can abort the deletion by returning false (OnDelete = false). Note that this event is a function, hence, it can return a value. If you set it to false it will not delete the page in question. If you set it to anything else or do not return a value, the page in question will be deleted. The event is only available to show scripts (see Using the OnDelete script event).

  • OnShowVariableChanged(Name, Value): Called when show variable changed.

  • OnGlobalVariableChanged(Name, Value): Called when global variable changed.

    IMPORTANT! An event with the same name but different argument value(s) are not equal. For example OnRead() and OnRead(Pagename) are not the same event.

Using the OnDelete Script Event

For example, the following script will cancel the delete operation of any page named 2000.

function OnDelete(PageName) if PageName = "2000" then OnDelete = false else OnDelete = true end if end function

The following are examples of commands that trigger this event:

  • Gui:copy_selected_pages_to_number

  • Gui:copy_selected_pages_with_offset

  • Gui:move_selected_pages_to_number

  • Gui:move_selected_pages_with_offset

  • Show:copy_pages_to_number

  • Show:copy_pages_with_offset

  • Show:delete_all_pages

  • Show:delete_templates

  • Show:move_pages_to_number

  • Show:move_pages_with_offset

  • Show:rename_page

  • Page:delete_page

  • Page:delete_pagerange

See Also