Results 1 to 15 of 15

Thread: function CutGem(Amount, GemType: String)

  1. #1
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default function CutGem(Amount, GemType: String)

    Just something I made up tonight:

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
      GemColor, GemTolerance: Integer;

    function LoadGemDDTM: Integer;

    var
      GemDDTM: TDTM;
      GemMain: TDTMPointDef;
      GemSubs: Array of TDTMPointDef;

    begin
      SetLength(GemSubs, 5);
     
      GemMain.x := 331;
      GemMain.y := 77;
      GemMain.AreaSize := 1;
      GemMain.AreaShape := 0;
      GemMain.Color := GemColor;
      GemMain.Tolerance := GemTolerance;
     
      GemSubs[0].x := 329;
      GemSubs[0].y := 68;
      GemSubs[0].AreaSize := 1;
      GemSubs[0].AreaShape := 0;
      GemSubs[0].Color := 65536;
      GemSubs[0].Tolerance := 0;
     
      GemSubs[1].x := 338;
      GemSubs[1].y := 76;
      GemSubs[1].AreaSize := 1;
      GemSubs[1].AreaShape := 0;
      GemSubs[1].Color := 65536;
      GemSubs[1].Tolerance := 0;
     
      GemSubs[2].x := 335;
      GemSubs[2].y := 89;
      GemSubs[2].AreaSize := 1;
      GemSubs[2].AreaShape := 0;
      GemSubs[2].Color := 65536;
      GemSubs[2].Tolerance := 0;
     
      GemSubs[3].x := 323;
      GemSubs[3].y := 88;
      GemSubs[3].AreaSize := 1;
      GemSubs[3].AreaShape := 0;
      GemSubs[3].Color := 65536;
      GemSubs[3].Tolerance := 0;
     
      GemSubs[4].x := 319;
      GemSubs[4].y := 78;
      GemSubs[4].AreaSize := 1;
      GemSubs[4].AreaShape := 0;
      GemSubs[4].Color := 65536;
      GemSubs[4].Tolerance := 0;
     
      GemDDTM.MainPoint := GemMain;
      GemDDTM.SubPoints := GemSubs;
      Result := AddDTM(GemDDTM);
    end;

    function CutGem(Amount, GemType: String; MaxTime: Integer): Boolean;

    var
      GemDTM, GemDTM2, i, x, y, Cx, Cy, Waiting, Waiting2, Chisel: Integer;
      Forced, Typing: Boolean;
      GemText: Array of String;
      GemCol: Array of Integer;

    begin
      GemTolerance := 50;
      Forced := False;
      Typing := False;

      case LowerCase(GemType) of
        'any', 'all': begin
                        GemColor := 0;
                        GemTolerance := 255;
                      end;
        's', 'sapphire': GemColor := 7212812;
        'e', 'emerald': GemColor := 944396;
        'r', 'ruby': GemColor := 726649;
        'd', 'diamond': GemColor := 11316660;
      end;

      GemDTM := LoadGemDDTM;
      Chisel := DTMFromString('78DA63CC66626078CE8002ACD419184480342' +
           '310FF0702C642A09A1B0C6880118904D2C54035F708A8C902AAF9' +
           '40404D0A50CD7B026AD2806A5EE357030003840C79');
     
      While FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2) do
      begin
        if not LoggedIn then Break;
        if Typing then Break;
        if not FindDTM(Chisel, Cx, Cy, MIX1, MIY1, MIX2, MIY2) then
          Break;
        MMouse(Cx, Cy, 5, 5);
        Wait(200 + Random(100));
        GetMousePos(Cx, Cy);
        if IsUpText('hisel') then
          Mouse(Cx, Cy, 0, 0, True)
        else Writeln('no uptext');
        Wait(250 + Random(250));
        if not FindColorSpiral(Cx, Cy, 16777215, Cx - 30, Cy - 30, Cx + 30, Cy + 30) then
          Break;            //Just a check that we clicked it succesfully.
        Mouse(x, y, 5, 5, True)

        GemTolerance := 20;
        GemText := ['app', 'mer', 'uby', 'iam'];
        GemCol := [8065038, 944396, 726649, 11316660]
       
        for i := 0 to 3 do
          if IsUpText(GemText[i]) then
          begin
            GemColor := GemCol[i];
            Break;
          end;

        if Forced then
          FreeDTM(GemDTM2);

        GemDTM2 := LoadGemDDTM;
        Forced := True;
       
        Wait(500 + Random(500));

        if GetColor(36, 373) = 9343516 then //Do we have more than 1 gem.
        begin
          Mouse(256, 411, 10, 10, False) //Co-ords of middle of invent screen
          Wait(500 + Random(500));
         
          case LowerCase(Amount) of
            'all': begin
                     ChooseOption('All');
                     Typing := False;
                   end;
            else
                 begin
                   Typing := True;
                   ChooseOption('X');
                   Wait(500 + Random(500));
                   TypeSend(Amount);
                 end;
          end;

          MarkTime(Waiting);
          MarkTime(Waiting2);
          while TimeFromMark(Waiting2) < MaxTime do
          begin
            Wait(250 + Random(250));
            if not FindDTM(GemDTM2, x, y, MIX1, MIY1, MIX2, MIY2) then
              Break;
            if TimeFromMark(Waiting) > 10000 + Random(5000) then
            begin
              MMouse(RandomRange(0, 700), RandomRange(0, 500), 25, 25);
              MarkTime(Waiting);
            end;
            ClickContinue(True, True);
          end;
          Wait(250 + Random(250));
        end else
          Wait(750 + Random(500));
      end;

      if not Typing then
        Result := not FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2)
      else
        Result := True;
       
      if Forced then
        FreeDTM(GemDTM2);
      FreeDTM(GemDTM);
      FreeDTM(Chisel);
    end;
               
    begin
      SetupSRL;
      CutGem('1', 'sapphire', 15000);
      CutGem('all', 'all', 15000);
    end.

    Works pretty good, please test, and post results/feedback

  2. #2
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Why do you click the chisel twice?


  3. #3
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    You mean this part?

    SCAR Code:
    While FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2) do
      begin
        if not LoggedIn then Break;
        if not FindDTM(Chisel, Cx, Cy, MIX1, MIY1, MIX2, MIY2) then
          Exit;
        Mouse(Cx, Cy, 5, 5, True);
        if not FindColorSpiral(Cx, Cy, 16777215, Cx - 30, Cy - 30, Cx + 30, Cy + 30) then
          Exit;            //Just a check that we clicked it succesfully.
        if IsUpText('hisel') then
          Mouse(x, y, 5, 5, True)
        else Break;

    I dont, lol. Cx, Cy and x, y.

  4. #4
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by The Claw View Post
    You mean this part?

    SCAR Code:
    While FindDTM(GemDTM, x, y, MIX1, MIY1, MIX2, MIY2) do
      begin
        if not LoggedIn then Break;
        if not FindDTM(Chisel, Cx, Cy, MIX1, MIY1, MIX2, MIY2) then
          Exit;
        Mouse(Cx, Cy, 5, 5, True);
        if not FindColorSpiral(Cx, Cy, 16777215, Cx - 30, Cy - 30, Cx + 30, Cy + 30) then
          Exit;            //Just a check that we clicked it succesfully.
        if IsUpText('hisel') then
          Mouse(x, y, 5, 5, True)
        else Break;

    I dont, lol. Cx, Cy and x, y.
    Add a wait after the Mouse(Cx, Cy);



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  5. #5
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Good timing!
    Oh and add "GameTab(4);"


    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  6. #6
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    0mg JuKKa... Add a time marker and tell how fast it did them xD

  7. #7
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    0mg JuKKa... Add a time marker and tell how fast it did them xD
    Would have to switch all all my gems to my old main x_X

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  8. #8
    Join Date
    May 2006
    Location
    Helsinki, Finland (capital)
    Posts
    269
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sounds like cool, could someone cut my gems after few weeks? Already got like ~300 gems.

  9. #9
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i will do it for you i can use the crafting

    Nice job

  10. #10
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    why the DDTM?, could you make it do a for i:=0 to 6 do and then make it look for each gem, that way it will do all of them automatically?
    The truth finally came out...


  11. #11
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    Quote Originally Posted by mat_de_b View Post
    why the DDTM?, could you make it do a for i:=0 to 6 do and then make it look for each gem, that way it will do all of them automatically?
    CutGem('all', 'all') already does them all automatically

  12. #12
    Join Date
    Oct 2006
    Location
    C:\Program Files\SCAR 2.03
    Posts
    1,194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Jeeze Claw... That was a suggestion for an MSI function You really are a Dev aren't you... lol.

    Good job though, and instead of having

    SCAR Code:
    if IsUpText('app') then
          GemColor := 8065038
        else
        if IsUpText('mer') then
          GemColor := 944396
        else
        if IsUpText('uby') then
          GemColor := 726649
        else
        if IsUpText('iam') then
          GemColor := 11316660;

    would it be better to just have

    SCAR Code:
    GemText:= ['app','mer','uby','iam'];
        GemCol:= [8065038, 944396, 726649, 11316660];
        for i:= 0 to 3 do
        if(IsUpText(GemText[i]))then
        begin
          GemColor:= GemCol[i];
          Break;
        end;

    Its up to you but its a suggestion.
    [FONT="Garamond"][SIZE="3"]
    Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.
    [/SIZE][/FONT][URL="http://www.villavu.com/forum/forumdisplay.php?f=125"][IMG]http://i40.tinypic.com/r1lzdv.jpg[/IMG][/URL]

  13. #13
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    yup good idea, i'll put that in

    Jeeze Claw... That was a suggestion for an MSI function You really are a Dev aren't you... lol.
    Whats that meant to mean? you guys feel free to make your own, i only made this cause fawki wanted one made. not trying to steal your ideas or anything, lol

  14. #14
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    OK Updated, lots better and works near perfect i think

  15. #15
    Join Date
    Oct 2006
    Location
    C:\Program Files\SCAR 2.03
    Posts
    1,194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice double post Also, I was just saying that you make a lot of useful stuff like a "Dev" should.

    And the only reason I said it was from MSI is because I was hoping we'd get something in the MSI Functions / Scripts section. Thats all.
    [FONT="Garamond"][SIZE="3"]
    Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.
    [/SIZE][/FONT][URL="http://www.villavu.com/forum/forumdisplay.php?f=125"][IMG]http://i40.tinypic.com/r1lzdv.jpg[/IMG][/URL]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 03-30-2008, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •