Graphics

 View Only
  • 1.  Xpression script for a scoreboard

    Posted 11-09-2015 16:45
    Hi guys,

    I'm building a scoreboard for a game called International Rules. The scoring layout is Goals - Overs - Behinds (Total). This would appear on the scoreboard as 00-00-00 (00). The actual buttons are being pressed in Dashboard and this is triggering Xpression.

    Everything is working fine, but there's one aesthetic part that I need help on. When the scores are in single digits, I would like the score to have a zero in front of it, (For example, instead of just '3', it would say '03'). I'm actually working off a script built for a scoreboard that only has three scoring fields; 00-00 (00). This means that I can get what I want on one score, but not the others!

    That script looks like this:

    If CInt(JoeText2.Text < 10) Then

    JoeText4.text = JoeText1.text + " - 0" + JoeText2.text + " - 0" + JoeText3.text

    Else

    JoeText4.text = JoeText1.text + " - " + JoeText2.text + " - " + JoeText3.text

    End If


    Yes, it was made by a guy called Joe! Can anybody help me out with this?


  • 2.  RE: Xpression script for a scoreboard

    Posted 11-10-2015 13:52
    Can you post a link to the scene.. It would be easier if we could see what JoeText was actually connected to..

    #XPression


  • 3.  RE: Xpression script for a scoreboard

    Posted 11-10-2015 15:02
    Hi Brian,

    Thanks for the reply. Here's the full script:

    Dim JoeText1 as xpTextObject

    Dim JoeText2 as xpTextObject

    Dim JoeText3 as xpTextObject

    Dim JoeText4 as xpTextObject

    Dim JoeText5 as xpTextObject

    Dim JoeText6 as xpTextObject

    Dim Total as integer

    Self.GetObjectByName("TeamA Goals", JoeText1)

    Self.GetObjectByName("TeamA Overs", JoeText2)

    Self.GetObjectByName("TeamA Points", JoeText3)

    Self.GetObjectByName("Score_A", JoeText4)

    Self.GetObjectByName("TeamA_Total", JoeText5)

    Self.GetObjectByName("Score_A2", JoeText6)

    If CInt(JoeText2.Text < 10) Then

    JoeText4.text = JoeText1.text + " - 0" + JoeText2.text + " - 0" + JoeText3.text

    Else

    JoeText4.text = JoeText1.text + " - " + JoeText2.text " - " + JoeText3.text

    End If

    Total = CInt(JoeText1.Text*3) + CInt(JoeText2.Text*2) + CInt(JoeText3.Text*1)

    JoeText5.Text = "(" + CStr(Total) + ")"

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Self.GetObjectByName("TeamB Goals", JoeText1)

    Self.GetObjectByName("TeamB Overs", JoeText2)

    Self.GetObjectByName("TeamB Points", JoeText3)

    Self.GetObjectByName("Score_B", JoeText4)

    Self.GetObjectByName("TeamB_Total", JoeText5)

    Self.GetObjectByName("Score_B2", JoeText6)

    If CInt(JoeText2.Text < 10) Then

    JoeText4.text = JoeText1.text + " - 0" + JoeText2.text + " - 0" + JoeText3.text

    Else

    JoeText4.text = JoeText1.text + " - " + JoeText2.text " - " + JoeText3.text

    End If

    Total = CInt(JoeText1.Text*3) + CInt(JoeText2.Text*2) + CInt(JoeText3.Text*1)

    JoeText5.Text = "(" + CStr(Total) + ")"


    Should I upload a screenshot of how the scene looks aswell?

    #XPression


  • 4.  RE: Xpression script for a scoreboard

    Posted 11-11-2015 18:32

    Assuming the goals,overs,points will never go over 99, you could do it like this:



    `

    Dim JoeText1 as xpTextObject

    Dim JoeText2 as xpTextObject

    Dim JoeText3 as xpTextObject

    Dim JoeText4 as xpTextObject

    Dim JoeText5 as xpTextObject

    Dim JoeText6 as xpTextObject

    Dim Total as integer

    Self.GetObjectByName("TeamA Goals", JoeText1)

    Self.GetObjectByName("TeamA Overs", JoeText2)

    Self.GetObjectByName("TeamA Points", JoeText3)

    Self.GetObjectByName("Score_A", JoeText4)

    Self.GetObjectByName("TeamA_Total", JoeText5)

    Self.GetObjectByName("Score_A2", JoeText6)

    JoeText4.text = Right("00" & JoeText1.text, 2) + " - " + Right("00" & JoeText2.text, 2) + " - " + Right("00" & JoeText3.text, 2)

    Total = CInt(JoeText1.Text*3) + CInt(JoeText2.Text*2) + CInt(JoeText3.Text*1)

    JoeText5.Text = "(" + CStr(Total) + ")"

    `

    #XPression


  • 5.  RE: Xpression script for a scoreboard

    Posted 11-11-2015 18:35
    If they do need to go over 99 then replace the Right() sections with something like this:

    `Right("00" & JoeText1.text, Math.Max(2,JoeText1.text)))`

    #XPression


  • 6.  RE: Xpression script for a scoreboard

    Posted 11-12-2015 10:41
    Hi Brian, thanks so much for this. I'm working on another project today and tomorrow but I'll be back on this one next week and I'll see if this works.

    #XPression