Results 1 to 5 of 5

Thread: Help with the order of procedures please.

  1. #1
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with the order of procedures please.

    Hi. Can someone give me a hand pls? I need to use the procedure Flax; in every other procedure, but it is also links to those procedures. If I put the procedure flax before all others, then there is an Unknown Identifier error, as the procedure hasn't read the procedures it is linked into. And vica versa. Please look.


    Try to compile
    Quote Originally Posted by The Un-Named View Post
    You can do this a few times before mods catch on...

    "oh fuck, I think the icecream truck just knocked a kid over, brb".

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Add forward; after you declare Flax before all of the procedures and you should be able to call it in all of those procedures and also have code for it after them.
    :-)

  3. #3
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Soz, i don't understand. Where do I put forward;??

    Ok.. Is this what you meant???


    Code:
    program Flax;
    {.include SRL/SRL/Misc/SMART.scar}
    {.include SRL/SRL.scar}
    
    var
      x, y, tries1, tries2: Integer;
      point1: TPoint;
    
    const
      WorldNumber = 111;
    
    procedure Setup;
    begin
      SmartSetupEx(WorldNumber, True, True, False);
      SetTargetDC(SMARTGetDC);
      SetupSRL;
    end;
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name := 'hairyduncan'; //username
      Players[0].Pass := ''; //password
      Players[0].Nick := 'ydun'; //3-4 letters from your username
      Players[0].Loc := 'Bank';
      Players[0].Active := True;
      
      if not LoggedIn then LoginPlayer;
    end;
    
    procedure Flax; forward;
    begin
      if Players[CurrentPlayer].Loc = 'Flax' then PickFlax;
      if Players[CurrentPlayer].Loc = 'Bank' then BankToFlax;
      if Players[CurrentPlayer].Loc = 'Path' then LocationToBank;
      if Players[CurrentPlayer].Loc = 'Flax' and InvFull then FlaxToBank;
    end;
    
    procedure FindFlax;
    begin
      if FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
        begin
          Mouse(x, y, 2, 2, true);
          FFlag(10);
          Writeln('Now at flax.');
          Players[CurrentPlayer].Loc := 'Flax';
          Flax;
        end;
    end;
    
    procedure BankToFlax;
    begin
      if FindSymbolIn(x, y, 'tree', 568, 79, 708, 155) then
      begin
        Mouse(x, y, 2, 2, true);
        Writeln('Walking to flax.');
        Players[CurrentPlayer].Loc := 'Path';
        FFlag(10);
        Mouse(605, 152, 3, 3, true);
        FFlag(10);
        Mouse(667, 136, 3, 3, true);
        FFlag(10);
        Flax;
      end;
    end;
    
    procedure GetLocation;
    begin
      if FindSymbol(x, y, 'bank') then
      begin
        Mouse(x, y, 2, 2, true);
        Players[CurrentPlayer].Loc := 'Bank';
        FFlag(10);
      end;
      if FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
      begin
        Mouse(x, y, 2, 2, true);
        Players[CurrentPlayer].Loc := 'Flax';
        FFlag(10);
      end;
      if FindSymbol(x, y, 'tree') then
        begin
          if not FindSymbol(x, y, 'bank') then
          begin
            if not FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
            begin
              Players[CurrentPlayer].Loc := 'Path';
            end;
          end;
        end;
    end;
    
    procedure RClick;
    begin
      Mouse(x, y, 2, 2, false);
      ChooseOption('ick');
    end;
    
    procedure LClick;
    begin
      Mouse(x, y, 2, 2, true);
    end;
    
    procedure PickFlax;
    begin
      FindObjCustom(x, y, ['la', 'ax'], [14999694, 14736509, 15065748, 15460528, 14934156, 941067], 5);
      case random(2) of
        0: RClick;
        1: LClick;
      end;
      Wait(250 + random(750));
      Flax;
    end;
    
    procedure LocationToBank;
    begin
      FindSymbolIn(x, y, 'tree', 615, 16, 669, 114);
      Mouse(x, y, 2, 2, true);
      FFlag(10);
      Mouse(657, 27, 2, 2, true);
      FFlag(10);
      FindSymbol(x, y, 'bank');
      FFlag(15);
      Players[CurrentPlayer].Loc := 'Bank';
      Flax;
    end;
    
    begin
      Setup;
      DeclarePlayers;
      if not LoggedIn then LoginPlayer;
      MakeCompass('N');
      GetLocation;
      Flax;
    end.
    Any solutions anybodyy?
    Last edited by Hobbit; 04-12-2009 at 07:31 PM.
    Quote Originally Posted by The Un-Named View Post
    You can do this a few times before mods catch on...

    "oh fuck, I think the icecream truck just knocked a kid over, brb".

  4. #4
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    SCAR Code:
    program Flax;
    {.include SRL/SRL/Misc/SMART.scar}
    {.include SRL/SRL.scar}

    var
      x, y, tries1, tries2: Integer;
      point1: TPoint;

    const
      WorldNumber = 111;

    procedure Setup;
    begin
      SmartSetupEx(WorldNumber, True, True, False);
      SetTargetDC(SMARTGetDC);
      SetupSRL;
    end;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := 'hairyduncan'; //username
      Players[0].Pass := ''; //password
      Players[0].Nick := 'ydun'; //3-4 letters from your username
      Players[0].Loc := 'Bank';
      Players[0].Active := True;

      if not LoggedIn then LoginPlayer;
    end;

    procedure Flax; forward;

    procedure FindFlax;
    begin
      if FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
        begin
          Mouse(x, y, 2, 2, true);
          FFlag(10);
          Writeln('Now at flax.');
          Players[CurrentPlayer].Loc := 'Flax';
          Flax;
        end;
    end;

    procedure BankToFlax;
    begin
      if FindSymbolIn(x, y, 'tree', 568, 79, 708, 155) then
      begin
        Mouse(x, y, 2, 2, true);
        Writeln('Walking to flax.');
        Players[CurrentPlayer].Loc := 'Path';
        FFlag(10);
        Mouse(605, 152, 3, 3, true);
        FFlag(10);
        Mouse(667, 136, 3, 3, true);
        FFlag(10);
        Flax;
      end;
    end;

    procedure GetLocation;
    begin
      if FindSymbol(x, y, 'bank') then
      begin
        Mouse(x, y, 2, 2, true);
        Players[CurrentPlayer].Loc := 'Bank';
        FFlag(10);
      end;
      if FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
      begin
        Mouse(x, y, 2, 2, true);
        Players[CurrentPlayer].Loc := 'Flax';
        FFlag(10);
      end;
      if FindSymbol(x, y, 'tree') then
        begin
          if not FindSymbol(x, y, 'bank') then
          begin
            if not FindColorSpiral(x, y, 12149870, MMX1, MMY1, MMX2, MMY2) then
            begin
              Players[CurrentPlayer].Loc := 'Path';
            end;
          end;
        end;
    end;

    procedure RClick;
    begin
      Mouse(x, y, 2, 2, false);
      ChooseOption('ick');
    end;

    procedure LClick;
    begin
      Mouse(x, y, 2, 2, true);
    end;

    procedure PickFlax;
    begin
      FindObjCustom(x, y, ['la', 'ax'], [14999694, 14736509, 15065748, 15460528, 14934156, 941067], 5);
      case random(2) of
        0: RClick;
        1: LClick;
      end;
      Wait(250 + random(750));
      Flax;
    end;

    procedure LocationToBank;
    begin
      FindSymbolIn(x, y, 'tree', 615, 16, 669, 114);
      Mouse(x, y, 2, 2, true);
      FFlag(10);
      Mouse(657, 27, 2, 2, true);
      FFlag(10);
      FindSymbol(x, y, 'bank');
      FFlag(15);
      Players[CurrentPlayer].Loc := 'Bank';
      Flax;
    end;

    procedure Flax;
    begin
      if Players[CurrentPlayer].Loc = 'Flax' then PickFlax;
      if Players[CurrentPlayer].Loc = 'Bank' then BankToFlax;
      if Players[CurrentPlayer].Loc = 'Path' then LocationToBank;
      if (Players[CurrentPlayer].Loc = 'Flax') and InvFull then FlaxToBank;
    end;

    begin
      Setup;exit;
      DeclarePlayers;
      if not LoggedIn then LoginPlayer;
      MakeCompass('N');
      GetLocation;
      Flax;
    end.

    SCAR Code:
    procedure Flax; forward;
    is how you declare a forward.

  5. #5
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow thanks a lot.
    Quote Originally Posted by The Un-Named View Post
    You can do this a few times before mods catch on...

    "oh fuck, I think the icecream truck just knocked a kid over, brb".

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
  •