Graphics

 View Only
  • 1.  General Scripting Questions

    Posted 11-02-2012 18:50
    How do I change the Opacity and/or Color of an object based on numbers. Such as stock prices or voting numbers. I think I'm close but I'm missing something.


  • 2.  RE: General Scripting Questions

    Posted 11-03-2012 08:22
    In the script editor of your textbox that containing your numbers, in the setText tab :

    Dim MyObjectToAffect as xpBaseObject

    Self.GetObjectByNAme("Name_of_the_object_to_affect", MyObjectToAffect)

    MyObjectToAffect.alpha = Text 'value between 0 to 100; so here your need some math if you speak about prices ie.

    For color, it's a little bit different because your have to GetMaterial, GetShader of it and then play with ColorAmbient, ColorDiffuse, ColorEmissive or ColorSpecular.

    #XPression


  • 3.  RE: General Scripting Questions

    Posted 11-12-2012 05:26
    Thanks for the Help.

    Instead of trying to do the color thing I just duplicated the materials and adjusted the alpha in the script. It was porbably longer of a process but it got the job done.

    Here is the next thing.

    On things like our scoreboard, I had an arrow show for the winner. The way I was showed to determine if one score was greater than another was

    Dim Team1Score as XpTextObject

    Dim Team2Score as XpTextObject

    If Team1Score.Text > Team2Score.text Then

    Now this works fine unless One score has not the same number of digits.

    So a 7 is listed as greater than 23

    or 9999 is listed as greater than 10000.

    Any help.

    #XPression


  • 4.  RE: General Scripting Questions

    Posted 11-12-2012 15:55
    That is not the correct way to compare two values. That is essentially doing a sort of two text strings, rather than comparing their numerical equivalents..

    try this instead:

    If CInt(Team1Score.Text) > CInt(Team2Score.text) Then

    #XPression


  • 5.  RE: General Scripting Questions

    Posted 02-11-2013 21:08
    Brian has the right of it. We set it up earlier in our script, but it's the CInt of the text that we compare.

    dim AwayScore as xpTextObject

    dim HomeScore as xpTextObject

    dim AwayScoreInt as Integer

    dim HomeScoreInt as Integer

    dim Winner as xpBaseObject

    dim Status as xpTextObject

    If Self.GetObjectByName("AwayScore", AwayScore) then

    AwayScoreInt=CInt(AwayScore.Text)

    If Self.GetObjectByName("HomeScore", HomeScore) then

    HomeScoreInt=CInt(HomeScore.Text)

    Self.GetObejctByName("GameStatus", Status)

    Self.GetObejctByName("Winner,", Winner)

    If InStr(Status.Text, "FINAL") = 1 then

    Winner.Alpha = 100

    Else

    Winner.Alpha = 0

    End If

    If AwayScoreInt > HomeScoreInt then

    Winner.Posy = 'lined up with away team

    End If

    If AwayScoreInt < HomeScoreInt then

    Winner.PosY = 'lined up with home team

    End If

    If AwayScoreInt = HomeScoreInt then

    Winner.Alpha = 0

    End If


    Works really well for us. Questions, let me know.

    #XPression