Results 1 to 5 of 5

Thread: Multiplying Integers

  1. #1
    Join Date
    May 2009
    Posts
    54
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Multiplying Integers

    I am currently making a Progress Report for my future Willow Cutter.

    I do not know how to multiply them properly though.

    My Script:

    Code:
    Program PracticeWoodcuttingScript;
    {.include SRL/SRL.Scar}
    
    Var
      TotalProggies : Integer;
      TreeCut : Integer;
    
    Procedure ProgressReport;
    Begin
      WriteLn('|==================================================|');
      WriteLn('|               Willow Cutter Report               |');
      WriteLn('|==================================================|');
      WriteLn(' Time Running: ' + TimeRunning );
      WriteLn(' Willows Cut: ' + IntToStr(TreeCut));
      WriteLn(' Exp Gained: ' + (IntToStr(TreeCut) * 90));
      WriteLn('|==================================================|');
      WriteLn('|               Created By: Devoker.               |');
      WriteLn('|==================================================|');
    End;
    
    Begin
      ProgressReport;
    End.
    My Problem:

    Code:
    Line 15: [Error] (16773:50): Type mismatch in script
    As you can see, I am trying to multiply, 'TreesCut', buy 90. Simple as that.
    Last edited by Devoker; 05-28-2009 at 01:43 PM.

  2. #2
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program PracticeWoodcuttingScript;
    {.include SRL/SRL.Scar}

    var
      TotalProggies : Integer;
      TreeCut : Integer;

    procedure ProgressReport;
    begin
      WriteLn('|==================================================|');
      WriteLn('|               Willow Cutter Report               |');
      WriteLn('|==================================================|');
      WriteLn(' Time Running: ' + TimeRunning );
      WriteLn(' Willows Cut: ' + IntToStr(TreeCut));
      WriteLn(' Exp Gained: ' + (IntToStr(TreeCut * 90));
      WriteLn('|==================================================|');
      WriteLn('|               Created By: Devoker.               |');
      WriteLn('|==================================================|');
    end;

    begin
      ProgressReport;
    end.
    since that is an integer you must put it inside the IntToStr function.

    Edit: Pwned Mormonman and Senrath .

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    WriteLn(' Exp Gained: ' + (IntToStr(TreeCut) * 90));
    should be
    WriteLn(' Exp Gained: ' + (IntToStr(TreeCut * 90));

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Replace this:
    SCAR Code:
    WriteLn(' Exp Gained: ' + (IntToStr(TreeCut) * 90));
    With this:
    SCAR Code:
    WriteLn(' Exp Gained: ' + (IntToStr(TreeCut * 90)));

    Edit: Dang, double ninja'd.

  5. #5
    Join Date
    May 2009
    Posts
    54
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesome. Thanks all three of you. It works perfectly.

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
  •