Graphics

 View Only
  • 1.  Script Events on DataLinq Change?

    Posted 03-02-2013 21:57
    Hey there, so basically I have some text Datalinq fields which are set to 0 Alpha, they're purpose is to run a script event when the value changes which should evaluate the new value and change the filename of a material. I placed the script under OnSetText. I can't seem to get the behavior to act right, it's always is one update behind where it should be. If I move this script to scene OnRender, it just puts the CPU through the roof to keep checking the values of the DataLinqs, however it does work as expected.

    Suggestions?


  • 2.  RE: Script Events on DataLinq Change?

    Posted 03-02-2013 22:22
    Brennan,

    Do you have "live update" disabled?

    Can I take a look at the script?

    That should be fairly straight forward.

    #XPression


  • 3.  RE: Script Events on DataLinq Change?

    Posted 03-02-2013 22:26
    Live Update is enabled..

    dim PicObj as xpBaseObject

    dim PicMat as xpMaterial

    dim PicShad as xpBaseShader

    dim BallOn as String

    dim BallOff as String

    'File Paths Below

    BallOn = Engine.ProjectPath & "Scorebug" & "BAL1.png"

    BallOff = Engine.ProjectPath & "Scorebug" & "BAL0.png"

    ' Process Balls

    Select Case Self.text

    Case "1"

    Scene.GetObjectByName("Ball 1", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Scene.GetObjectByName("Ball 2", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    Scene.GetObjectByName("Ball 3", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    Case "2"

    Scene.GetObjectByName("Ball 1", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Scene.GetObjectByName("Ball 2", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Scene.GetObjectByName("Ball 3", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    Case "3"

    Scene.GetObjectByName("Ball 1", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Scene.GetObjectByName("Ball 2", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Scene.GetObjectByName("Ball 3", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOn)

    Case Else

    Scene.GetObjectByName("Ball 1", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    Scene.GetObjectByName("Ball 2", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    Scene.GetObjectByName("Ball 3", PicObj)

    PicObj.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(BallOff)

    End Select

    #XPression


  • 4.  RE: Script Events on DataLinq Change?

    Posted 03-02-2013 23:03
    As another note, if I keep Alpha up on the datalinq text fields, I can see them change online, while the associated graphic doesn't until the datalinq changes again, at which point the graphic changes to where it should have been the previous time, the logic always follows but it's just an update behind. Moving from 1 to 2 to 3 to 0, goes as expected just one behind, same with 1 to 0 to 1 to 2 etc... Is the self.text value not set to the new value before the script runs?

    #XPression


  • 5.  RE: Script Events on DataLinq Change?

    Posted 03-03-2013 00:55
    Brennan

    Im not eactly sure what you are trying to achieve but it seems like you just want to set a shader based on the string value of your text object.

    The string is already declared in the subroutine onSetText as "text". Have you tried just using an If statement to achieve this.

    If text = "1" then

    Etc.

    Andrew

    #XPression


  • 6.  RE: Script Events on DataLinq Change?

    Posted 03-03-2013 17:53
    Sorry, I didn't notice that Self.Text and Text are declared differently, Self.text keeps the old value when the script is run, while Text is the new value that must get set sometime after the execution, rather helpful for comparing the old vs new values though.

    Thanks!

    #XPression