Graphics

 View Only
  • 1.  Script won't work

    Posted 11-02-2022 04:30
    dim kreds1, kreds2, kreds3, kreds4, kreds5, kreds6, kreds7, kreds8, kreds9, kreds10, kreds11, kreds12, kreds13 as xpBaseObject
    
    self.GetObjectByName ("1", kreds1)
    self.getobjectbyname ("2", kreds2)
    self.getobjectbyname ("3", kreds3)
    self.getobjectbyname ("4", kreds4)
    self.getobjectbyname ("5", kreds5)
    self.getobjectbyname ("6", kreds6)
    self.getobjectbyname ("7", kreds7)
    self.getobjectbyname ("8", kreds8)
    self.getobjectbyname ("9", kreds9)
    self.getobjectbyname ("10", kreds10)
    self.getobjectbyname ("11", kreds11)
    self.getobjectbyname ("12", kreds12)
    self.getobjectbyname ("13", kreds13)
    
    dim inp1, inp2, inp3, inp4, inp5 as xpTextObject
    
    self.GetObjectByName ("Text1", inp1)
    self.GetObjectByName ("Text2", inp2)
    self.GetObjectByName ("Text3", inp3)
    self.GetObjectByName ("Text4", inp4)
    self.GetObjectByName ("Text5", inp5)
    
    if inp1 = "701" then
    kreds1.visible = true
    
    elseif inp2 = "701" then
    kreds1.visible = true
    
    elseif inp3 = "701" then
    kreds1.visible = true
    
    elseif inp4 = "701" then
    kreds1.visible = true
    
    elseif inp5 = "701" then
    kreds1.visible = true
    
    else
    kreds1.visible = false
    
    end if

    Nothing seems to happen
    I've put the script in here:

    Like this:

    I have the groups here and text input



    ------------------------------
    Tue Sandbæk
    Director / TV-Technician
    TV SYD
    ------------------------------


  • 2.  RE: Script won't work
    Best Answer

    Posted 11-02-2022 05:31
    Hi,
    You write
    if inp1 = "701" then​

    should be -
    if inp1.text = "701"​ then

    Your script is so big. Why don't you use loops? And why do you define 13 xpbaseobjects if you are using only one?
    Try it

            Dim kreds(12) As xpBaseObject
            For i As Integer = 0 To 12
                self.GetObjectByName(CStr(i + 1), kreds(i))
            Next
    
            Dim inp(4) As xpTextObject
            For i As Integer = 0 To 4
                self.GetObjectByName("Text" + CStr(i + 1), inp(i))
            Next
            kreds(0).Visible = False
            For i As Integer = 0 To 4
                If inp(i).Text = "701" Then
                    kreds(0).Visible = True
                    Exit For
                End If
            Next
    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 3.  RE: Script won't work

    Ross Staff
    Posted 11-02-2022 09:12
    This script should be converted into visual logic. Running scripts in OnRender events is generally not recommended. The use case for this script will be more stable and execute better as visual logic.


  • 4.  RE: Script won't work

    Posted 30 days ago
    Hello @Garner.

    I got this script working
    dim kreds1, kreds2, kreds3, kreds4, kreds5, kreds6, kreds7, kreds8, kreds9, kreds10, kreds11, kreds12, kreds13 as xpBaseObject
    
    self.GetObjectByName ("1", kreds1)
    self.getobjectbyname ("2", kreds2)
    self.getobjectbyname ("3", kreds3)
    self.getobjectbyname ("4", kreds4)
    self.getobjectbyname ("5", kreds5)
    self.getobjectbyname ("6", kreds6)
    self.getobjectbyname ("7", kreds7)
    self.getobjectbyname ("8", kreds8)
    self.getobjectbyname ("9", kreds9)
    self.getobjectbyname ("10", kreds10)
    self.getobjectbyname ("11", kreds11)
    self.getobjectbyname ("12", kreds12)
    self.getobjectbyname ("13", kreds13)
    
    dim inp1, inp2, inp3, inp4, inp5 as xpTextObject
    
    self.GetObjectByName ("Text1", inp1)
    self.GetObjectByName ("Text2", inp2)
    self.GetObjectByName ("Text3", inp3)
    self.GetObjectByName ("Text4", inp4)
    self.GetObjectByName ("Text5", inp5)
    
    dim søn, aab, tøn, esbby, esbom, var, vej, vejno, vejsy, fre, kolno, kolsy, had as xpQuadObject
    
    self.GetObjectByName ("SØNDERBORG", søn)
    self.GetObjectByName ("AABENRAA", aab)
    self.GetObjectByName ("TØNDER", tøn)
    self.GetObjectByName ("ESBJERG BY", esbby)
    self.GetObjectByName ("ESBJERG OMEGN", esbom)
    self.GetObjectByName ("VARDE", var)
    self.GetObjectByName ("VEJEN", vej)
    self.GetObjectByName ("VEJLE NORD", vejno)
    self.GetObjectByName ("VEJLE SYD", vejsy)
    self.GetObjectByName ("FREDERICIA", fre)
    self.GetObjectByName ("KOLDING NORD", kolno)
    self.GetObjectByName ("KOLDING SYD", kolsy)
    self.GetObjectByName ("HADERSLEV", had)
    
    if inp1.Text = "søn" then
    kreds1.PosY = 540
    kreds1.visible = true
    søn.Visible = true
    elseif inp2.Text = "søn" then
    kreds1.PosY = 390
    kreds1.visible = true
    søn.Visible = true
    elseif inp3.Text = "søn" then
    kreds1.PosY = 240
    kreds1.visible = true
    søn.Visible = true
    elseif inp4.Text = "søn" then
    kreds1.PosY = 90
    kreds1.visible = true
    søn.Visible = true
    elseif inp5.Text = "søn" then
    kreds1.PosY = -60
    kreds1.visible = true
    søn.Visible = true
    else
    kreds1.visible = false
    søn.Visible = false
    end if
    
    if inp1.Text = "aab" then
    kreds2.PosY = 540
    kreds2.visible = true
    aab.Visible = true
    elseif inp2.Text = "aab" then
    kreds2.PosY = 390
    kreds2.visible = true
    aab.Visible = true
    elseif inp3.Text = "aab" then
    kreds2.PosY = 240
    kreds2.visible = true
    aab.Visible = true
    elseif inp4.Text = "aab" then
    kreds2.PosY = 90
    kreds2.visible = true
    aab.Visible = true
    elseif inp5.Text = "aab" then
    kreds2.PosY = -60
    kreds2.visible = true
    aab.Visible = true
    else
    kreds2.visible = false
    aab.Visible = false
    end if
    
    if inp1.Text = "tøn" then
    kreds3.PosY = 540
    kreds3.visible = true
    tøn.Visible = true
    elseif inp2.Text = "tøn" then
    kreds3.PosY = 390
    kreds3.visible = true
    tøn.Visible = true
    elseif inp3.Text = "tøn" then
    kreds3.PosY = 240
    kreds3.visible = true
    tøn.Visible = true
    elseif inp4.Text = "tøn" then
    kreds3.PosY = 90
    kreds3.visible = true
    tøn.Visible = true
    elseif inp5.Text = "tøn" then
    kreds3.PosY = -60
    kreds3.visible = true
    tøn.Visible = true
    else
    kreds3.visible = false
    tøn.Visible = false
    end if
    
    if inp1.Text = "esbby" then
    kreds4.PosY = 540
    kreds4.visible = true
    esbby.Visible = true
    elseif inp2.Text = "esbby" then
    kreds4.PosY = 390
    kreds4.visible = true
    esbby.Visible = true
    elseif inp3.Text = "esbby" then
    kreds4.PosY = 240
    kreds4.visible = true
    esbby.Visible = true
    elseif inp4.Text = "esbby" then
    kreds4.PosY = 90
    kreds4.visible = true
    esbby.Visible = true
    elseif inp5.Text = "esbby" then
    kreds4.PosY = -60
    kreds4.visible = true
    esbby.Visible = true
    else
    kreds4.visible = false
    esbby.Visible = false
    end if
    
    if inp1.Text = "esbom" then
    kreds5.PosY = 540
    kreds5.visible = true
    esbom.Visible = true
    elseif inp2.Text = "esbom" then
    kreds5.PosY = 390
    kreds5.visible = true
    esbom.Visible = true
    elseif inp3.Text = "esbom" then
    kreds5.PosY = 240
    kreds5.visible = true
    esbom.Visible = true
    elseif inp4.Text = "esbom" then
    kreds5.PosY = 90
    kreds5.visible = true
    esbom.Visible = true
    elseif inp5.Text = "esbom" then
    kreds5.PosY = -60
    kreds5.visible = true
    esbom.Visible = true
    else
    kreds5.visible = false
    esbom.Visible = false
    end if
    
    if inp1.Text = "var" then
    kreds6.PosY = 540
    kreds6.visible = true
    var.Visible = true
    elseif inp2.Text = "var" then
    kreds6.PosY = 390
    kreds6.visible = true
    var.Visible = true
    elseif inp3.Text = "var" then
    kreds6.PosY = 240
    kreds6.visible = true
    var.Visible = true
    elseif inp4.Text = "var" then
    kreds6.PosY = 90
    kreds6.visible = true
    var.Visible = true
    elseif inp5.Text = "var" then
    kreds6.PosY = -60
    kreds6.visible = true
    var.Visible = true
    else
    kreds6.visible = false
    var.Visible = false
    end if
    
    if inp1.Text = "vej" then
    kreds7.PosY = 540
    kreds7.visible = true
    vej.Visible = true
    elseif inp2.Text = "vej" then
    kreds7.PosY = 390
    kreds7.visible = true
    vej.Visible = true
    elseif inp3.Text = "vej" then
    kreds7.PosY = 240
    kreds7.visible = true
    vej.Visible = true
    elseif inp4.Text = "vej" then
    kreds7.PosY = 90
    kreds7.visible = true
    vej.Visible = true
    elseif inp5.Text = "vej" then
    kreds7.PosY = -60
    kreds7.visible = true
    vej.Visible = true
    else
    kreds7.visible = false
    vej.Visible = false
    end if
    
    if inp1.Text = "vejno" then
    kreds8.PosY = 540
    kreds8.visible = true
    vejno.Visible = true
    elseif inp2.Text = "vejno" then
    kreds8.PosY = 390
    kreds8.visible = true
    vejno.Visible = true
    elseif inp3.Text = "vejno" then
    kreds8.PosY = 240
    kreds8.visible = true
    vejno.Visible = true
    elseif inp4.Text = "vejno" then
    kreds8.PosY = 90
    kreds8.visible = true
    vejno.Visible = true
    elseif inp5.Text = "vejno" then
    kreds8.PosY = -60
    kreds8.visible = true
    vejno.Visible = true
    else
    kreds8.visible = false
    vejno.Visible = false
    end if
    
    if inp1.Text = "vejsy" then
    kreds9.PosY = 540
    kreds9.visible = true
    vejsy.Visible = true
    elseif inp2.Text = "vejsy" then
    kreds9.PosY = 390
    kreds9.visible = true
    vejsy.Visible = true
    elseif inp3.Text = "vejsy" then
    kreds9.PosY = 240
    kreds9.visible = true
    vejsy.Visible = true
    elseif inp4.Text = "vejsy" then
    kreds9.PosY = 90
    kreds9.visible = true
    vejsy.Visible = true
    elseif inp5.Text = "vejsy" then
    kreds9.PosY = -60
    kreds9.visible = true
    vejsy.Visible = true
    else
    kreds9.visible = false
    vejsy.Visible = false
    end if
    
    if inp1.Text = "fre" then
    kreds10.PosY = 540
    kreds10.visible = true
    fre.Visible = true
    elseif inp2.Text = "fre" then
    kreds10.PosY = 390
    kreds10.visible = true
    fre.Visible = true
    elseif inp3.Text = "fre" then
    kreds10.PosY = 240
    kreds10.visible = true
    fre.Visible = true
    elseif inp4.Text = "fre" then
    kreds10.PosY = 90
    kreds10.visible = true
    fre.Visible = true
    elseif inp5.Text = "fre" then
    kreds10.PosY = -60
    kreds10.visible = true
    fre.Visible = true
    else
    kreds10.visible = false
    fre.Visible = false
    end if
    
    if inp1.Text = "kolno" then
    kreds11.PosY = 540
    kreds11.visible = true
    kolno.Visible = true
    elseif inp2.Text = "kolno" then
    kreds11.PosY = 390
    kreds11.visible = true
    kolno.Visible = true
    elseif inp3.Text = "kolno" then
    kreds11.PosY = 240
    kreds11.visible = true
    kolno.Visible = true
    elseif inp4.Text = "kolno" then
    kreds11.PosY = 90
    kreds11.visible = true
    kolno.Visible = true
    elseif inp5.Text = "kolno" then
    kreds11.PosY = -60
    kreds11.visible = true
    kolno.Visible = true
    else
    kreds11.visible = false
    kolno.Visible = false
    end if
    
    if inp1.Text = "kolsy" then
    kreds12.PosY = 540
    kreds12.visible = true
    kolsy.Visible = true
    elseif inp2.Text = "kolsy" then
    kreds12.PosY = 390
    kreds12.visible = true
    kolsy.Visible = true
    elseif inp3.Text = "kolsy" then
    kreds12.PosY = 240
    kreds12.visible = true
    kolsy.Visible = true
    elseif inp4.Text = "kolsy" then
    kreds12.PosY = 90
    kreds12.visible = true
    kolsy.Visible = true
    elseif inp5.Text = "kolsy" then
    kreds12.PosY = -60
    kreds12.visible = true
    kolsy.Visible = true
    else
    kreds12.visible = false
    kolsy.Visible = false
    end if
    
    if inp1.Text = "had" then
    kreds13.PosY = 540
    kreds13.visible = true
    had.Visible = true
    elseif inp2.Text = "had" then
    kreds13.PosY = 390
    kreds13.visible = true
    had.Visible = true
    elseif inp3.Text = "had" then
    kreds13.PosY = 240
    kreds13.visible = true
    had.Visible = true
    elseif inp4.Text = "had" then
    kreds13.PosY = 90
    kreds13.visible = true
    had.Visible = true
    elseif inp5.Text = "had" then
    kreds13.PosY = -60
    kreds13.visible = true
    had.Visible = true
    else
    kreds13.visible = false
    had.Visible = false
    end if​

    I did'nt have the time to try visual logic, had some troubles, how would it look like in visual logic?

    best regards Tue.




    ------------------------------
    Tue Sandbæk
    Director / TV-Technician
    TV SYD
    ------------------------------



  • 5.  RE: Script won't work

    Posted 11-03-2022 04:30

    Hey @Roma

    I have to try with some loops, I just had to get it working, and I'm still not good at loops.
    I was not finish, therefor only one baseobject at that point.
    Your trick, did the work!

    ------------------------------
    Tue Sandbæk
    Director / TV-Technician
    TV SYD
    ------------------------------



  • 6.  RE: Script won't work

    Posted 11-03-2022 06:18
    Hi @Tue
    Yes,  the script works properly.
    If you need, I add in the script all of your xpBaseObects
            Dim kreds(12) As xpBaseObject
            For i As Integer = 0 To 12
                self.GetObjectByName(CStr(i + 1), kreds(i))
                kreds(i).Visible = False
            Next
    
            Dim inp(4) As xpTextObject
            For i As Integer = 0 To 4
                self.GetObjectByName("Text" + CStr(i + 1), inp(i))
            Next
            kreds(0).Visible = False
            For Each kred As xpBaseObject In kreds
                For i As Integer = 0 To 4
                    If inp(i).Text = "701" Then
                        kred.Visible = True
                        Exit For
                    End If
                Next
            Next​
    ​Then you changed text in the textobject, press enter on numpad again for apply changing in the running scene.​​

    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------



  • 7.  RE: Script won't work

    Posted 30 days ago
    @Roma as you can see, the script ended up a bit different.
    But is there a way to make more simple?


    ------------------------------
    Tue Sandbæk
    Director / TV-Technician
    TV SYD
    ------------------------------



  • 8.  RE: Script won't work

    Posted 30 days ago
    Hi Tue.
    I made it easier but can't test in Xpression.
            Dim kreds(12) As xpBaseObject
            For i As Integer = 0 To 12
                self.GetObjectByName(CStr(i + 1), kreds(i))
                kreds(i).Visible = False
            Next
            Dim inp(4) As xpTextObject
            For i As Integer = 0 To 4
                self.GetObjectByName("Text" + CStr(i + 1), inp(i))
            Next
            Dim name() As String = {"SØNDERBORG", "AABENRAA", "TØNDER", "ESBJERG OMEGN", "VARDE", "VEJEN", "VEJLE NORD", "VEJLE SYD", "FREDERICIA", "KOLDING NORD", "KOLDING SYD", "HADERSLEV"}
            Dim Quad(12) As xpQuadObject
            For i As Integer = 0 To 12
                self.GetObjectByName(name(i), Quad(i))
                Quad(i).Visible = False
            Next
            Dim Intexts() As String = {"søn", "aab", "tøn", "esbby", "esbom", "var", "vej", "vejno", "vejsy", "fre", "kolno", "kolsy", "had"}
            For i As Integer = 0 To 12
                For j As Integer = 0 To 4
                    If inp(j).Text = Intexts(i) Then
                        kreds(i).PosY = 540 - (150 * j)
                        kreds(i).Visible = True
                        Quad(i).Visible = True
                        Exit For
                    End If
                Next
            Next​


    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------