Graphics

 View Only
  • 1.  OnSetText script runs before text property actually changes? Unable to use new value within script.

    Posted 12-27-2019 03:10

    Hello good people,

    I'm running into a problem because it seems the "OnSetText" script is run immediately before the object's text property actually changes. As a reult, you can't grab the new string to use within the script.

    I built a scene to test this.. I made Text-A driven by a time counter in Visual Logic. Then in the OnSetText tab of Text-A, the text property of Text-B is set to the value of Text-A's text. The result is that Text-B is always a second behind.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Here's a description of this problem within my specific scene.

    It's a Poll Template with a list of political candidates in order of who has the most votes. If one candidate overtakes another, the text objects that are the names of each candidate are driven by Datalinq and will update automatically. On each of those text objects there's an OnSetText script that I'd like to use to update each corresponding quad object with the correct candidate's headshot.

    The problem is that I can't use the text property to grab the correct cadidate's name to make a filepath to the correct headshot image file (using setVolatileTexture method), as it's not yet updated to the new candidate's name at that time.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Please let me know if I can clarify.

    Thank you!



  • 2.  RE: OnSetText script runs before text property actually changes? Unable to use new value within script.

    Posted 12-27-2019 10:49

    Hello Robert,

    you can use the Text parameter of the OnSetText function to get the new value :

    for example , the script for Text-A object would be :

    dim txtB as xpTextObject

    if( scene.GetObjectByName("Text-B", txtB) ) then
    txtB.text = Text
    end if

    Text-B won't be a second behind anymore.

     

    Hope it helps,

    Antoine.


    #XPression


  • 3.  RE: OnSetText script runs before text property actually changes? Unable to use new value within script.

    Posted 12-27-2019 21:15

    This works for me. It seems my problem was that I was using 'Self.Text' instead of just 'Text.'

    Many thanks, Antoine.


    #XPression