Graphics

 View Only
  • 1.  Time Calculator

    Posted 02-16-2022 20:29
    Hi Everyone, 

    My name is Carlos Gonzalez and I recently joined the Xpression community. Would appreciate any advice on the current issue I am facing.I am trying to build out a time calculator in Xpression and wanted to see if anyone has any experience with this. Any advice would be appreciated. 


    ------------------------------
    Carlos Gonzalez
    Live Sporting Production
    ------------------------------


  • 2.  RE: Time Calculator

    Posted 02-17-2022 07:31
    Hey Carlos,

    Perhaps you could explain in a little more detail what you're trying to achieve?


    ------------------------------
    Simon Redmile
    Test Pilot | Senior Graphic Programmer & Designer
    Ross Video
    London United Kingdom
    ------------------------------



  • 3.  RE: Time Calculator

    Posted 02-17-2022 20:12
    Hey Simon, 

    Thank you for getting back to me. I am trying to build a function through visual logic or scripting to subtract 20 minutes by a time I input into the system. Say the time of the goal is 12:03 I would want to subtract 20:00 by 12:03 for the output to be 7:57.  Let me know if you have any questions. 

    Thanks again, 
    Carlos

    ------------------------------
    Carlos gonzalez
    production
    ------------------------------



  • 4.  RE: Time Calculator

    Posted 02-18-2022 04:00
    I would split the hour and minutes up and do the maths on the separately. 

    The clock i am just using here as an example of time, yours would probably come from data. The clock is set to 17:06

    I have set the left and right string to 2.

    I then put them all back together with a concat block with a colon delimiter. 

    I attached the visual logic, make a text object called "Text2" and import this and you should see it working. 


    ​​​

    ------------------------------
    Simon Redmile
    Test Pilot | Senior Graphic Programmer & Designer
    Ross Video
    London United Kingdom
    ------------------------------



  • 5.  RE: Time Calculator

    Posted 02-18-2022 06:26
    Hi Carlos,

    For me it's a bit unclear if your timing is using the actual time (like clock-time) or a timer (that starts at 0).

    For the latter, when you start a timer at the start of the game and you want to subtract a time from your timer, the solution of Simon would work well.
    However, if you are using the clock time, then the solution of Simon would not work at it's present form because if you go back 20 minutes from 12:02, you would need to get 11:42.
    So that would mean that you would have to create additional logic to get this to work, which is doable but a lot of work.

    Depending on your XPression version, you could use the Date/Time Offset-block that allows you to enter a time and to add or subtract any desired amount of time to the original time.

    From the top of my head, I think the Date/Time Offset was added in V8 or V9 but I'm not sure.

    You could then use something similar like below:

    In this example I have used two values, but these could be a textbox for example.
    These values are fed into an Encode Date Time-block to convert these values into an actual Date Time object.

    That Date Time-object is then fed into the Date/Time Offset-block in which I have specified a negative 20 in the minutes so it effectively subtracts 20 minutes from the original time provided.
    The output from that block can then be used to populate a textbox or something else.

    Note that you could also use a Clock-block if you needed to perform this action with the actual clock, but then you would just need to connect the clock directly to the Date/Time Offset and not use the Encode Date Time-block. 


    Best regards,
    Kenneth

    ------------------------------
    Kenneth Buck
    LOOK & LISTEN BVBA
    ------------------------------



  • 6.  RE: Time Calculator

    Posted 02-18-2022 06:32
    My understanding is the clock is counting down from 20 to 0.

    So the maths is 20 minutes subtracted by a value, not clock value subtracted by 20 minutes. 

    I am guessing it's something like a Hockey period so it would countdown from 20:00 to 00:00​

    So if someone scores at 19:59 you'd see a time of 00:01 displayed. 

    Unless I have miss understood.

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 7.  RE: Time Calculator

    Posted 02-18-2022 07:40
    Thanks for the clarification Simon, it all makes more sense now ;-)
    And your solution would be the best indeed.

    ------------------------------
    Kenneth Buck
    Senior Graphics Developer
    Bold Graphics
    Belgium
    ------------------------------



  • 8.  RE: Time Calculator

    Posted 02-18-2022 16:50

    Thanks for all your help Simon and Kenneth. I'm going to try it out on Sunday. 

    Thanks again! 



    ------------------------------
    Carlos gonzalez
    production
    ------------------------------