resources/gui_and_objects/trassir_objects/script_object.py

It is possible to generate events in scripts. To do this, use the ready-made ScriptObject class.

The ScriptObject object is a child class of the BaseObject class, which is described in detail in the article Creating objects .

Class arguments:

  • name (str, optional): Created object name.
  • guid (str, optional): Created object guid.
  • parent (str, optional): Parented object guid.
  • folder (str, optional): Folder where the created object will be placed in the object tree.
  • associated_channel (str, optional): Channel related with the object.

Class methods (excluding inherited methods):

  • fire_event_v2(message, channel="", data="") - Creates Script: %1 event
    Method arguments:
    • message (str): Event text.
    • channel (str, optional): Channel guid. If set, it will be possible to go to the channel archive from the event context menu in Trassir.
    • data (str, optional)Any other data that may be needed for the subsequent processing of the event.

Code examples:

from script_object import ScriptObject

obj = ScriptObject()

obj.fire_event_v2("Hello world")

These events can also be "caught" using the host.activate_on_events method

from script_object import ScriptObject

obj = ScriptObject()

obj.fire_event_v2("Hello world")

Let's link the channel to the event:

from script_object import ScriptObject

obj = ScriptObject()

obj.fire_event_v2("Hello world", channel="uR76TlcA")



  • Нет меток