TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

BatMUD played hours calculator

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
k00pa



Joined: 17 Dec 2008
Posts: 9

PostPosted: Sat Dec 11, 2010 11:52 am    Post subject: BatMUD played hours calculator Reply with quote

Just got this script finished Coffee It is for batmud and it converts play time of years/days/hours format to plain hours format that I like more.

Example output:
Code:
(Online for over 16497 hours)

From this line:
Code:
He was created Wed Jul 02 16:57:32 1997 and he is 1y, 331d, 9h, 38min and 9s old.


Biggest problem was that if player has less than year played, the 1y/2y part didn't show up at all.

Code:
Code:

#action {%0 was created %0 %0 %0 %0:%0:%0 %0 and he is %1d, %2h, %3min and %0s old.}{
        #regexp {%1}{^[^y]*$}{
                #math {played}{(%1 * 24) + %2};
                #showme {(<002>Online for $played hours<088>)};
        }{
                #var {count}{0};
                #parse {%1}{
                        #if {$count == 0}{
                                #var {years}{&0};
                        };

                        #if {$count == 6}{
                                #var {digits}{3};
                                #var {digit3}{&0};
                        };

                        #if {$count == 5}{
                                #var {digits}{2};
                                #var {digit2}{&0};
                        };

                        #if {$count == 4}{
                                #var {digits}{1};
                                #var {digit1}{&0};
                        };


                        #math {count}{$count + 1};
                };

                #math {played}{($years * 24 * 356) + %2};

                #if {$digits == 3}{
                        #math {played}{$played + ((($digit1 * 100) + ($digit2 * 10) + $digit3) * 24)};
                };

                #if {$digits == 2}{
                        #math {played}{$played + ((($digit2 * 10) + $digit1) * 24)};
                };

                #if {$digits == 1}{
                        #math {played}{$played + ($digit1 * 24)};
                };

                #showme {(<002>Online for over $played hours<088>)};
        };
}

_________________
___!!___
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group