Janilabo

Untitled

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