User Tag List

Results 1 to 9 of 9

Thread: Calculating milliseconds?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,307
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Calculating milliseconds?

    Can anyone offer an equation for calculating milliseconds (game is running at 60fps)? Also to calculate seconds and minutes? It seems like MMF only returns time in centiseconds (1/100)?

    My format is 00:00:000 using 3 counters.

    Cheers,

    Reg

  2. #2
    Clicker Multimedia Fusion 2
    seripa's Avatar
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mmf can read 1000ths. the key word for retrieving the 1000ths in the expression editor is "timer"

    also, the timer works independently of the fps.

    you equation will be something like

    return_seconds = (timer/1000) mod 60
    return minutes = ((timer/1000)/60) mod 60

    the "mod" just makes it go back to 0 after it counts higher than 59

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,307
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the equations. But I failed to mention I actually need the counter for milliseconds to constantly cycle from 0 to 1000.

    Edit: I just realized that I need a way to handle pausing this timer, as there are moments in my game where the timer needs to be put on hold while events play out. I guess I need to manually record the time instead of using a constant game timer. Any suggestions?

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,307
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    After a lot of tinkering with the equations, I figured it out. For anyone else looking to use their own custom timer (add 1 to a variable every frame) and convert it to milliseconds, seconds and minutes you can use:

    Always: Add 1 to "Time" variable
    Milliseconds: Set Counter to Int(((1000.0/60.0)*Time) mod 1000)
    Seconds: Set Counter to (Time/60) mod 60
    Minutes: Set Counter to ((Time/60)/60) mod 60

    Note: this is setup to work with the game running at 60fps. And just use Int((1000.0/60.0)*Time) if you want to retrieve the total milliseconds.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Koji_Kabuto's Avatar
    Join Date
    Jul 2006
    Location
    Venezuela
    Posts
    2,847
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Excellent Mobichan, do you think that it can use as a replacement in order to Date & Time and set a countdown?

    I ask this, because just this object is giving problems on 3 exporters: Android, IOS, and HTML5.

    If you asked to give an example in MMF, I'd appreciate it greatly. I assume that by changing the variable TIME, you might have several clocks just as I have several Date & Time at the same time.

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,307
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Sorry Koji, but I am not at home to make an example. This method of calculating time would only be helpful if the game is running. If you need an internal clock that checks the current date or time even when the app is not running, this method won't help you. I would recommend using a server to give you the current time. But that would require the player always has an internet connection.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Koji_Kabuto's Avatar
    Join Date
    Jul 2006
    Location
    Venezuela
    Posts
    2,847
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mobichan View Post
    Sorry Koji, but I am not at home to make an example. This method of calculating time would only be helpful if the game is running.
    This is what I need exactly, you think you can do an example. Thank you you very much!

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,307
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    I might have time tonight to make an example. But you really only need to make a global variable called "Time" and 3 counters. Add 1 to Time every frame. Then set the counters to the equations I posted.

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Koji_Kabuto's Avatar
    Join Date
    Jul 2006
    Location
    Venezuela
    Posts
    2,847
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You're right Mobichan, it is too simple, the bad habit to ask for examples.

Similar Threads

  1. calculating hours
    By matte in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 8th March 2013, 02:58 PM
  2. time in milliseconds? Is possible
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 12th February 2009, 10:56 PM
  3. Calculating bandwidth?
    By Tiny in forum Lacewing
    Replies: 8
    Last Post: 12th January 2009, 09:07 PM
  4. Milliseconds
    By Kankki in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 25th July 2006, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •