Results 1 to 2 of 2

Thread: Needing help with Powerminer:

  1. #1
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    175
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default Inventory problem :

    hai guys,

    my problem is that if the power miner still mines after the inventory is full.

    and that it doesn't drop ores at all.

    Code:
    function DropOres: Boolean;
    begin
      if InvFull then
      begin
        Writeln('Inventory is full!');
        if Players[CurrentPlayer].Booleans[0] then
          DropAll
        else
          DropAllExcept([1]);
      end;
      Result := True;
      Inc(Loads);
    end;
    Code:
    function MineRockType: Boolean;
    var
      PlayerRock: TRock;
      T: Integer;
    begin
    
      PlayerRock := GetRockType;
    
      x := MSCX;
      y := MSCY;
    
      SetAngle(True);
      repeat
        Amount := InvCount;
        if FindColorSpiralTolerance(x, y, PlayerRock.Color, MSX1, MSY1, MSX2, MSY2, 5) then
        begin
          MMouse(x, y, 2, 2);
          if WaitUptext(PlayerRock.Uptext, 200) then
          begin
            Writeln('Found ' +PlayerRock.Name+ ' rock!');
            GetMousePos(x, y);
            Wait(500 + Random(150));
            Mouse(x, y, 0, 0, True);
            MarkTime(T);
            while (TimeFromMark(T) < 3000 + Random(500)) do
            begin
              Wait(500);
              if ((InvCount <> Amount) or (InvFull)) then
                Break;
            end;
            if InvCount <> Amount then
            begin
              AntiBan;
              Writeln('Mined a ' +PlayerRock.Name+ ' ore(maybe a gem)!');
              Inc(Ore);
              Result := True;
            end else
            begin
              Writeln('We did not mine a ' +PlayerRock.Name+ ' ore or gem.');
              Writeln('Inventory could be full!');
              Result := True;
              Exit;
            end;
          end else
          begin
            Writeln('Did not found uptext of the: ' +PlayerRock.Name+ ' rock.');
            LogOut;
            TerminateScript;
          end;
        end else
        begin
          Writeln('Did not found: ' +PlayerRock.Name+ ' rock.');
          LogOut;
          TerminateScript;
        end;
      until(InvFull) or (Result);
    end;
    any help?
    Last edited by Yush Dragon; 07-28-2010 at 11:52 AM.

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function DropOres: Boolean;
    begin
      if (InvFull) then
      begin
        Writeln('Inventory is full!');
        DropAllExcept([Integer(Players[CurrentPlayer].Booleans[0])]); // That SHOULD work.
      end;
      Result := True;
      Inc(Loads);
    end;

    function ClickRock: Boolean;
    var
      X, Y: Integer;
    begin
      Result := False;
      X := MSCX; Y := MSCY;
      if (FindColorSpiralTolerance(X, Y, PlayerRock.Color, MSX1, MSY1, MSX2, MSY2, 5)) then
      begin
        MMouse(X, Y, 5, 5);
        if (WaitUptext(PlayerRock.Uptext, 200)) then
        begin
          Writeln(TheTime + ': Found ' + PlayerRock.Name + ' rock!');
          GetMousePos(X, Y);
          Mouse(X, Y, 0, 0, True);
          Result := True;
        end;
      end;
    end;

    function MineRockType: Boolean;
    var
      PlayerRock: TRock;
      T: Integer;
    begin
      Result := False;
      if (LoggedIn) or (InvFull) then exit;
      PlayerRock := GetRockType;
      // SetAngle(True); // Should only need this once, at startup?
      repeat
        Amount := InvCount;
        if (ClickRock) then
        begin
          MarkTime(T);
          while ((TimeFromMark(T) < 3000 + Random(500)) and (not Result)) do
          begin
            Wait(100 + Random(400));
            Result := (InvCount <> Amount);
          end;
          if (Result) then
          begin
            AntiBan;
            Writeln('Mined a ' +PlayerRock.Name+ ' ore(maybe a gem)!');
            Inc(Ore);
            DropOres;
          end else
          begin
            Writeln('We did not mine a ' + PlayerRock.Name + ' ore or gem.');
            Writeln('Inventory could be full!');
            Result := True;
            Exit;
          end;
        end else
        begin
          Writeln('Did not found: ' +PlayerRock.Name+ ' rock.');
          LogOut;
          TerminateScript;
        end;
      until(InvFull) or (Result);
    end;

    ^This should work, I can't compile it as I don't have the record ect.
    I often find it helpful to split large procedures into much smaller ones that each preforms their subroutines instead of having a single massive procedure/function.

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
  •