Janilabo

Untitled

Apr 3rd, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 6.52 KB | None | 0 0
  1. //OSRS07 - Willow Cutter and banker v0.7
  2. //Amberleaf
  3. //Instructions & more scripts can be found at http://www.scar-divi.com
  4. //2/4/13
  5.  
  6. {$DEFINE RS07}                         // V - Bright Settings
  7. {$DEFINE SMART}                        // Comment out to use normal browser
  8. {$DEFINE OSI_RS07_Color_Anti_Randoms}
  9.  
  10. {$I OSI\OSI.scar}
  11. {$I MSSL\MSSL.scar}
  12.  
  13. const
  14.   USERNAME = 'username';
  15.   PASSWORD = 'password';
  16.   BANK_PIN = 'pin'; // Change if you use bank pin
  17.   CHOP_DELAY = 3000; // Minimum delay between chops.
  18.                      
  19. {$IFNDEF MSSL_1.04-1(+)}
  20.   begin                
  21.     ClearDebug;
  22.     WriteLn('MSSL is OUTDATED! Please update it with Includes Manager.');
  23.   end.
  24. {$ENDIF}
  25.  
  26. var
  27.   lastChop: Integer;
  28.   forceBanking: Boolean;
  29.  
  30. procedure DeclarePlayers;
  31. begin
  32.   RS07_SetActivePlayer(USERNAME, PASSWORD, '', MSSL_TCAToTIA(MSSL_StrToTCA(BANK_PIN)));
  33. end;
  34.  
  35. procedure ScriptTerminate;
  36. begin
  37.   MSSL_Unsetup;
  38.   FreeOSI;
  39. end;
  40.  
  41. function EvilTreeAt(x, y: Integer): Boolean; // Make sure treeName is exactly the same as in uptext! CASE-SENSITIVE
  42. var
  43.   p: TPoint;
  44.   t: Integer;
  45.   b: Boolean;
  46.   a: TStrArray;
  47. begin
  48.   Result := False;  
  49.   p := Point(x, y); // We create 'p' point of x,y coordinates
  50.   if (PointInBox(p, RS07_GameActionBx) and RS07_LoggedIn) then // We check that point is inside main screen AND that we are logged in, before we continue.
  51.   begin
  52.     a := ['Chop down Tree', 'Chop down Oak', 'Chop down Willow', 'Chop down Maple', 'Chop down Yew', 'Chop down Magic tree'];    
  53.     t := GetSystemTime; // Timer reset
  54.     repeat    
  55.       case MSSL_MouseNearPt(p, 2) of // With this step we case the next action of.. If mouse is not near our point, we will move it to it.
  56.         True:                        // ..and else we will check for result.
  57.         if ((GetSystemTime - t) > 35) then // If time since mouse movement has been over 35 ms. then we can check for result...
  58.         begin
  59.           Result := RS07_IsUpTextCustomEx(a, [16777215, 65535], RS07_UpTextTol); // Is uptext with white and yellow as "Chop down *"? Result will be set as true, if it is...
  60.           if not Result then // OK, so result wasn't true, lets check for other texts...
  61.             b := (RS07_IsUpTextCustomEx(a, [16777215, 16776960], RS07_UpTextTol) or RS07_IsUpText('Walk here')); // If uptext is normal tree-text OR "Walk here", then variable 'b' will be set as true
  62.         end;
  63.         False:  
  64.         begin
  65.           case RS07_QuickObjectCheck of // If this MSSL variable is set as true, then...
  66.             True: SetMousePos(p.X, p.Y); // SetMousePos() will be used and else...
  67.             False: RS07_MoveMouse(p.X, p.Y); // Normal RS07_MoveMouse() movement!
  68.           end;    
  69.           t := GetSystemTime; // We mark the timer as current time (after movement)
  70.         end;
  71.       end;
  72.       MSSL_Wait(0); // MSSL_Wait with hotkey check!
  73.     until (Result or b or ((GetSystemTime - t) > 250)); // If this or this or this, then we are ready to break out!
  74.   end;
  75. end;
  76.  
  77. procedure GetBanking;
  78. var
  79.   x, y: Integer;
  80.   c: TPoint;
  81. begin
  82.   if (forceBanking or RS07_InventoryFull) then  // bag full
  83.   begin  
  84.     forceBanking := False; // resets the force.                    
  85.     c := BoxCenter(RS07_GameActionBx); // Stores center point from RS07_GameActionBx (main screen) to 'c' variable (TPoint).
  86.     SetCompassAngleAndHeight(Dir_North, True);      
  87.     if MSSL_FindColorSpiralTolCS(227, 159, x, y, 4969197, 558, 8, 730, 164, 8, MSSL_ColorSettings2(2, 0.19, 2.34)) then
  88.     begin
  89.       Mouse(x, y, 0, 0, True); // left click position and run to bank
  90.       MSSL_WaitRange(5000, 8999);
  91.       if RS07_OpenBank(RS07_BANK_DRAYNOR) then //find bank
  92.       begin
  93.         MSSL_WaitRange(990, 2100);          
  94.         RS07_DepositEverythingEx([0]);
  95.         MMouse(577, 231, 0, 0);
  96.         MSSL_WaitRange(250, 750);    
  97.         MSSL_WaitRange(500, 1400);
  98.         MSSL_WaitRange(550, 1250);  
  99.         SetCompassAngleAndHeight(Dir_North, True);
  100.         Mouse(626, 134, 1, 1, True);
  101.         MSSL_WaitRange(8000, 9999);
  102.       end;
  103.     end;
  104.   end;
  105. end;
  106.  
  107. procedure GetChopping;
  108. var
  109.   x, y: Integer;
  110.   c: TPoint;
  111. begin
  112.   c := BoxCenter(RS07_GameActionBx);  
  113.   if RS07_FindObject(x, y, 'Chop down Willow', um_IsUpTextCustom, MSSL_ColorSettings2(2, 0.23, 0.72), 2581337, 3, 40, RS07_GameActionBx.X1, RS07_GameActionBx.Y1, RS07_GameActionBx.X2, RS07_GameActionBx.Y2) then  
  114.   begin
  115.     WriteLn(MSSL_TheTime + ': Found a tree...');
  116.     if ((GetSystemTime - lastChop) > CHOP_DELAY) then
  117.     begin
  118.       Mouse(x, y, 0, 0, True);
  119.       lastChop := GetSystemTime;
  120.     end;
  121.     repeat
  122.       GetBanking;
  123.       c := BoxCenter(RS07_GameActionBx);
  124.       if MSSL_FindColorSpiralTolCS(227, 159, x, y, 610633, 1, 1, 510, 334, 2, MSSL_ColorSettings2(2, 0.06, 0.03)) then //check for nests
  125.       begin
  126.         MMouse(x, y, 0, 0);
  127.         WriteLn('found a nest or root random');
  128.         MSSL_WaitRange(40, 50);
  129.         if (RS07_UpTextContains('Take') or RS07_UpTextContains('Pick')) then
  130.         begin
  131.           Mouse(x, y, 0, 0, True);
  132.           MSSL_WaitRange(3000, 5000);
  133.         end;    
  134.       end;
  135.       if FindColorTol(x, y, 3240548, 39, 363, 90, 405, 2) then //lvl up check
  136.         Mouse(292, 447, 0, 0, True);
  137.       //OSIFindRandoms;  //wip  
  138.       if RS07_IsUpText('Chop down') then // Just to check that we still have mouse inside the tree.
  139.       begin          
  140.         GetMousePos(x, y);
  141.         forceBanking := EvilTreeAt(x, y);
  142.         if forceBanking then
  143.           GetBanking;
  144.       end;
  145.     until not RS07_IsUpText('Chop down');                
  146.     if not FindColorTol(x, y, 14474496, 12, 12, 90, 19, 99) then
  147.     begin
  148.       GetMousePos(x, y);
  149.       MMouse(x, y, 45, 90);
  150.       MSSL_Wait(50 + Random(100));
  151.       MMouse(x, y, 90, 45);
  152.       MSSL_Wait(50 + Random(100));
  153.       MMouse(x, y, 30, 30);
  154.       MSSL_Wait(50 + Random(100));
  155.     end;
  156.   end;
  157. end;
  158.  
  159. begin
  160.   SetUpOSI;
  161.   MSSL_Setup;  
  162.   RS07_UpTextCustomColors := [16777215, 16776960]; // Used for detecting only normal Willow tree's with RS07_FindObject()
  163.   DeclarePlayers;
  164.   Login;      
  165.   SetCompassAngleAndHeight(Dir_North, True);
  166.   RS07_SetMoveSpeed(1);
  167.   RS07_OpenGameTab(3);
  168.   repeat    
  169.     case RS07_LoggedIn of
  170.       False:
  171.       if RS07_LogInPlayer then // Logins with currently active player's details.  
  172.       begin    
  173.         SetCompassAngleAndHeight(Dir_North, True);
  174.         RS07_SetMoveSpeed(1);
  175.         RS07_OpenGameTab(3);        
  176.       end;
  177.       True: GetChopping;
  178.     end;    
  179.     MSSL_Wait(0);
  180.   until False;
  181. end.
Advertisement
Add Comment
Please, Sign In to add comment