Page 1 of 2 12 LastLast
Results 1 to 25 of 36

Thread: Drop Function

  1. #1
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Drop Function

    I have loaded in a bitmap of a regular log, and I need a function that can drop all your logs once your full.

    SCAR Code:
    Procedure DropLogs;
     var
     x, y: integer;
      Begin
       Repeat
       if (Invfull) then
        FindBitmapToleranceIn(RegLogs, x, y, 560, 214, 734, 457, 20);
        wait(100);
       Until(False);
      end;

    Things I should add?

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

    Default

    SCAR Code:
    function DropLogs: Byte;
    var
      X, Y, I: Integer;

    begin
      if not LoggedIn or NoGameTab then exit;
      for I := 1 to 28 do
        if ExistsItem(I) then
        begin
          MMouseItem(I);
          Wait(150 + random(175));
          if Pos('log', RS_GetUpText) <> 0 then
          begin
            GetMousePos(X, Y);
            Mouse(X, Y, 0, 0, False);
            Wait(40 + random(45));
            if ChooseOption('rop') then Inc(result);
          end;
        end;
    end;


    Returns the amount of logs dropped.
    You welcome.

  3. #3
    Join Date
    Nov 2007
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    SCAR Code:
    for I := 1 to 28 do

    Make sure to have it check if 27 or 28 because if the person is wielding an axe or not.

  4. #4
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm the script you gave me moves the mouse over each inventory spot, then skips to the next one and keeps going with the script it never drops them.

  5. #5
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function DropLogs: Byte;
    var
      X, Y, I: Integer;
     
    begin
      if not LoggedIn or NoGameTab then exit;
      for I := 1 to 28 do
        if ExistsItem(I) then
        begin
          MMouseItem(I);
          Wait(150 + random(175));
          if Pos('Log', RS_GetUpText) <> 0 then
          begin
            GetMousePos(X, Y);
            Mouse(X, Y, 0, 0, False);
            Wait(40 + random(45));
            if ChooseOption('rop') then Inc(result);
          end;
        end;
    end;
    Try that or if that still doesnt work, where it says
    SCAR Code:
    Pos..blah blah
    change "Log" to "og"...

  6. #6
    Join Date
    Apr 2007
    Posts
    994
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    How about this?

    SCAR Code:
    function dropthelogs:integer;
    var
      x,y,logdtm:integer;
     
    begin
      logdtm:= := DTMFromString('78DA637CC7C4C0D0C2C8800C6AE22D19B8803' +
           '448F43F10303E02AAA942550391859140FA05504D2F0135F730ED' +
           'C250F307A8A695809A8F40355D04D47C01AA2925A0E635504D050' +
           '1353F08FB1D00E7A2122F');
      result:=CountItemsDtm('inventory',logdtm);
      while finddtm(logdtm,x,y,mix1,miy1,mix2,miy2) do
      begin
        mouse(x,y,4,4,false);
        if not(chooseoption('rop')) then
          break;
      end;
    end;
    [QUOTE]<GoF`> oh no its Raymooond
    <Raymooond> Heya
    <GoF`> is it ray or some other ray?
    <LeeLokHin> No idea
    <LeeLokHin> Raymond, what's the game you like the most?
    <Raymooond> Runescape
    <-- LeeLokHin has kicked Raymooond from #srl (Faker.)[/QUOTE]

  7. #7
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesome it works! Thanks a lot! If i have any other questions ill edit this post.

  8. #8
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Which one is it?

  9. #9
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by itschris917 View Post
    Which one is it?

    Yours lol. I like how it works. The bitmap one would probably work just as good though


    Ahh I feel reeeeally amatuer having to post do this so many times but i have one more thing before my script is complete.
    I have a fletching option with my Bitmaps already pre loaded in the script, this is all i have so far but I need it to choose the knife, then the logs in my 4th inv slot, then drop down to the bottom left corner and choose the "Fletch into Arrow Shafts" option, and from there select "Fletch X" and then use a TypeSend ('28'); and wait ~36-37 seconds to have it fletch them all.

    This is what i have so far...
    SCAR Code:
    Procedure FletchLogs;
    var
    x, y, q, r: Integer;
     Begin
      If (Fletch = True) then
       Begin
        If (InvFull) then
         Begin
          Repeat
          FindBitmapToleranceIn(Knife, x, y, 560, 214, 734, 457, 20);
          MMouse(x, y, 0, 0);
          Wait(100+random(15));
          ClickMouse(x, y, True);
          Wait(100+random(15));
          FindBitmapToleranceIn(RegLogs, q, r, 560, 214, 734, 457, 20);
          MMouse(q, r, 0, 0);
          Wait(100+random(15));
          ClickMouse(q, r, True);
          Until(False);
         end;
       end;
     end;

  10. #10
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is this what you are asking for? If you don't understand any of it, i will be happy to go over it in great detail with you.
    SCAR Code:
    procedure FletchLogs;
    var
      x, y, rx, ry: Integer;
      i: Integer;
    begin
      if Fletch and InvFull then
      begin
        repeat
          if FindBitmapToleranceIn(Knife, x, y, MIX1, MIY1, MIX2, MIY2, 20) then
          begin
            if IsUpText('nife') then
              Mouse(x, y, 3, 3, True);
            Wait(100+Random(150));
            if FindBitmapToleranceIn(Reglogs, rx, ry, MIX1, MIY1, MIX2, MIY2, 20) then
              Mouse(rx, ry, 3, 3, True);
              for i := 0 to 1000 do
              begin
                Wait(50+Random(15));
                if FindNPCChatText('hafts', ClickLeft) then Break;
              end;
            ChooseOption('ake X');//is there a make all option for fletching?
          end;
          Wait(33 * 1000 + Random(10 * 1000));
        until(not FindBitmapToleranceIn(RegLogs, rx, ry, MIX1, MIY1, MIX2, MIY2, 20));
      end;
    end;

  11. #11
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea, most of that looks right. One part im having trouble understanding is the For i:= 0 to 1000 do, and beyond that. Also the Fletch and InvFull don't need to be together. I have a Constant called Fletch that, when set to true, will run this procedure after getting a full inventory. So idk if that does the same thing as If Fletch = True then begin if (invfull) then.

    I'll list steps so its easier to understand.

    1. Find the Knife Bitmap and move the mouse to it, then click it so that it is highlighted in your Inventory.

    2. After highlighting the knife, move the mouse to the Log (Or any log doesn't matter which one it chooses) and click it.

    3. After it clicks the log, in the chat window at the bottom of the RS screen, a few choices should appear like, "Fletch into arrow shafts", "Fletch into ShortBow", "Fletch into LongBow", and one more about a crossbow or something.

    4. I want it to select the option farthest to the left, which is the "Fletch into Arrow Shafts", but I want it to right click it so that the little menu comes down with the options of "Fletch 1", "Fletch 5", "Fletch 10" , "Fletch X".

    5. Have it choose "Fletch X" and then the window will change into just a "*" so you can type the number of logs to fletch into arrow shafts. Then just have it choose any number over 28 through 99.

    6. After it starts that have it wait about 36 to 37 seconds so that the player can fletch all of the logs into shafts, and then go back to cutting the trees, and repeat the procedure.


    I hope that is specific enough . Im still a beginner with writing script and stuff so I am having trouble with some of the more advanced features. But things like this help me learn a lot and I love to go in and take notes on the tutorials I read. So thank you very much for this its teaching me a lot and I hope that I can release some good scripts in the future

  12. #12
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by furuchan64 View Post
    Yea, most of that looks right. One part im having trouble understanding is the For i:= 0 to 1000 do, and beyond that.

    I'll list steps so its easier to understand.

    1. Find the Knife Bitmap and move the mouse to it, then click it so that it is highlighted in your Inventory.

    2. After highlighting the knife, move the mouse to the Log (Or any log doesn't matter which one it chooses) and click it.

    3. After it clicks the log, in the chat window at the bottom of the RS screen, a few choices should appear like, "Fletch into arrow shafts", "Fletch into ShortBow", "Fletch into LongBow", and one more about a crossbow or something.

    4. I want it to select the option farthest to the left, which is the "Fletch into Arrow Shafts", but I want it to right click it so that the little menu comes down with the options of "Fletch 1", "Fletch 5", "Fletch 10" , "Fletch X".

    5. Have it choose "Fletch X" and then the window will change into just a "*" so you can type the number of logs to fletch into arrow shafts. Then just have it choose any number over 28 through 99.

    6. After it starts that have it wait about 36 to 37 seconds so that the player can fletch all of the logs into shafts, and then go back to cutting the trees, and repeat the procedure.


    I hope that is specific enough . Im still a beginner with writing script and stuff so I am having trouble with some of the more advanced features. But things like this help me learn a lot and I love to go in and take notes on the tutorials I read. So thank you very much for this its teaching me a lot and I hope that I can release some good scripts in the future
    That is absolutely correct! Good job. The
    SCAR Code:
    for i := 0 to 1000 do
    begin
      Wait(50+Random(15));
      if FindNPCChatText('hafts', ClickLeft) then Break;
    end;
    means that it is going to repeat the loop of waiting for 50 msec (+ random 15 msec) and if it finds the text 'hafts'(the text in the lower left hand corner of chatbox) then it will simply break out of the loop.
    For to do loops can be very helpful and are a great failsaife. If it doesn't find the text on the first try, it will loop over again, all the way until i = 1000! I hope that makes it pretty clear...
    If not read THIS or THIS



    The code below means that it will hit the "Fletch X" option and wait for the "enter amount" screen to appear then enter 28.. It will wait for a total of 33 seconds plus a random of 10 seconds.. And finally, the most important piece of code... the until.. This means that it will repeat(look at top of the procedure if you don't know what im talking about) this entire function until SCAR doesn't find the RegLogs bitmap.
    SCAR Code:
    ChooseOption('etch X');//is there a make all option for fletching?
    Wait(1000 + Random(100);
    TypeSend('28');
    Wait(33 * 1000 + Random(10 * 1000));
    until(not FindBitmapToleranceIn(RegLogs, rx, ry, MIX1, MIY1, MIX2, MIY2, 20));


    Hope that helps! Don't be afraid to ask more questions!

  13. #13
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you so much for that! I might even print that out to help me in the future No, there is no Fletch all unfortunately, other wise that would definately be the one to use lol

    EDIT: So I ran what i have and it is all working hunky dory except for the fletching part...

    SCAR Code:
    procedure FletchLogs;
    var
      x, y, rx, ry: Integer;
      i: Integer;
    begin
      if Fletch and InvFull then
      begin
        repeat
          if FindBitmapToleranceIn(Knife, x, y, MIX1, MIY1, MIX2, MIY2, 20) then
          begin
            if IsUpText('nife') then
              Mouse(x, y, 3, 3, True);
            Wait(100+Random(150));
            if FindBitmapToleranceIn(Reglogs, rx, ry, MIX1, MIY1, MIX2, MIY2, 20) then
              Mouse(rx, ry, 3, 3, True);
              for i := 0 to 1000 do
              begin
                Wait(50+Random(15));
                if FindNPCChatText('hafts', ClickLeft) then Break;
              end;
            ChooseOption('ake X');//is there a make all option for fletching?
          end;
          Wait(33 * 1000 + Random(10 * 1000));
        until(not FindBitmapToleranceIn(RegLogs, rx, ry, MIX1, MIY1, MIX2, MIY2, 20));
      end;
    end;

    If you had my brain i know helping me would be so much easier!

    It doesn't start the fletching procedure after getting a full inventory it will just stop for a while, as if reading the script, then attempt to cut another tree. Then do the same thing.

    I changed This:
    SCAR Code:
    procedure FletchLogs;
    var
      x, y, rx, ry: Integer;
      i: Integer;
    begin
      if Fletch and InvFull then

    To this:
    SCAR Code:
    procedure FletchLogs;
    var
      x, y, rx, ry: Integer;
      i: Integer;
    begin
      if (Fletch = True) then
     Begin
      if (InvFull) then
      begin

    Because that helped make my dropping procedure work, but it still did the same thing.

    When i read through what you have this is what catches my eye:
    SCAR Code:
    begin
            if IsUpText('nife') then
              Mouse(x, y, 3, 3, True);

    It seems as if the Mouse(x, y, 3, 3, True); should be placed BEFORE the conditional statement because if the mouse isn't over the Knife yet SCAR can't tell if the UpText at the top has the letters "nife" for Knife in them. I think that is why it doesn't continue with the rest of the procedure. I'm going to try and play with it a little and if I get it to work then Horay if not, Im gonna need your help again >.<"


    EDIT: So i tried a few things and the most logical thing that i thought of to do is just put a MMouse in before the conditional like this:

    SCAR Code:
    begin
            MMouse(x, y, 3, 3);
            if IsUpText('nife') then
            Mouse(x, y, 3, 3, True);
            Wait(100+Random(150));

    Buuuut it didn't work. Maybe you can figure it out.

  14. #14
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah that would be useful.. I know there is a cook all, but i guess no fletch all. Oh well. Your welcome and have fun scripting!

  15. #15
    Join Date
    Jun 2008
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by furuchan64 View Post
    Hmm the script you gave me moves the mouse over each inventory spot, then skips to the next one and keeps going with the script it never drops them.
    Then you may have the colors wrong

  16. #16
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Shit.. Yeah there definitely should be a MMouse in there before that. I totally spaced out there.. You put a MMouse in but it still didnt work? And WonderBeaner, stop spamming or i will report you.

  17. #17
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright, yes it didn't play even after adding in the MMouse. Idky it seems like its not able to find the bitmap, so what i did instead and made the procedure more like the dropping procedure and did this...

    SCAR Code:
    procedure FletchLogs;
    var
      X, Y, RX, RY, I: Integer;
    Begin
    If (Fletch = True) then
     Begin
     If (InvFull) then
      Begin
      if not LoggedIn or NoGameTab then exit;
      for I := 1 to 2 do
        if ExistsItem(I) then
        begin
          MMouseItem(I);
          Wait(150 + random(175));
          if Pos('nife', RS_GetUpText) <> 0 then
          begin
            GetMousePos(X, Y);
            Mouse(X, Y, 0, 0, True);
            Wait(40 + random(45));
            for I := 1 to 4 do
             if ExistsItem(I) then
              begin
               MMouseItem(I);
               Wait(150 + random(175));
               if Pos('Log', RS_GetUpText) <> 0 then
                Begin
                 GetMousePos(RX, RY);
                 Mouse(RX, RY, 0, 0, True);
                 wait(200+random(150));
                 if FindNPCChatText('hafts', ClickRight) then Break;
                wait(180+random(60));
               ChooseOption('ake X');
               wait(1400+random(300));
               TypeSend('28'+chr(13));
               wait(33 * 1000 + random(2 * 1000));
               until(
                end;
               end;
              end;
            end;
          end;
         end;
        end;

    What this does, is it will go through the first 4 inventory slots and find the knife and then again and find the logs and click each then it will move down to the NPC chat window and right click make shafts... BUT after it right clicks it goes down to about 5 but then quickly stops right in the middle of what its doing and then starts trying to cut a tree again. Maybe you can edit this up a bit so it fully right clicks and then chooses Make X and then types 28 and clicks enter, then waits until the logs are done being fletched...

  18. #18
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    the problem is this:
    SCAR Code:
    for I := 1 to 4 do

    It should be something like this:
    SCAR Code:
    for i := 1 to InvCount do

  19. #19
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright so i added that in, but it didn't change anything the script still does the same thing as before. This is what i have...

    SCAR Code:
    procedure FletchLogs;
    var
      X, Y, RX, RY, I: Integer;
    Begin
    If (Fletch = True) then
     Begin
     If (InvFull) then
      Begin
      if not LoggedIn or NoGameTab then exit;
      for I := 1 to 2 do
        if ExistsItem(I) then
        begin
          MMouseItem(I);
          Wait(150 + random(175));
          if Pos('nife', RS_GetUpText) <> 0 then
          begin
            GetMousePos(X, Y);
            Mouse(X, Y, 0, 0, True);
            Wait(40 + random(45));
            for i := 1 to InvCount do
             if ExistsItem(I) then
              begin
               MMouseItem(I);
               Wait(150 + random(175));
               if Pos('Log', RS_GetUpText) <> 0 then
                Begin
                 GetMousePos(RX, RY);
                 Mouse(RX, RY, 0, 0, True);
                 wait(200+random(150));
                 if FindNPCChatText('hafts', ClickRight) then Break;
                wait(180+random(60));
               ChooseOption('ake X');
               wait(1400+random(300));
               TypeSend('28'+chr(13));
               wait(33 * 1000 + random(2 * 1000));
                end;
               end;
              end;
            end;
          end;
        end;
      end;

  20. #20
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hang on, so the problem exactly is that it doesn't choose the option "Make X"?

  21. #21
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea so it will go through and do all of the clicking, but it moves the mouse down likes its going to click the Make X but its goes down about to Make 5 and then stops and just starts trying to cut trees again. So what I was thinking was when you tell it to find the NPCchat of "hafts" and then "Break" (Im not exactly sure how the Break works) but I think that it has something to do with it. I could be very wrong also because i don't exactly know what Break is.

  22. #22
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You want to get rid of the break now cause you aren't using the failsafe way of checking if the option is there or not. I'll break it down for you.

    Break - Breaks out of a loop, but DOES NOT EXIT THE PROCEDURE. That's the key, the fact that it doesnt exit the procedure. So here's a little example.

    SCAR Code:
    for i := 0 to 100 do
    begin
      Wait(100);
      if FindColorSpiralTolerance(x, y, Color, MSX1, MSY1, MSX2, MSY2, 10) then Break;
    end;

    So, how to interpret this code..
    The first line will tell the script to do everything located in the "begin and end" portion directly beneath it 100 times. The reason why is because at the very first part, we set i := 0. Secondly, we put the number that we want to go till.

    The findcolor line is the condition, simply stating that if said condition is met, then we will Break out of the loop.


    So remove the "Break" and you should be fine.. Let me know if you didnt understand the above explanation and i will put more effort into sounding clearer next time.

  23. #23
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright I got it to work thank you!

  24. #24
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No problem.

  25. #25
    Join Date
    Mar 2007
    Location
    Eugene, Oregon
    Posts
    195
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright new question now that I have my fletching all finished up. And this should be my finishing touch for my script

    I need help working the FindEnt function. Am i using the FindEnt correctly?

    SCAR Code:
    Procedure FindTrees;
    var
     x, y: integer;

    Begin
      If not LoggedIn then Exit;
      Case Random(2) of
        0: Begin
             If(FindColorTolerance(x, y, TreeColorOne, 0, 0, 700, 500, ColTolerance)) Then
             Begin
               FoundTree:= True;
               Mouse(x, y, 0, 0, true);    
               wait(100);
               FindEnt(x, y, True):True;
               Wait(WaitTime);
               Loads:=Loads+1;
             end else
               FoundTree:= False;
           end;
      1:Begin
          If(FindColorTolerance(x, y, TreeColorTwo, 0, 0, 700, 500, ColTolerance)) Then
          Begin
            FoundTree:= True;
            Mouse(x, y, 0, 0, true);
            wait(100);
            FindEnt(x, y, True):True;
            Wait(WaitTime);
            Loads:=Loads+1;
          end else
            FoundTree:= False;
        end;

       2:Begin
           If(FindColorTolerance(x, y, TreeColorThree, 0, 0, 700, 500, ColTolerance)) Then
           Begin
            FoundTree:= True;
            Mouse(x, y, 0, 0, true);
            wait(100);
            FindEnt(x, y, True):True;
            Wait(WaitTime);
            Loads:=Loads+1;
           end else
             FoundTree:= False;
        end;
      end;
    end;

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. What Do I Use For DROP Now???!!!
    By Ilikepie1995 in forum OSR Help
    Replies: 4
    Last Post: 09-30-2007, 08:15 PM
  2. Drop ore only
    By rkroxpunk in forum OSR Help
    Replies: 7
    Last Post: 09-25-2007, 11:31 PM
  3. drop drop drop????
    By havoc928 in forum OSR Help
    Replies: 4
    Last Post: 08-21-2007, 03:29 AM

Posting Permissions

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