Results 1 to 5 of 5

Thread: Is there a function That dives something and returns the remainder

  1. #1
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Is there a function That dives something and returns the remainder

    so I want my proggy to write first the hours, then min and then sec, but in order to do so, I need the script to know the remainders of the division. basicly title says it all.

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    5 Mod 2 = 1.

    It divides 5 by 2 and gets the remainder.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  3. #3
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    This is already a function-
    SCAR Code:
    function TimeRunning: string;
    var
      RHours, Minutes, Seconds, RMinutes, RSeconds: LongInt;
      Time: string;
    begin
      Seconds := (GetSystemTime - ST) div 1000;
      Minutes := Seconds div 60;
      RHours := Minutes div 60;
      Time := IntToStr(Seconds) + ' Seconds';
      if Minutes <> 0 then
      begin
        RSeconds := Seconds mod (Minutes * 60);
        Time := IntToStr(Minutes) + ' Minutes and ' + IntToStr(RSeconds) +
          ' Seconds';
      end;
      if RHours <> 0 then
      begin
        RMinutes := Minutes mod (RHours * 60);
        RSeconds := Seconds mod (Minutes * 60);
        Time := IntToStr(RHours) + ' Hours, ' + IntToStr(RMinutes) +
          ' Minutes and ' + IntToStr(RSeconds) + ' Seconds';
      end;
      Result := Time;
    end;

    So hopefully that tells you what you need to know.

    The ST or Start Time is from MarkTime(ST) and just holds the time the script started.
    So make sure you have SetUpSRL called for in your script to use this.

  4. #4
    Join Date
    Jul 2007
    Location
    Massachusetts
    Posts
    896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok thanks,do i have to stay st in script then?

  5. #5
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    All you need in your script is SetUpSRL.
    Then just put WriteLn(TimeRunning) where you want it.
    But what i was saying is without the setup it won't know the time the script started.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 10-12-2007, 01:40 AM
  2. Taxes and Returns: USA
    By SMI in forum News and General
    Replies: 3
    Last Post: 01-17-2007, 06:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •