Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: westingtyler on December 07, 2020, 12:52:20 AM
-
I am wondering what the best way to do this is. Is there a simple action for this?
-
Hi.
If not every frame then probably best to make an array loop.
-
It depends, if you're doing it once or if you're updating the array on the fly but you would most certainly need to use Array Get Next that plugs into a small loop to do the addition based on the last float gotten from the array.
Maybe there's a custom action on the ecosystem that adds all values of an array if they're floats (there would be an Error: Event in case another type is found). I guess this and a similar one for ints could be practical after all.
-
is there a more efficient way then splitting the string by the :, then doing string to int, then adding up the seconds to 60 to get minutes?
-
If time values are given in the mm:ss format, then extracting the text's number before the : is the way to go unless someone wrote an action that specifically deconstructs string fields that specifically contain time indexes such as yours.
-
Any time i've needed to deal with time specifically i've made 3 ints, seconds, minutes, hours. once an int hit 60 it would add 1 to the next value (however in my game it represented a 9-5 job and things were sped up).
If what you want is to add values i only see the need to make an "int get difference" action, so when one of the ints hits 60, you add one to the next int and store the remainder as the current int.
ie X=60 (seconds), y=current time + z=added time, y+z=more than 60, store difference as a value. If this action spits out a value (on true?), then add 1 to the next value (minutes) but the addition would be a separate action.
The ":" is purely cosmetic.
This may be messy, inefficient or completely useless, but real time isn't measured in delta time and its the only way that made sense to me.
Perhaps even a portion of what i'm suggesting may lead you to a better solution.