Adblock breaks this site

Need help writing a script.

Discussion in 'Scar/Simba Help' started by Zeta, Aug 1, 2007.

  1. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    Question: It always clicks my lenderhosen hat instead of maple, sometimes click maple but only like half the time, how do I make it so it only goes to maples?

    Code:
    program ZetasMapleChop;
    
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Woodcutting.SCAR}
    
    const
      Maple = 19058; //the color of the maple
      Maple2 = 16760;
      Maple3 = 9548;
      Tol = 15;
      RunDirection = 'S'; //the direction to run if in fight
      LogsToChop = 50; //how many logs to chop)
    
    procedure DeclarePlayers;
    begin
    HowManyPlayers := 1; //Number of players to use
     NumberOfPlayers(HowManyPlayers); //Don't Touch
       CurrentPlayer := 0;  //Player to start with
       Players[0].Name := 'Username'; //Players username
         Players[0].Pass := 'Password'; //Players password
           Players[0].Nick := 'Nickname'; //3-4 characters from players username(Lowercase and no spaces)
             Players[0].Active := True;     //Are you using this player?
              end;
    
    
    procedure ChopMaples;
    var
    
      ChopMark: Integer;
    begin
      repeat
        if FindObjMulti('aple tree', Maple, Maple2, Maple3, Tol) then
        begin
          GetMousePos(X, Y);
          Wait(500 + Random(102));
          Mouse(X, Y, 1, 1, True);
           MarkTime(ChopMark);
          repeat
            Wait(500 + Random(250));
            FindNormalRandoms;
          until(TimeFromMark(ChopMark) >= (10000 + Random(5000)));
    
        end;
      until(False);
    end;
    
    
    begin
      ActivateClient;
      SetUpSRL;
      DeclarePlayers;
      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
      ChopMaples;
    end.
     
  2. Town

    Town Grand Master
    Scar Programmers

    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5
    Need help writing a script.

    if (FindColor(x, y, TreeColor, Ax, Ay, Bx, By)) then Mouse(x, y, 2, 2, true);

    Finds a the TreeColor in the box (Ax, Ay), (Bx, By) and saves the coordinates the color was at in x, y. Then, it left clicks on the coordinates (x, y) with a random of two so it could click on (x + 1, y - 1) or (x + 2, y + 2), etc.
     
  3. crossback7

    crossback7 Active Member

    Joined:
    Jun 12, 2007
    Posts:
    202
    Referrals:
    0
    Sythe Gold:
    0
    Need help writing a script.

    First thing I would put in would be your Constants. This could be how many loads you want to do and the such. Then I'd put in your DeclarePlayers procedure. You can just copy and paste that from someone else's script and edit it to your liking, as it most likely won't work if you just copy and paste it.

    PM me if you want more detailed help. . .Town's function should work well for you.
     
  4. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    this is it so far.. it chops willows in seers nothing else yet

    program New;
    {.include srl/srl.scar}


    begin
    SetUpSRL;
    repeat
    if FindColorTolerance(x, y, 7249851, MSX1, MSY1, MSX2, MSY2, 20) then;
    MMouse(x, y, 2, 2);
    Mouse(x, y, 2, 2, true);
    wait(10000+random(4001));
    until(false)
    end.
     
  5. Town

    Town Grand Master
    Scar Programmers

    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5
    Need help writing a script.

    Good start, FindNormalRandoms; you will need. Don't pt a semi-olon after "then". Mouse moves the mouse and clicks so you don't need MMouse before it.
     
  6. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    okay well em the color clicker sucks it always clicks on the ground or something instead of the tree, and when I try to use DTM(sp?) it'll just compile and sit there.. people say not to use bitmaps cause of all the memory so idk what to do.

    edit: i can put the FindNormalRandoms; anywhere? or do i need something else?
     
  7. Town

    Town Grand Master
    Scar Programmers

    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5
    Need help writing a script.

    You can use the function, IsUpText() to see whether or not the mouse is over a tree or not. Like I said, look at other scripts to see what they use.
     
  8. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    Okay, I was looking at a bad script and couldnt find isuptext but i found one that does and now i'm going to cut maples instead.. is this good?

    Code:
    program New;
    {.include srl/srl.scar}
    {.include SRL\SRL\Skill\Woodcutting.SCAR}
    
    const
    Maple = 19058;
    Tol = 20;
    RunDirection = 'W';
    LogsToChop = 50;
    
    
    begin
    SetUpSRL;
    repeat
    if FindColorTolerance(x, y, Maple, MSX1, MSY1, MSX2, MSY2, 20) then
    IsUpText('Maple Tree') then
    Mouse(x, y, 2, 2, true);
    wait(15032+random(4001));
    until(false)
    end.
     
  9. Town

    Town Grand Master
    Scar Programmers

    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5
    Need help writing a script.

    Better, yes. Now you can make it cut until the inventory is full, and then until the total logstochop is finished. I'll let you figure it out.
     
  10. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    okay well it was supposed to be if IsUpText('Maple tree') then but i fixed that but it just compiles and doesn't run?

    edit: sorry for so much noobiness
     
  11. Town

    Town Grand Master
    Scar Programmers

    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5
    Need help writing a script.

    In between FindColorTolerance and IsUpText you have to move the mouse over the tree.
     
  12. crossback7

    crossback7 Active Member

    Joined:
    Jun 12, 2007
    Posts:
    202
    Referrals:
    0
    Sythe Gold:
    0
    Need help writing a script.

    Yeah, that'd be where you would use MMouse. It probably be a good idea to make it wait about half a second before checking for the uptext after that too, just in case of lag or whatnot.

    AH, I just wanna fix your script and post what I can do on it. . .You need to learn this for yourself though.
     
  13. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    yeah my script sucks its so simple.. idk how to change it to make it better
     
  14. Zeta

    Zeta Guru
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0
    Need help writing a script.

    thanks to tim at srl its alot better now
     
< Duplicate identifier problem | Srl setup >


 
 
Adblock breaks this site