Source language: Translate to:

Parsing a number

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Parsing a number

Postby stevec » Wed Jun 23, 2010 7:16 pm

I have the time in seconds;

for example 274.61 sec

I have the number divided by 60 for minutes, the result is 4.58

The .58 needs to be converted to 32 for the sec.

How dod you parse teh variable 4.58 into 4 and 58 and then
convert the 58.

Then I could place the two variables togather and come up with the
4 min 32 sec.


Current commands;

Math "[MediaPlayer1]/1000" "2" "[MediaPlayer2]"

Math "([MediaPlayer2]/60)*.6" "2" "[MediaPlayer3]"
Ideas

Thanks;
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

I HOPE HELP YOU

Postby virger » Wed Jun 23, 2010 9:23 pm

Try this:

.. trunc(x) is the greatest integer less than or equal to x.
setvar "[data]" "274.61"

..133 min, 59.59 sec == 8039.59
setvar "[data]" "8039.59"


.1) way
math "trunc([data]/60)" "" "[min]"
math "trunc([data]-([min]*60))" "" "[sec]"

.2) way
math "[data]/60" "2" "[res]"
strparse "[res]" "." "[ms]" "[dummy]"
setvar "[min]" "[ms1]"
math "[ms2]*.60" "" "[sec]"

PURA VIDA
FROM COSTA RICA
AMERICA CENTRAL
User avatar
virger
 
Posts: 504
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby stevec » Fri Jun 25, 2010 2:36 pm

Thanks will try it.
Sorry for the delay in seeing the post.
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron