Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: phannDOTde on November 14, 2015, 07:21:17 AM

Title: Format String Question
Post by: phannDOTde on November 14, 2015, 07:21:17 AM
Hey there,

I got a general "Format" String question. How can I archive a format like HH:MM to build a descent timedisplay? What I'm doing right now is I got following parts

String: DAY | INT: 1 (number of days) | INT: 1 (hours) | String: ":" | INT: 5 (minutes)

The result is  "DAY 1  1:5" but I would like to get it shown as "DAY 1  01:05"

any advice?

Best
Peter
Title: Re: Format String Question
Post by: memetic arts on November 15, 2015, 06:19:07 AM
If you're not going to leverage the built-in Get System Time action, then you'll probably have to use the Convert Int to String action and parse it all together as a string. And honestly, that might be easier to do in script.
Title: Re: Format String Question
Post by: djaydino on November 15, 2015, 05:37:18 PM
Hi,
if i understand you right,
then you can do "convert int to string" and set format "00" for the hours and do the same for minutes.
Then use "build string"
Set string parts to 6 then add to each part
part 1 "DAY " (with a space)
part 2 day value
part 3 another space
part 4 hour string
part 5 ":"
part 6 minutes string
Title: Re: Format String Question
Post by: jeanfabre on November 16, 2015, 07:50:57 AM
Hi,

 I would use timeSpan custom actions and string format. They are on the Ecosystem.

"GetTimeSpaneBetweenDates"
"GetTimeSpanInfo"

and so you simply keep track of a start date and time, a current date and time and the spn between the two to then get time spane info out of it.

 I use it for a timer app I created a while ago, it works well.

Bye,

 Jean
Title: Re: Format String Question
Post by: memetic arts on November 16, 2015, 11:38:39 AM
Ha, and I was just about to thank djaydino for the tip on the BuildString action, which looks super-useful -- didn't know that existed.  But these other actions look great too . . . thank you both!

Title: Re: Format String Question
Post by: phannDOTde on November 17, 2015, 03:59:03 AM
Hey thanks for your replies guys! :-)

@Jean - it's not to be used with real time/systemtime more of an ingame clock that can be accelerated while the player travels on a worldmap.

@djaydino Build string might work - gotta check this out - I thought there might be something simpler since I remember there are some definitions on formating strings (can't find the link to that atm) and {00:00} can work as a format definition if I only got one variable but it doesn't work in example with {0}{11:11} last I tried - maybe there is a limitation to the "Format String" Action there. Need to revisit that soon.

Greets
Peter
Title: Re: Format String Question
Post by: jeanfabre on November 17, 2015, 07:47:17 AM
Hi,

 however you want to control the start and end date in yourg ame will work with the solution of timeStamps. TimeStamps do not necessarly represent the current time, it can be anything.

Bye,

 Jean