Results 1 to 10 of 10

Thread: Script help please

  1. #1
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default Script help please

    Ok here is my script, It compiles fine and logs in but it sets the angle and chats then logs out.

    SCAR Code:
    {==============================================================================]
    [                        [SRL]4                                                ]
    [                                                                              ]
    [                                                                              ]
    [             NAME        : Destiful Woodcutter                                                   ]
    [             WRITER      : The Man                                                   ]
    [             CATEGORY    : Woodcutting                                                   ]
    [             DESCRIPTION :                                                    ]
    [                                                                              ]
    [==============================================================================]
    [ Instructions: Please check the forums for details.                           ]
    [==============================================================================}


    {=========================Records & Vars DONT TOUCH!===========================}
    program simplecutter;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include SRL/SRL.scar}

    const
      Rockcolour = 379494;
      StartPlayer = 0;



    var
    x, y, RockDTM, LevelUps:integer;




    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1; // Set Number of Players here.
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := StartPlayer;
      Players[0].Name := ''; //username
      Players[0].Pass := ''; //password
      Players[0].Nick := 'rumb'; //3-4 consecutive letters of your user
      Players[0].Strings[0] := 'willow'; // Tree to chop: willow.
      Players[0].Active := True; //use this player
    end;

    function LevelUp : Boolean;    //Thanks Wizzup?
    var
      Lev : Integer;
    begin
      Result := FindNPCChatText('gratu', Nothing) or
                FindNPCChatText('atio', Nothing);
      if Result then
      begin
        while ClickContinue(True, True) do
        Wait(500 + Random(250));
        WriteLn(Players[CurrentPlayer].Name + ' leveled up');
        Lev:= GetSkillInfo('woodcutting', False);
        WriteLn(Players[CurrentPlayer].Name + '''s woodcutting level is now ' + IntToStr(Lev));
        LevelUps:= LevelUps + 1;
      end;
    end;



    procedure AntiRandom;
    begin
      FindNormalRandoms;
    end;

    procedure Proggy;
    begin
      writeln('Auto cutter and banker');
      writeln('Ran For: '+TimeRunning+'!');
    end;

    Procedure Towillows;
    begin
      if (not(loggedin)) then exit;
       GameTab(4);
    RockDTM := DTMFromString('78DA633CCBC4C020CAC8800C224383C1344C9' +
           '4F11C508D30AA1A370F0354351730CDF10EB2C3344702558D4F98' +
           '09AA9AD340359268EEC95645557312A8461C558DB3AB0EAA9A534' +
           '03522A86A1C1CAC485603004BED0DB8');


      writeln('to willows');

      wait(100);
      if (not(loggedin)) then exit;
      SetRun(True);
     if (FindColorSpiralTolerance(x, y, Rockcolour, 5, 5, MMX2, MMY2, 5)) then
     Mouse(x, y, 5, 5, True);
      if FindDTM(RockDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
        begin
          Mouse(x, y, 0, 0, True);
        end;


      FindnormalRandoms;
      wait(100);
    end;




    function walktobank: Boolean;
    var
      I, R, G, B, Len, TestColor: Integer;
      H, S, L, X, Y, Z: Extended;
      P: TPointArray;

    begin
      Result := False;
      FFlag(0);
      FindColorsTolerance(P, 13135419, MMX1, MMY1, MMX2, MMY2, 60);
      Len := High(P);
      for I := 0 to Len do
        if RS_OnMinimap(P[I].X, P[I].Y) then
        begin
          TestColor := GetColor(P[I].X, P[I].Y);
          ColorToRGB(TestColor, R, G, B);
          if InRange(R - B, -161, -121) then
            if InRange(R - G, -71, -31) then
              if InRange(G - B, -110, -70) then
              begin
                ColorToHSL(TestColor, H, S, L);
                if InRange(Round(H - L), -5, 25) then
                  if InRange(Round(S - H), -19, 11) then
                    if InRange(Round(S - L), -10, 20) then
                    begin
                      ColorToXYZ(TestColor, X, Y, Z);
                      if InRange(Round(X - Y), -5, 9) then
                        if InRange(Round(Y - Z), -48, -34) then
                        begin
                          Mouse(P[I].X, P[I].Y, 6, 6, True);
                          Result := True;
                          Exit;
                        end;
                    end;
              end;
        end;
      WriteLn('Autocolor did not find the bank');
    end;

    Procedure SetVar;
    Begin
      Players[CurrentPlayer].Strings[0] := Lowercase(Players[CurrentPlayer].Strings[0]);
    End;




    function Findwillow: Boolean;
    var
      Colors: TIntegerArray;
      X, Y, I, A, M, curCTS: Integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;

    begin
      Result := False;
      if (not(LoggedIn)) then exit;
      curCTS := GetColorToleranceSpeed;
      Colors := [7919760, 8446096];
      for I := 0 to 1 do
      begin
        ColorToleranceSpeed(3);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, Colors[I], MSX1, MSY1, MSX2, MSY2, 5);
        if Length(TPA) = 0 then Continue;
        ColorToleranceSpeed(1);
        ATPA := TPAtoATPAEx(TPA, 10, 10);
        M := High(ATPA);
        for A := 0 to M do
          if MiddleTPAEx(ATPA[A], X, Y) then
          begin
            MMouse(X, Y, 6, 6);
            Wait(100 + Random(50));
            if Pos('Willow', RS_GetUpText) > 0 then
            begin
              GetMousePos(X, Y);
              Mouse(X, Y, 0, 0, True);
              Result := True;
              ColorToleranceSpeed(curCTS);
              Exit;
            end;
          end;
      end;
      ColorToleranceSpeed(curCTS);
    end;

    procedure Responder;
    var
      HiChats, NoobChats, AutoChats, HiChatR, NoobChatR, AutoChatR, UpChats,
      UpChatR, LevelChats, YesChats : TStringArray;
      I, RL, R : Integer;

    begin
      if (not(LoggedIn)) then
      begin
       Players[CurrentPlayer].Active:= False;
        Exit;
      end;
      HiChats:= ['hi', 'yo', 'sup', 'ello', 'wassup', 'll right', 'hey', 'hai'];
      HiChatR:= ['hi', 'hello there', 'sup', 'yo', 'hello', 'hey', 'howdy', 'hai'];
      NoobChats:= ['noob', 'froob', 'neeb', 'choob', 'loser', 'you are a'];
      NoobChatR:= ['u are', 'you r', 'u r', 'i aint', 'how am i??', 'looked in the mirror lately?'];
      AutoChats:= ['autoer', 'bot', 'auto', 'cheater', 'autoing', 'cheat'];
      AutoChatR:= ['no im not', 'im not a bot', 'i dont cheat!', 'me?!', 'r u serious?!', 'bots can talk??'];
      UpChats:= ['gratz', 'well done', 'congratulations', 'grats', 'congratz'];
      UpChatR:= ['thanks', 'ty', 'thank you', 'thx', 'thanx'];
      LevelChats:= ['wc lv', 'wcing lv', 'woodcutting lev', 'wc lev'];
      YesChats:= ['Yes', 'Ye', 'Yeah', 'Yea', 'Yup', 'Uh huh', 'Yep'];

      for I:= 0 to High(HiChats) do
      begin
        if InChat(HiChats[i]) then
        TypeSend(HiChatR[i]);
        R:= R + 1;
      end;
      for I:= 0 to High(NoobChats) do
      begin
        if InChat(NoobChats[i]) then
        TypeSend(NoobChatR[i]);
        R:= R + 1;
      end;
      for I:= 0 to High(AutoChats) do
      begin
        if InChat(AutoChats[i]) then
        TypeSend(AutoChatR[i]);
        R:= R + 1;
      end;
      if LevelUp then
      begin
        for I:= 0 to High(UpChats) do
        begin
          if InChat(UpChats[i]) then
          TypeSend(UpChatR[i]);
          R:= R + 1;
        end;
      end;
      for I:= 0 to High(LevelChats) do
      begin
        if InChat(LevelChats[i]) then
        begin
          R:= R + 1;
          RL:= GetSkillInfo('woodcutting', False);
          case Random(10) of
            0: TypeSend(IntToStr(RL));
            1: TypeSend('lvl '+IntToStr(RL));
            2: TypeSend(IntToStr(RL) + ' over here');
            3: TypeSend('level '+IntToStr(RL));
            4: TypeSend('I''m ' + IntToStr(RL) + ' smithin');
            5: TypeSend('only ' + IntToStr(RL));
            6: TypeSend('meh, only ' + IntToStr(RL));
            7: begin
                 case Random(5) of
                   0: TypeSend('onky ' + IntToStr(RL));
                   1: TypeSend('omly ' + IntToStr(RL));
                   2: TypeSend('inly ' + IntToStr(RL));
                   3: TypeSend('onlu ' + IntToStr(RL));
                   4: TypeSend('om;y ' + IntToStr(RL));
                 end;
                 case Random(5) of
                   0: TypeSend('only*');
                   1: TypeSend('*only');
                   2: TypeSend('Sorry, *only');
                   3: TypeSend('I meant "only"');
                   4: TypeSend('*only ' + IntToStr(RL));
                 end;
               end;
            8: case Random(3) of
                 0: TypeSend('My wcing is ' + IntToStr(RL));
                 1: TypeSend('My woodcutting is ' + IntToStr(RL) + '...8-)');
                 2: TypeSend('It''s ' + IntToStr(RL));
               end;
            9: begin
                 TypeSend('Me?');
                 Wait(2500 + Random(1500));
                 for I:= 0 to High(YesChats) do
                 if InChat(YesChats[i]) then
                 TypeSend(IntToStr(RL));
               end;
          end;
        end;
      end;
    end;

    Procedure isfull;
    Var
      Logs, X, Y, I : Integer;
      Box : TBox;
    Begin
      Logs := DTMFromString('78DA63DCC8C4C0F08A010D30229140FA2450C' +
           'D4D026AB601D5DC25A0E61450CD23026ACE01D5BC26A0663750CD' +
           '47FC6A00BF630A00');
      IncEx(Players[CurrentPlayer].Integers[2], CountItemsIn('inv', 'dtm', Logs, []));
      IncEx(ReportVars[1], CountItemsIn('inv', 'dtm', Logs, []));
      For I := 1 To 28 Do
      Begin
        Box := InvBox(I);
        If FindDTM(Logs, X, Y, Box.X1, Box.Y1, Box.X2, Box.Y2) Then
        Begin
          walktobank;
      End;
      End;
      FreeDTM(Logs);
      Players[CurrentPlayer].Loc := 'dropped logs';
    End;

    Procedure Depositwillows;
    var InvItems : boolean;
        I : integer;
    begin
      for I := 1 to 28 do
      if ExistsItem(i) then
      begin
        InvItems := true;
        break;
      end;
      if InvItems then
        MouseBox(381, 298,410, 318,1);
    end;

    procedure AntiBanage;
    begin
      case Random(10) of
        0:
          begin
            HoverSkill('mining', false);

          end;
        1:
          begin
            MakeCompass('random');

          end;
        2:
          begin
            Wait(1000 + Random(200));
          end;
        3:
          begin
            RandomMovement;

          end;
        4:
          begin
            RandomRClick;
          end;
        5:
          begin
            HoverSkill('random', false);

          end;
        6:
          begin
            GameTab(3);
          end;
      end;
    end;





    procedure setupScript;
    begin
      cleardebug;
      writeln('');
      writeln('');
      writeln('');
      writeln('');
      writeln('');
      writeln('');
      writeln('');
      writeln('');
      setupsrl;
      ScriptID := '1058';
      mousespeed := 13;    // to fast. 13 is better
      declareplayers;
      activateclient;
      wait(500);
    end;

    begin
      setupScript;
        SMARTSetupEx(29, False, True, False);
       SetTargetDC(SMARTGetDC);

      if (not (LoggedIn)) then
      begin
        Loginplayer;
        setangle(true);
        Wait(500 + random(30))
         SetChat('on', 1);
        SetChat('friends', 2);
        SetChat('off', 3);
      end;
      repeat

        if not (loggedIn) then
        begin
          nextplayer(false);
            LoginPlayer;
        end;
      //end;
        begin
          logout;
          if howManyPlayers = 1 then
            wait(random(600000));
           nextplayer(true);
          LoginPlayer;
        end;

        Towillows;
        Findwillow;
        isfull;
        walktobank;
        Depositwillows;
      until (false);
    end.

    Also someone said I need the Function FindTree:
    SCAR Code:
    Function FindTree(Var X, Y : Integer; Tree : String; Dist : Integer): Boolean;
    Var
      TPA : TPointArray;
      ATPA : T2DPointArray;
      I, Col, T : Integer;
      S : String;
    Begin
      Case Tree Of
        'willow': S := 'illow';
      End;
      Case S Of
        'illow': Col := 7512981;
      End;
      T := GetTickCount;
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, 20);
      ColorToleranceSpeed(1);
      ATPA := SplitTPA(TPA, 10);
      If S <> 'ree' Then
        SortATPASize(ATPA, True);
      If Length(ATPA) = 0 Then
        Exit;
      SortATPAfrom(ATPA, Point(MSCX, MSCY));
      Writeln('Found tree in: ' + IntToStr(GetTickCount - T) + ' ms');
      For I := 0 To High(ATPA) Do
      Begin
        If (Dist >= Distance(MSCX, MSCY, TPA[I].X, TPA[I].Y)) Or (Dist = 0) Then
        Begin
          MiddleTPAex(ATPA[I], X, Y);
          MMouse(X, Y, 5, 5);
          Wait(200 + Random(100));
          If IsUpText(S) Then
          Begin
            GetMousePos(X, Y);
            Result := True;
            Exit;
          End;
        End;
      End;
    End;
    But I have my Findwillow Procedure so do i still need FindTree?

    cheers

    T~M

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

    Default

    LOL, Fix'd remove the logout, in your loop.
    You login then directly start "sleeping".(Note: always!)
    ~Hermen

  3. #3
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    SCAR Code:
    begin
          logout;
          if howManyPlayers = 1 then
            wait(random(600000));
           nextplayer(true);
          LoginPlayer;
        end;

    It's that piece of code. It's going to be executed no matter what, once you get to it.

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

    Default

    Quote Originally Posted by Hermen View Post
    LOL, Fix'd remove the logout, in your loop.
    You login then directly start "sleeping".
    Quote Originally Posted by senrath View Post
    SCAR Code:
    begin
          logout;
          if howManyPlayers = 1 then
            wait(random(600000));
           nextplayer(true);
          LoginPlayer;
        end;

    It's that piece of code. It's going to be executed no matter what, once you get to it.
    Exactly what I said .
    ~Hermen

  5. #5
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    Exactly what I said .
    OK so i deleted that logout;
    but now it logs in and does nothing???

    T~M

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

    Default

    Look, you let it sleep always!
    Before you let it logout and sleep.
    Now you let it sleep always.

    You have to do it like this, you make 2 loops a main loop for the nextplayer stuff.
    Than a second loop which does the stuff in the main loop you add sleeping.

    Look,
    SCAR Code:
    begin
      SetUpClient;
      repeat
        SetupPlayer;
        repeat
          GlobalProgressReport;
          Walk(true);
          HandleAirAltar;
          Walk(true);
          Bank(true);
        until (Players[CurrentPlayer].integers[5] >= Players[CurrentPlayer].integers[1]) or (Not LoggedIn);
        LogOut;
        If Players[CurrentPlayer].integers[5] >= Players[CurrentPlayer].integers[1] Then NextPlayer(True) else NextPlayer(False);
      until AllPlayersFalse;
    end.
    Out of my newly made aircrafter

    Simple, readable, neat loop. IMO
    ~Hermen

  7. #7
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    Look, you let it sleep always!
    Before you let it logout and sleep.
    Now you let it sleep always.
    OH lol, so do i just delete that whole thing?

    T~M

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

    Default

    Rewrite your main loop.
    I am not going to code for you .
    You will have to do it yourself.
    ~Hermen

  9. #9
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Hermen View Post
    Rewrite your main loop.
    I am not going to code for you .
    You will have to do it yourself.
    ok thank you
    rep+

    T~M

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

    Default

    You can copy mine, IMO it's pretty solid loop.
    If you need any further help ask me on IRC or MSN: Hermen Otter @ Live . nl

    Any Mod || Admin, close this thread, please.
    ~Hermen

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
  •