Janilabo

Untitled

Apr 3rd, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 6.33 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: Integer;
  108.   c: TPoint;
  109. begin
  110.   c := BoxCenter(RS07_GameActionBx);  
  111.   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  
  112.   begin
  113.     WriteLn(MSSL_TheTime + ': Found a tree...');
  114.     Mouse(x, y, 0, 0, True);
  115.     repeat
  116.       GetBanking;
  117.       c := BoxCenter(RS07_GameActionBx);
  118.       if MSSL_FindColorSpiralTolCS(227, 159, x, y, 610633, 1, 1, 510, 334, 2, MSSL_ColorSettings2(2, 0.06, 0.03)) then //check for nests
  119.       begin
  120.         MMouse(x, y, 0, 0);
  121.         WriteLn('found a nest or root random');
  122.         MSSL_WaitRange(40, 50);
  123.         if (RS07_UpTextContains('Take') or RS07_UpTextContains('Pick')) then
  124.         begin
  125.           Mouse(x, y, 0, 0, True);
  126.           MSSL_WaitRange(3000, 5000);
  127.         end;    
  128.       end;
  129.       if FindColorTol(x, y, 3240548, 39, 363, 90, 405, 2) then //lvl up check
  130.         Mouse(292, 447, 0, 0, True);
  131.       //OSIFindRandoms;  //wip  
  132.       if RS07_IsUpText('Chop down') then // Just to check that we still have mouse inside the tree.
  133.       begin          
  134.         GetMousePos(x, y);
  135.         forceBanking := EvilTreeAt(x, y);
  136.         if forceBanking then
  137.           GetBanking;
  138.       end;
  139.     until not RS07_IsUpText('Chop down');                
  140.     if not FindColorTol(x, y, 14474496, 12, 12, 90, 19, 99) then
  141.     begin
  142.       GetMousePos(x, y);
  143.       MMouse(x, y, 45, 90);
  144.       MSSL_Wait(50 + Random(100));
  145.       MMouse(x, y, 90, 45);
  146.       MSSL_Wait(50 + Random(100));
  147.       MMouse(x, y, 30, 30);
  148.       MSSL_Wait(50 + Random(100));
  149.     end;
  150.   end;
  151. end;
  152.  
  153. begin
  154.   SetUpOSI;
  155.   MSSL_Setup;  
  156.   RS07_UpTextCustomColors := [16777215, 16776960]; // Used for detecting only normal Willow tree's with RS07_FindObject()
  157.   DeclarePlayers;
  158.   Login;      
  159.   SetCompassAngleAndHeight(Dir_North, True);
  160.   RS07_SetMoveSpeed(1);
  161.   RS07_OpenGameTab(3);
  162.   repeat    
  163.     case RS07_LoggedIn of
  164.       False:
  165.       if RS07_LogInPlayer then // Logins with currently active player's details.  
  166.       begin    
  167.         SetCompassAngleAndHeight(Dir_North, True);
  168.         RS07_SetMoveSpeed(1);
  169.         RS07_OpenGameTab(3);        
  170.       end;
  171.       True: GetChopping;
  172.     end;    
  173.     MSSL_Wait(0);
  174.   until False;
  175. end.
Advertisement
Add Comment
Please, Sign In to add comment