playMaker

Author Topic: Convert seconds to string (INT)  (Read 1685 times)

andyandyandy

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Convert seconds to string (INT)
« on: April 25, 2021, 04:20:19 PM »
I know there's a float convert seconds to string but is there one for int convert second to string?

In my game theres researches that can take over 100 days to complete, using float, 60 value = 1 minute, 3600= 1hour, 86,400= 1day (per seconds.) Since float cannot exceed over 10million, I would prefer to use INT to calculate time.

Is there a action where I can use INT instead of float to convert second to string?

Plancksize

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 75
Re: Convert seconds to string (INT)
« Reply #1 on: April 25, 2021, 05:47:06 PM »
...
 Since float cannot exceed over 10million, I would prefer to use INT to calculate time.
...

Float can exceed 10 million by quite a bit.
The max float value in c# is 3.402823e+38

If your issue is with the string coming out with exponential (the e+ at the end) add something like F9 in the "float to string" Format field. That should give you up to something like 300 years in seconds without the exponential.

PS: Well, disregard the above. Apparently Playmaker adds the exponential after the 7th digit and doing a debug value it actually stops receiving the actual value. Just adds 0's to it after the exponential. That's an annoying limitation indeed.

PS2: Reading a bit more about this and I realize how much Ive forgotten about all this stuff. That limitation is not from Playmaker or Unity, but from the variable type itself. Your problem could be solved with a variable of type "Double" but Playmaker doesn't seem to support those at the moment.

The good news is, if you still want to use an Int, you have Convert Int to String in the default Playmaker's actions (under Convert category).
There's other ways you can achieve that without the Int limitations too, i.e: use different variables for second, minutes, hours, etc, that increment themselves (at 60sec add 1 to minute and resets to 0, etc).

« Last Edit: April 25, 2021, 06:55:07 PM by Plancksize »