Janilabo

Untitled

Apr 4th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 7.44 KB | None | 0 0
  1. //OSRS07 - Willow Cutter and banker v0.9
  2. //Amberleaf
  3. //Instructions & more scripts can be found at http://www.scar-divi.com
  4. //4/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 = 1500; // Minimum delay between chops.
  18.   MAXIMUM_INTERVAL = 30000; // Maximum interval between chopped logs? Prevents our player from getting stuck (happens rarely).
  19.                      
  20. {$IFNDEF MSSL_1.04-2(+)}
  21.   begin                
  22.     ClearDebug;
  23.     WriteLn('MSSL is OUTDATED! Please update it with Includes Manager.');
  24.   end.
  25. {$ENDIF}
  26.  
  27. var
  28.   lastChop: Integer;
  29.  
  30. procedure ScriptTerminate;
  31. begin
  32.   MSSL_Unsetup;
  33.   FreeOSI;
  34. end;
  35.  
  36. function EvilTreeAt(x, y: Integer): Boolean; // Make sure treeName is exactly the same as in uptext! CASE-SENSITIVE
  37. var
  38.   p: TPoint;
  39.   t: Integer;
  40.   b: Boolean;
  41.   a: TStrArray;
  42. begin
  43.   Result := False;  
  44.   p := Point(x, y); // We create 'p' point of x,y coordinates
  45.   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.
  46.   begin
  47.     a := ['Chop down Tree', 'Chop down Oak', 'Chop down Willow', 'Chop down Maple', 'Chop down Yew', 'Chop down Magic tree'];    
  48.     t := GetSystemTime; // Timer reset
  49.     repeat    
  50.       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.
  51.         True:                        // ..and else we will check for result.
  52.         if ((GetSystemTime - t) > 35) then // If time since mouse movement has been over 35 ms. then we can check for result...
  53.         begin
  54.           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...
  55.           if not Result then // OK, so result wasn't true, lets check for other texts...
  56.             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
  57.         end;
  58.         False:  
  59.         begin
  60.           case RS07_QuickObjectCheck of // If this MSSL variable is set as true, then...
  61.             True: SetMousePos(p.X, p.Y); // SetMousePos() will be used and else...
  62.             False: RS07_MoveMouse(p.X, p.Y); // Normal RS07_MoveMouse() movement!
  63.           end;    
  64.           t := GetSystemTime; // We mark the timer as current time (after movement)
  65.         end;
  66.       end;
  67.       MSSL_Wait(0); // MSSL_Wait with hotkey check!
  68.     until (Result or b or ((GetSystemTime - t) > 250)); // If this or this or this, then we are ready to break out!
  69.   end;
  70. end;
  71.  
  72. procedure GetBanking;
  73. var
  74.   x, y, t: Integer;
  75.   c: TPoint;  
  76.   b: Boolean;
  77. begin                  
  78.   c := BoxCenter(RS07_MinimapBounds); // Stores center point from RS07_MinimapBounds (minimap area) to 'c' variable (TPoint).
  79.   RS07_SetCompass(Dir_North);      
  80.   if MSSL_FindColorSpiralTolCS(c.X, c.Y, x, y, 4969197, RS07_MinimapBounds.X1, RS07_MinimapBounds.Y1, RS07_MinimapBounds.X2, RS07_MinimapBounds.Y2, 8, MSSL_ColorSettings2(2, 0.19, 2.34)) then
  81.   begin
  82.     Mouse(x, y, 0, 0, True); // left click position and run to bank
  83.     t := GetSystemTime;
  84.     repeat      
  85.       if not RS07_LoggedIn then
  86.         Exit;  
  87.       b := RS07_FindBankBooth(x, y, RS07_BANK_DRAYNOR);
  88.       case b of
  89.         True:
  90.         if RS07_OpenBank(RS07_BANK_DRAYNOR) then //find bank
  91.         begin              
  92.           t := GetSystemTime;
  93.           repeat  
  94.             MSSL_Wait(0);
  95.           until (((GetSystemTime - t) > 5000) or RS07_BankOpen or not RS07_LoggedIn);
  96.           if RS07_BankOpen then  
  97.           begin  
  98.             RS07_DepositEverythingEx([0]);
  99.             MSSL_WaitRange(250, 500);    
  100.             RS07_SetCompass(Dir_North);
  101.             Mouse(626, 134, 1, 1, True);
  102.             MSSL_WaitRange(2000, 3000);
  103.           end;
  104.         end;
  105.         False: MSSL_Wait(100);
  106.       end;
  107.     until (b or ((GetSystemTime - t) > 15000));
  108.   end;
  109. end;
  110.  
  111. procedure GetChopping;
  112. var
  113.   f, m, s: Boolean;
  114.   o, n, x, y, t: Integer;
  115.   b, a, c: TPoint;
  116.   p: TPointArray;
  117. begin
  118.   repeat
  119.     if not RS07_LoggedIn then
  120.       Exit;      
  121.     GetMousePos(c.X, c.Y);
  122.     if not PointInBox(c, RS07_GameActionBx) then
  123.       c := BoxCenter(RS07_GameActionBx);
  124.     GetMousePos(b.X, b.Y);
  125.     f := RS07_FindObjectsEx(p, ['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, 1, c);
  126.     if f then
  127.     begin    
  128.       WriteLn(MSSL_TheTime + ': Found a tree...');
  129.       GetMousePos(a.X, a.Y);
  130.       m := (Distance(a.X, a.Y, b.X, b.Y) > 10); // If tree has moved certain amount of pixels before detecting it!
  131.       if (m or ((GetSystemTime - lastChop) > MAXIMUM_INTERVAL) or not s) then
  132.       begin          
  133.         Mouse(p[0].X, p[0].Y, 0, 0, True);
  134.         lastChop := GetSystemTime;                
  135.         s := True;
  136.       end else                  
  137.         RS07_MoveMouse(p[0].X, p[0].Y);
  138.       SetLength(p, 0);  
  139.       t := GetSystemTime;
  140.       o := RS07_UsedInventorySlots;
  141.       GetMousePos(x, y);
  142.       if (RS07_InventoryFull or EvilTreeAt(x, y)) then      
  143.         GetBanking;
  144.       n := RS07_UsedInventorySlots;
  145.       if ((n > -1) and (n <> o)) then // To make sure the used slots were detected correctly
  146.       begin    
  147.         t := GetSystemTime; // We reset the timing mark of when we got last log to our inventory.
  148.         o := n;
  149.       end;
  150.       if MSSL_FindColorSpiralTolCS(227, 159, x, y, 610633, 1, 1, 510, 334, 2, MSSL_ColorSettings2(2, 0.06, 0.03)) then //check for nests
  151.       begin
  152.         MMouse(x, y, 0, 0);
  153.         WriteLn('found a nest or root random');
  154.         MSSL_WaitRange(40, 50);
  155.         if (RS07_UpTextContains('Take') or RS07_UpTextContains('Pick')) then
  156.         begin
  157.           Mouse(x, y, 0, 0, True);
  158.           MSSL_WaitRange(3000, 5000);
  159.         end;    
  160.       end;
  161.       if FindColorTol(x, y, 3240548, 39, 363, 90, 405, 2) then //lvl up check
  162.         Mouse(292, 447, 0, 0, True);
  163.       //OSIFindRandoms;  //wip    
  164.     end;
  165.   until (not f or ((GetSystemTime - t) > MAXIMUM_INTERVAL));
  166. end;
  167.  
  168. procedure ScriptSetup;
  169. begin
  170.   RS07_UpTextCustomColors := [16777215, 16776960]; // Used for detecting only normal Willow tree's with RS07_FindObject()
  171.   RS07_SetActivePlayer(USERNAME, PASSWORD, '', MSSL_TCAToTIA(MSSL_StrToTCA(BANK_PIN)));    
  172.   RS07_SetCompass(Dir_North);
  173.   RS07_SetCameraAngleH;
  174.   RS07_SetMoveSpeed(1);
  175.   RS07_OpenGameTab(3);  
  176.   RS07_ControlCameraScriptwise := True; // We set the camera to highest angle manually, so banking functions don't need to worry about it!
  177. end;
  178.  
  179. begin
  180.   SetUpOSI;
  181.   MSSL_Setup;  
  182.   ScriptSetup;
  183.   repeat    
  184.     case RS07_LoggedIn of
  185.       False:
  186.       if RS07_LogInPlayer then // Logins with currently active player's details.  
  187.       begin    
  188.         RS07_SetCompass(Dir_North);
  189.         RS07_SetCameraAngleH;
  190.         RS07_SetMoveSpeed(1);
  191.         RS07_OpenGameTab(3);        
  192.       end;
  193.       True: GetChopping;
  194.     end;    
  195.     MSSL_Wait(0);
  196.   until False;
  197. end.
Advertisement
Add Comment
Please, Sign In to add comment