Results 1 to 3 of 3

Thread: Integer vs double

  1. #1
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default Integer vs double

    I have a great Report procedure, where I report time running, xp made and xp/hour.
    But some times it gets stupid and start giving wrong xp/h calcs.
    For example.


    I mark the time StartTime at start.
    Simba Code:
    procedure ReportOnSmart;
    var
      text1, text2, text3 : String;
      boxBMP, TimeRun : Integer;
      XP, XPHour : Extended;
    begin
      TimeRun:=TimeFromMark(StartTime);
      XP := (GetXPBarTotal-StartXP)*3/4;
      XPHour := XP * (3600000/TimeRun);
      text1 := 'Time running: '+MsToTime(TimeRun,Time_Formal);
      text2 := 'XP/H: '+FloatToStr(XPHour);
      text3 := 'XP: '+FloatToStr(XP);
      boxBMP := BitmapFromString(308, 64, 'meJztwjENAAAMAyD/biqqfy1Mw34I6aKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqur/AVZcclA=');
      SMART_DrawBitmap(true, boxBMP,Point(4,274));
      SMART_DrawTextEx(false,10,275,SmallChars,text1,clBlue);
      SMART_DrawTextEx(false,10,295,SmallChars,text2,clBlue);
      SMART_DrawTextEx(false,10,315,SmallChars,text3,clBlue);
      FreeBitmap(boxBMp);
      //Writeln('['+MsToTime(TimeFromMark(starttime),Time_Bare)+'] XP: '+IntToStr(XP)+'   XP/H: '+IntToStr(XPHour));
      Disguise('['+Players[CurrentPlayer].Nick+'] XP/H: '+FloatToStr(XPHour));
    end;

    EDIT: Ok problem is not with types, so title is bad for this. HELP pls!

    Last edited by Shatterhand; 02-16-2012 at 08:20 PM.

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    An integer is a number with nothing behind the "point", for example: 1542 or -12534. A double has two decimals, for example 1,23 or 2444645,12. An extended has a lot behind the point.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Problem solved close topic please.
    Last edited by Shatterhand; 02-16-2012 at 08:38 PM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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