Announcement

Collapse
No announcement yet.

datapool - shared memory scriptin issue

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • datapool - shared memory scriptin issue

    I have been working on this scene that we talked about for several days, but I just seem to be getting no-where on it.

    I am writing data to shared memory from an excel sheet via dataReader, everything works well on my artist, but when I bring it into the ticker, it fails. My guess is that it somehow failing because of its’ interaction with the scene tree once in the ticker default scene, but it seems like I have accounted for that with the “FindSubContainer” commands? I certainly could be wrong as I am novice at scripting.

    Below is the script.




    sub OnInit()
    'registering a callback, setting a default message to shm, writing from shm to text container
    System.Map.RegisterChangedCallback("EYELINER")
    System.map["EYELINER"] = "BREAKING NEWS & WEATHER"
    FindSubContainer("FRED").Geometry.Text = System.map["EYELINER"]
    System.SendCommand("#" &this.VizId& "*FUNCTION*DataReader*load INVOKE")
    end sub

    sub OnSharedMemoryVariableChanged(map As SharedMemory, mapKey As String)
    'listening to shm key, checking hostname for Tulsa or OKC, setting a variable for the array to designate tulsa or okc message, modifying scene for dma branding,
    'checking the shm to see if default message is present--if not then get new message & split to array, writing fields 1 or 3 from the array to the text container & then making it uppercase.
    Dim V As Integer
    If system.HostName = "TULSA-ARTIST1" or system.HostName = "TULSA-ARTIST2" or system.HostName = "tulsa-tkr-cl1" or system.HostName = "TULSA-KO-TICKER" then
    V = (CInt("1"))
    Scene.FindContainer("NPUSH").Geometry.Text = "NEWS ON 6 AT 10"
    System.SendCommand("RENDERER*MIDDLE_LAYER*FUNCTION*DataPool*Data SET BUG_ROTATE=0;")
    Else
    V = (CInt("3"))
    Scene.FindContainer("NPUSH").Geometry.Text = "NEWS 9 AT 10"
    System.SendCommand("RENDERER*MIDDLE_LAYER*FUNCTION*DataPool*Data SET BUG_ROTATE=180;")
    End If
    If System.map["EYELINER"] = "BREAKING NEWS & WEATHER" = False Then
    Dim fields as array[string]
    cstr(map[mapKey]).split(",",fields)
    if fields.ubound > 2 then
    FindSubContainer("FRED").Geometry.Text = fields[V]
    FindSubContainer("FRED").Geometry.Text.makeupper()
    end if
    End If
    end sub

    The "end all" is that I want to set a default message when the scene is played. If the dataReader is successful in retrieving data, then use the new data, if it is unsuccessful, then nothing happens & the default message is aired.

  • #2
    I would use a RegisterParameterContainer and drop your topmost container in the scenetree there. Refer to this container in all your code so that the scene tree always has a fixed reference.
    Then use this reference in your code.
    Code:
    sub OnInitParameters()
        registerParameterContainer("cRoot", "Root container")
    end sub
    
    sub OnSharedMemoryVariableChanged(map As SharedMemory, mapKey As String)
        dim ct as Container    
        ct = GetParameterContainer("cRoot")
    'then use it somehow like this
        ct.FindSubContainer("NPUSH").Geometry.Text = "NEWS ON 6 AT 10"
    end sub

    Comment


    • #3
      Thanks Lars, that worked perfectly, I appreciate your help!

      Comment

      Working...
      X