User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: How to convert the Date/Time to a string?

  1. #1
    Clicker Multimedia Fusion 2 DeveloperInstall Creator Pro

    Join Date
    May 2010
    Posts
    536
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to convert the Date/Time to a string?

    Hey, folks!

    I'm using a Date/Time object that runs a stop watch to determine how long it takes a person to go through my project.

    I have set up a String object such that when the last frame is displayed, the Date/Time object "retrieves the stop watch time," then "sets it to Numerical Value A."

    I then have a String object which "converts the numeric value to a string" of the Date/Time objects "Value A."

    This string value is then set as the Amendable string, is to display that Amendable string, and is to "append a file" (using a File object) the String object's "Amendable string."

    Theoretically, I am expecting the output of the stop watch time (though I'm not sure whether it would display as seconds, minute and seconds, or what). Instead, when I view the text file (which the File object creates and appends), I get the same repetitive string:

    "825182518251...." (and continues for about 25 characters)

    So, my question is: What am I doing wrong? How can I get a text file to output the stop watch time which started on the second frame of my project?

    Thank you for your input!



    Most graciously,

    RGBreality

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Put the Str$ of the stopwatch time into an edit box (or any other object that saves) and save it. Don't use string objects like that to save... and don't use the Rich Edit either.
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    It sounds like the stopwatch value is 8251 (milliseconds?), and it's appending it to the file more than once.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperInstall Creator Pro

    Join Date
    May 2010
    Posts
    536
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Thanks for your reply, LB!

    I must still be doing something wrong...

    I have the original iteration of the Date/Time object on the first frame. Then, in a sub-application, I have a copy of the Date/Time object (dragged-and-dropped from the original frame); there is also an edit box in which its text is set that "every chronological second" (of the Date/Time object's stop watch time), it is to "get the chronological time of the stop watch" (using this expression:

    Str$(chrono of ("Master Time"))

    "Master Time" being the name of the Date/Time object.

    I then have a Global Event that states when the "application reaches frame 26" (the last frame) it is to set Flag 1 of the Date/Time object on.

    Back in the sub-application, there is an event which states that if "Flag 1 of the Date/Time object on," then the Edit box is to "save a text file" of the set text.

    I set the sub-application to always be on top so that as I go through my run-time application, I can watch its value. Alas, as I go through it, the Edit box always reads "0," as if the stop watch never started. Furthermore, when the application ends, there is no text file saved.

    So, what might I be doing wrong here?

    Thanks for your guidance and help, as always!


    RGBreality

  5. #5
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Does the flag ever turn on? Look at it in the debugger.
    Working as fast as I can on Fusion 3

  6. #6
    Clicker Multimedia Fusion 2 DeveloperInstall Creator Pro

    Join Date
    May 2010
    Posts
    536
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    After doing a bit of reworking on this, I was able to use a TimeX object, start a "global timer," then set the text in an Edit box object to the "time since the game began," then write that to a text file.

    However, the numeric value is not one which has much meaning. It reads "86578". I'm not sure what units of measure that is (is that milliseconds, or seconds?), so I can't begin to write a formula that would convert that string to something more meaningful.

    Any ideas?


    RGBreality

  7. #7
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Could you give us an idea how lone it actually took before it stopped the timer and did this?

    Also, you should not use time since game began, you want to use the time of the global timer you started.
    Working as fast as I can on Fusion 3

  8. #8
    Clicker Multimedia Fusion 2 DeveloperInstall Creator Pro

    Join Date
    May 2010
    Posts
    536
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Hmmmm... That's interesting...

    When I set the Edit box to set its text to the numeric conversion of the TimeX object's global timer (timer 1), the text file value it outputs is "0".

    In reality, since I am testing this, it takes me less than a minute to click through all the frames from begin to end. So, the global time should be something around there.



    RGBreality

  9. #9
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    Would it be about 8 seconds, you think?
    Working as fast as I can on Fusion 3

  10. #10
    Clicker Multimedia Fusion 2 DeveloperInstall Creator Pro

    Join Date
    May 2010
    Posts
    536
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How to convert the Date/Time to a string?

    I think one thing I did wrong was that even though I used only one timer for this TimeX object (you can create more than one timer for a TimeX object), the first time is "0" and not "1" (even though one may specify you only want "1" timer).

    So, once I started "global timer 0" and specified the Edit box to save the numeric conversion of "global timer 0" I received a value other than "0". Again, though, it is an ambiguous number: "27906".

    Reading their documentation, it seems that the TimeX object uses milliseconds in time.

    So, if I wanted to convert this to seconds, it would be roughly 27.9 seconds?

    What if I wanted to create a formula and set up the Edit box to display "X" minutes and "Y" seconds. How would I do something like that?


    EDIT:

    So, I took a stab at this... Assuming that the TimeX object outputs all values in milliseconds, then I would use these formulas to calculate seconds and minutes:

    Set Alterable Value A to GetTimer ("TimeX", 0) //milliseconds

    Set Alterable Value B to Alterable Value A ("Edit Box")/1000 //sets into seconds

    Set Alterable Value C to Alterable Value B ("Edit Box")/60 //sets into minutes

    Set Text Str$(Alterable Value C("Edit Box") //displays Total Time in minutes


    This works to properly display the minutes in a numeric (though literally string) value in a text file. However, I'd like to be able to include the following in the text file output:

    1.) Include seconds in the text file output
    2.) Include units of measure, so that the text file would read, "{Alterable Value C} minutes {Alterable Value B} seconds"

    Is there a way I can do that?



    RGBreality

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Convert Value > String ???
    By Akuma in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 20th June 2016, 11:40 AM
  2. Convert standard date into numerical form
    By oasuke in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 9th November 2012, 03:49 PM
  3. [bug] Date&time object doesn't show date
    By qenio in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 19th March 2012, 09:49 PM
  4. Convert picture to string
    By YAS in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 24th September 2006, 05:19 PM
  5. Date & Time in a Text String
    By Morthian in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 8th September 2006, 03:06 AM

Posting Permissions

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