Graphics

 View Only
  • 1.  Conditional combining of multiple text fields into one SOLVED

    Posted 10-28-2019 21:09

    Here is my scenario: xml stats and I want to do the field goal ratio 00/00 and want to treat it as a single text field comprised of two text fields with a separator "/". BUT, I want to do it only on certain conditions. 

    I have used

    dim first, second, full as xpTextObject

    self.getobjectbyname("firststat", first)

    self.getobjectbyname("secontstat", second)

    self.getobjectbyname("fullstat", full)

    Full.text = first.text & " " & second.text

    on the scene it works great. But I only need it to work when I want ratios. 

    What is the magic step I am missing. I have tried it on the stat title, on the datalinq key and on a dedicated text object. I use a dashboard and select from about 20 different stats using datalinq keys and it works great.

     

    as always, thanks in advance



  • 2.  RE: Conditional combining of multiple text fields into one SOLVED

    Posted 10-29-2019 23:29

    Do you have anything that can tell your script what type of stat it is? For example, if your stat label is in a text field then you could do something like

    if statLabel.text = "FG" then

      Full.text = first.text + "/" + second.text

    else

      Full.text = first.text

    end if

    Or if second.text is always empty when there's not a value

    if trim(second.text) <> "" then

      Full.text = first.text + "/" + second.text

    else

      Full.text = first.text

    end if

     


    #XPression


  • 3.  RE: Conditional combining of multiple text fields into one SOLVED

    Posted 10-30-2019 20:14

    thanks Ben, I will give this a try tonight


    #XPression


  • 4.  RE: Conditional combining of multiple text fields into one SOLVED

    Posted 11-20-2019 19:02

    Finally got to this. Way too many home games to get into scripting. Here is my scenario. I am pulling from xml stat data via the NGSS feed. If I want to show "field goals" as a ratio I need to pull field goals made (Stat1A) and field goals attempted (Stat1B).

    if the stat name is "Field Goals" I want to display Stat1A/Stat1B. Pretty simple. Stat 1.text = Stat1A.text & "/" & Stat1B.text.

    Else, Stat1.text = Stat1A.text.

     

    That is the direction I am taking this but I must be overthinking it. Thanks for you assist Ben.


    #XPression


  • 5.  RE: Conditional combining of multiple text fields into one SOLVED

    Posted 11-29-2019 17:30

    Here is an interesting wrinkle: the combining went well however sometimes it triggers a random material in the scene to simply disappear until I close Xpression and reopen, sometimes it requires a reboot. I set the script on one of my stat titles to apply itself to the data that appears after it. I kept it simple and it works great. After maybe 5 attempts at changing the stat, my sponsor logo simply disappeared. I looked at the quad it was visible with 100% opacity. I looked at the material, it was intact. However the thumbnail was blank. This also happened to the BG material of my scene.  This scene has grown in complexity since I first designed it so I'm pretty sure I have a conflict somewhere. If you have had this happen what did you do to fix it? 

    Thanks

     


    #XPression


  • 6.  RE: Conditional combining of multiple text fields into one SOLVED

    Posted 01-16-2020 16:50

    I opted to build the script on the scene object and all is solid. If anyone wants the scripting I used feel free to ask. I am still refining it.


    #XPression