I know this is a bit messed up (the code), but, I'm baffled why it isn't working. I know I'm not great at delphi, and I'd really like some help.

var
  Form1: TForm1;
  SteamString : String;
  CommunityString : String;
  ZeroOrOne : String;
  SteamId : String;
  CommunityStringMath : Longint;
  Calc : Integer;
  Number : Longint;

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
begin
SteamString := EditSteam.Text;
ZeroOrOne := Copy(SteamString,3,1);
SteamId := Copy(SteamString,5,9);
Calc := (StrToInt(SteamId))*2;
Number := 76561197960265728;
CommunityStringMath := ((StrToInt(ZeroOrOne)) + (Calc));

CommunityString := (IntToStr(CommunityStringMath+Number));
Label1.Caption := CommunityString;
end;

end.

When SteamString is 0:1:148547, the CommunityString just ends up as double 148547+1. The code never seems to add the 'Number' to it like I want. I thought maybe it was because integers couldn't handle this big number so I made them long ints and still no luck!

Please help. Probably something stupid.

~Sparkles

This works in Delphi 5 on XP, so it should work for you:

var
  SteamString : String;
  CommunityString : String;
  ZeroOrOne : String;
  SteamId : String;
  CommunityStringMath : Int64;
  Calc : Integer;
  Number : Int64;
begin
  SteamString := EditSteam.Text;
  ZeroOrOne := Copy(SteamString,3,1);
  SteamId := Copy(SteamString,5,9);
  Calc := (StrToInt(SteamId))*2;
  Number := 76561197960265728;
  CommunityStringMath := ((StrToInt(ZeroOrOne)) + (Calc));

  CommunityString := (IntToStr(CommunityStringMath+Number));
  Label1.Caption := CommunityString;
end;

The most important thing, to my mind in Protaeas's answer is using Int64. You MUST look at the limits of each numeric type. Even LongInt only goes to 10 digits and your Number is 17 digits.
I think you should follow that Delphi Help study route on Integer types and mark this as answered/solved.

commented: Good point which I failed to mention. +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.