Graphics

 View Only
  • 1.  While loop help

    Posted 07-23-2014 18:12
    I want to use a while loop (or other if it's a better idea) to look at a count down timer (nba shot clock) and change the material to the BG comp of the clock when the value


  • 2.  RE: While loop help

    Posted 07-23-2014 18:21
    Hi Malcolm,

    I think you're on a bit of the wrong track here.. You probably don't want a while loop at all; you need an IF statement to check if the ShotClk text is less than 10.. I assume your script is in OnSetText? If so, it will get called each time the shotclock value changes, so you only need to check if the current text is less than 10 then change the background..

    Here is some psedo code to get you started..

    if CInt(Text) < 10 then

    GetMaterialByName("RED BG")

    SetMaterial

    else

    GetMaterial("Not red bg")

    SetMaterial

    end if

    If you are running version 5.5 you may also want to look at the Visual Logic feature. You can probably accomplish the same thing without having to write any scripting.

    If you get stuck; try to post a link to your scene here and I or someone else on the forum might be able to help you get it working.

    Brian

    #XPression


  • 3.  RE: While loop help

    Posted 07-23-2014 18:32
    Visual Logic example:



    #XPression


  • 4.  RE: While loop help

    Posted 07-23-2014 19:22
    Brian,

    As always thank you for the help. I am designing in Xpression designer but I think I will head up to the control room and work there instead.

    #XPression


  • 5.  RE: While loop help

    Posted 07-25-2014 23:07
    https://www.dropbox.com/s/od1ksdk1xyzwtk4/2015%20jazz%20scoreboard.xpp

    Please take a look here and see what I might be doing wrong with the scripting on the text object SHOT CLOCK BG SCRIPTING

    Thanks all,

    Malcolm

    #XPression


  • 6.  RE: While loop help

    Posted 07-26-2014 03:39
    Try this.. I saved it in 5.7 so hopefully it loads ok in whatever version you are running.

    Play the scene back from the sequencer and use the widget to run the shot clock.

    There was quite a few errors in your script so just compare yours and mine to see what was wrong:



    dim Material as xpMaterial

    dim Quad as xpBaseObject

    Scene.GetObjectByName("SHOTCLOCK BG",Quad)

    if CDbl(Text) < 10.0 then

    Engine.GetMaterialByName("SHOTCLOCKRD_BG", Material)

    else

    Engine.GetMaterialByName("SHOTCLOCKBLK_BG", Material)

    end if

    Quad.SetMaterial(0, Material)



    #XPression


  • 7.  RE: While loop help

    Posted 07-26-2014 03:39
    Sorry, forgot to post the link to the fixed project:

    http://ross.brickftp.com/f/f62bff9ea

    #XPression


  • 8.  RE: While loop help

    Posted 07-30-2014 02:41
    works like a charm. We are running 5.7 so this is perfect. One question; what is CDbl(Text)? Thanks for the help.

    #XPression


  • 9.  RE: While loop help

    Posted 07-30-2014 14:02
    CDbl will convert the string contained in "text" to a floating point number.

    http://www.w3schools.com/vbScript/func_cdbl.asp

    If you are already running version 5.7 you could just use the Visual Logic blocks I posted above.

    Note that 5.7 is only available in Beta so stay in contact with Tech Support to get notified when it is officially released and you should upgrade at that time to the official released build.

    #XPression


  • 10.  RE: While loop help

    Posted 09-08-2014 21:31
    Next step: In the rare event that we go into overtime, how can I use the value of a text string "OT" (sent by scoreboard) after converting it to a floating point number, in a logic function so that if it is true then replace the background with an "overtime" graphic and make "Qtr" text and quarter number invisible? Or a more simple way question: how can I find the floating point value of the text string "OT"? I think I can figure out the logic arguments.

    Thanks ( and I know it's a confusing question, and no I don't write code this way.)

    #XPression