Graphics

 View Only
  • 1.  Get rid of the leading zero's on a countdown clock

    Posted 01-20-2012 17:19

    I recently had to do this and the Ross people offered a solution.. below is that solution..

    This Timer Code gets rid of the leading zero's for hours (00:59:00), minutes (09:59) & seconds (00:59).

    If you right click on your text object (that has the clock widget) you will see an option for "edit script events". (sometimes the text box loses focus and selects another object in your scene, if that happens lock the object it keeps selecting, then recheck on the text box and it keeps its focus.) Within 'edit script events', select 'OnSetText'. If you don't see 'OnSetText' then your focus isn't on the Text Box.

    Type the below code on the right window:

    if left(text,5) = "00:00" then

    text = right(text, len(text)-5)

    end if

    if left(text,4) = "00:0" then

    text = right(text, len(text)-4)

    end if

    if left(text,3) = "00:" then

    text = right(text, len(text)-3)

    end if



    At the top of the window there is a button that looks like a lightning bolt. This will compile your script, this must be done in order for it to function.

    Start your timer, load the framebuffer and watch the "magic" happen.



  • 2.  RE: Get rid of the leading zero's on a countdown clock

    Posted 01-21-2012 01:26
    You can also right click the object in the Object Manager and choose Edit Script Events. That way you don't have to worry about another object getting focus. (I think older versions had a bug where choosing Edit Script from the OBject Manager didn't work), so make sure you're running a recent version.

    #XPression


  • 3.  RE: Get rid of the leading zero's on a countdown clock

    Posted 12-18-2014 23:48
    I'm trying something similar with a realtime clock, but it isn't working for me. Any suggestions?

    #XPression


  • 4.  RE: Get rid of the leading zero's on a countdown clock

    Posted 12-23-2014 19:50
    James, if you are using the Clock Widget, you can just change the format to something like H:NN instead of HH:NN if you don't want a leading zero on the Hours..

    If you are doing it some other way, you'll need to provide more details.

    #XPression


  • 5.  RE: Get rid of the leading zero's on a countdown clock

    Posted 11-06-2015 17:43

    Hey guys, thanks for posting the above script... I couldn't get it to work for me as well.

    @Brian I have a countdown clock and I used the format option like you suggested. But I have a "1:15:00" (using H:NN:SS). But when it gets to under an hour, I get "0:59:00" where I need it to be just "59:00". If I manually change the "style" in properties to "NN:SS" the clock will change; but I was hoping to get a script to do that for me.

    I also found this script:

    dim timer as xpClockTimerWidget

    Engine.GetWidgetByName("Test", timer)

    if timer.TimerValue > 3600 then

    timer.format = "H:NN.SS"

    else

    timer.format = "NN:SS"

    end if



    But can't get either to work.. Any thoughts?


    #XPression


  • 6.  RE: Get rid of the leading zero's on a countdown clock

    Posted 11-06-2015 17:48

    below is the last version of this script I used and it worked for me.

    CLOCK WITH NO LEADING ZERO'S

    if left(text,5) = "00:00" then

    text = right(text, len(text)-5)

    end if

    if left(text,4) = "00:0" then

    text = right(text, len(text)-4)

    end if

    if left(text,3) = "00:" then

    text = right(text, len(text)-3)

    end if

    if left(text,2) = "0:" then

    text = right(text, len(text)-2)

    end if

    if left(text,1) = "0" then

    text = right(text, len(text)-1)

    end if

    #XPression


  • 7.  RE: Get rid of the leading zero's on a countdown clock

    Posted 11-06-2015 17:58
    Thanks Chris, that worked perfect. THANKS!

    #XPression