Results 1 to 5 of 5

Thread: Help for a coal miner

  1. #1
    Join Date
    May 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help for a coal miner

    I have made a coal miner that i want to repeat the mining process until the inventory is full but it only mines one ore then starts clicking randomly on the rest of the screen. I am new to scripting and when i am mining i get attacked so i don't know if that has something to do with it or what.


    Function GetOre:Boolean;
    var
    x, y, PlusOne, OreCounter:Integer;
    Begin
    PlusOne:= InvCount + 1;
    x:=MSCX;
    y:=MSCY;
    If FindColorSpiral(x, y, oalColor, MSX1, MSY1, MSX2, MSY2) Then
    Begin
    Writeln('found one');

    Case Random(2) Of
    0: Mouse(x, y, 5, 5, True);
    1: Begin
    Mouse(x, y, 5, 5, False);
    WaitOption('ine', 500);
    End;
    End;

    Flag;
    Repeat
    MarkTime(OreCounter);
    Antiban;
    Wait(1000);
    If InvCount=Plusone Then
    Writeln('got one');
    Until (Invcount=plusone) or (TimeFromMark(OreCounter) > 10000)
    end;
    end;


    That is my code i am using and then i have the GetOre function on a repeat in the final part of the script. If anyone knows why it will only mine once then start randomly clicking that would be great!

  2. #2
    Join Date
    Jul 2010
    Location
    Western US
    Posts
    387
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    could you post your entire script? It may help to determine the issue point. I dont think the issue is in what you posted (could use some cleaning up though such as non static wait times, and failsafes). I am wondering what your antiban is doing, or if you are not entering your repeat until loop.
    Of all the things I have lost, I miss my mind the most.
    Current Projects:
    Addy bar miner and superheater

  3. #3
    Join Date
    May 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I took out the Antiban and it was working a little better but it still misclicked sometimes and then it would just stand until i manuallly clicked a new rock. I have only worked on the mining part so far so here is the full part of my script.

    ************************************************** ********************************

    {$i SRL\SRL.simba}
    Procedure DeclarePlayers;
    begin
    HowManyPlayers := 1;
    NumberOfPlayers(HowManyPlayers);
    CurrentPlayer := 0;
    with Players[0] do
    begin
    Name := ''; // Character Name
    Pass := ''; // Character Pass
    Pin := ''; // Character Pin
    Nick := ''; // Character Nickname
    Active := True; // Use player in script?
    end;
    end;
    var
    Coal:Integer;

    ------------------------------------------------------------------------------------------------------------------------
    function oalColor: Integer;
    var
    arP: TPointArray;
    arC: TIntegerArray;
    tmpCTS, i, arL: Integer;
    begin
    tmpCTS := GetColorToleranceSpeed;
    ColorToleranceSpeed(2);
    SetColorSpeed2Modifiers(16.67, 3.45);
    if not (FindColorsTolerance(arP, 921359, MSX1, MSY1, MSX2, MSY2, 1)) then
    begin
    Writeln('Failed to find the color, no result.');
    ColorToleranceSpeed(tmpCTS);
    SetColorSpeed2Modifiers(0.2, 0.2);
    Exit;
    end;
    arC := GetColors(arP);
    ClearSameIntegers(arC);
    arL := High(arC);
    for i := 0 to arL do
    begin
    Result := arC[i];
    //Writeln('AutoColor = ' + IntToStr(arC[i]));
    Break;
    end;
    ColorToleranceSpeed(tmpCTS);
    SetColorSpeed2Modifiers(0.2, 0.2);
    if (i = arL + 1) then
    Writeln('AutoColor failed in finding the color.');
    end;
    ------------------------------------------------------------------------------------------------------------------------
    Function GetOre:Boolean;
    var
    x, y, PlusOne, OreCounter:Integer;
    Begin
    PlusOne:= InvCount + 1;
    x:=MSCX;
    y:=MSCY;
    If FindColorSpiral(x, y, oalColor, MSX1, MSY1, MSX2, MSY2) Then
    Begin
    Writeln('found one');
    Mouse(x, y, 5, 5, True);

    Flag;
    Repeat
    MarkTime(OreCounter);
    Wait(1000);
    If InvCount=Plusone Then
    Writeln('got one');
    Until (Invcount=plusone) or (TimeFromMark(OreCounter) > 10000)
    end;
    end;
    ------------------------------------------------------------------------------------------------------------------------
    begin
    SetupSRL;
    Repeat
    GetOre;
    Until (InvFull)
    end.
    ************************************************** ********************************


    If there is a better way to find the rocks I am open to any suggestions.

  4. #4
    Join Date
    May 2012
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Write a "IsMining" function that you can check whether you are animating or not by using PixelShift then do something like
    Simba Code:
    if IsMining then
      wait(50)
    else
      GetOre;

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

    Default

    Thanks I have it working better now!

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
  •