Results 1 to 4 of 4

Thread: Odd problems

  1. #1
    Join Date
    Jul 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Odd problems

    Well i'm working on a power chopper lately and Its gotten a lot better. I have 2 main problems.
    1. It keeps selecting the tree closest to the top left corner and keeps moving large distances.
    2. Ever since about 15 minutes ago after it chops one tree it randomly stops doing anything. I really want to fix this before anything else cause I can't use the script at all :P

    Any help would be appriciated

    SCAR Code:
    program Chopper;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include srl/srl.scar}
    //Just fill in your username,pass,nick and run,make sure you have an axe out and are near trees
    //only drops inv slots 6-28
    // and if u can't read whats before these comments it uses SMART  O.o
    var
    clicks:integer;

    procedure Login;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := 'username';
      Players[0].Pass := 'password';
       Players[0].Nick := 'nick';
      Players[0].Active := True;
    end;



    procedure progressreport;
    begin
       Writeln('[]========================================[]');
        Writeln('---------------->Power chopper<----------------');
        Writeln('  Chopped ' + IntToStr(Clicks) + ' trees' + '        ');
        Writeln('[]========================================[]');
         Wait (1000)
    end;

    procedure randomlog;
    begin
    if (clicks) = 40 then
    logout;
    wait(60000 + random (120000));
    login;
    loginplayer
    end;

    procedure Chop;
    var
      x, y : integer;
    Begin
       If (LoggedIn) then
    begin
      if FindObjTPA(x,y,1583156,20,-1,7,7,15,['ree']) = true then
      begin
      repeat
        Wait(2000 + Random(425));
       Mouse(x,y,0,0,false);
        Wait(200 + Random(225));
       chooseoption('hop');
       wait(400+ random (152));
    until (FindBlackChatMessage('You swing your axe at the tree')) or (FindBlackChatMessage('You get some logs'))
     Clicks := Clicks + 1;
       If not (LoggedIn) then
       exit;
      end;
    end;

    end;
    Procedure drop;

    var
    i: Integer;
    Begin
    If (LoggedIn) then
    begin
    Gametab(4);
     For i := 6 to 28 do

      If ExistsItem(i) then
       DropItem(i);
    If not (loggedin) then
    exit;
      end;
    end;





    Procedure Mainloop;
     begin
      smartSetup('mn3', False, True);
    While Not (SmartReady) Do
    Wait(100);
    SetTargetDC(SmartGetDC);
    If Not (LoggedIn) Then
    While Not (SmartGetColor(386, 249) = 65535) Do
    Wait(100);
    SetupSRL;
      Login;
      ActivateClient;
      LoginPlayer
      If (InvFull) Then
      drop;
       Repeat
      Chop;
      Progressreport;
       If (InvFull) Then
      drop;
      randomlog;
      Until(false)
    end;

    begin
    Mainloop;
    end.
    *Note that this is my first script thats been edited a few times so its nothing great :P

  2. #2
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    FindObjTPA uses a Spiral search (searches from the middle outwards) so it should find the tree closest to the middle. You can try lowering the last few values (7, 7, 15) and see if that helps it find more central trees.
    About the second problem, try commenting out the call to RandomLog in the main loop as I have a suspicion that may be causing the problem.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

  3. #3
    Join Date
    Jul 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for helping cause random log was interfering with it running. Is there any way I could incorporate it so that it doesn't affect my script? Its not needed but would be nice to have :P Also changing the values isn't helping finding the trees from the middle. At least now I can have the bot run.

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    procedure RandomLog;
    begin
      if (clicks mod 40 = 0) then
      begin
        Logout;
        Wait(60000 + random (120000));
        LoginPlayer
      end;
    end;
    The main problem was you didn't have the begin..end; after the if, so it would always run the Wait(), Login and LoginPlayer. I also added clicks mod 40 = 0, which means that if clicks divided by 40 returns a remainder of 0 then run the if otherwise it would only run it after 40 clicks and not 80, 120 etc. It would also be a good idea for you to look through tutorials about standards as it makes it much easier to read through and help as well as for you to debug it and see silly errors.
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SQL Problems. Please help!
    By Da 0wner in forum Web Development
    Replies: 10
    Last Post: 01-22-2009, 02:03 AM
  2. Computer problems... Terrible computer problems...
    By Jason2gs in forum News and General
    Replies: 22
    Last Post: 04-26-2007, 12:02 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
  •