Jump to content
Janilabo

[Project RSC] CowKiller

Recommended Posts

PRSC CowKiller v1.03

 

Current Status: Broken at the moment, needs updating. [Nov. 13, 2012]

 

Script works with WEBCLIENT - the standalone client is a little problematic.

 

NOTES

-Target the ONLY the Project RSC APPLET area with SCAR Divi's crosshair.

So, make sure it doesn't capture the whole window (if you are using Project RSC Launcher)

-Latest version of MSSL can be downloaded from SCAR Divi's Includes Manager.

 

Requirements

-SCAR Divi version 3.36 (not required, but highly recommended - better performance!)

-MSSL version 0.99-1b (NOTE: Update to LATEST with SCAR Divi's Includes Manager!)

 

Build Information

-Version 1.03

-November 2nd, 2012.

 

Features

-Attacks cows

-Boneburying (optional, disabled by default)

-Relogging

-Eats & runs out of combat with low HP (Meat and ALL fishes are supported)

-Idle warning (when script hasn't attacked anything for certain amount of time in milliseconds [iDLE_WARN])

-Camera rotation for looking cows from screen

-Alarms with 100% fatigue!

-Staff member detection (when messages are sent to you through PM or chatbox)

 

To be added/improved in next version...

-Attacking improvement

 

Have fun!

-Jani

PRSC CowKiller [v1.00].zip

PRSC CowKiller [1.01].scar

PRSC CowKiller [1.02].scar

PRSC CowKiller [1.03].scar

Edited by Janilabo
Added v1.03
Link to comment
Share on other sites

turner, they are all set to OFF by default now. :)

If you want to change them, use PRSC_BlockChatMessages, PRSC_BlockPrivateMessages, PRSC_BlockTradeRequests at mainloop..

 

Example:

 

      if not macroOptionsSet then
     begin           
       iWait(1000);
       PRSC_BlockChatMessages := False;
       PRSC_BlockPrivateMessages := True;
       PRSC_BlockTradeRequests := True;
       macroOptionsSet := PRSC_SetMacroOptions;
       MSSL_ClickAt(((centerPoint.X - 3) + Random(7)), ((centerPoint.Y - 2) + Random(5)), mbRight);
       iWait(550 + Random(50));
       PRSC_ChooseOptionUse('Walk here');  
     end;

 

I will add boolean constants to next version for setting em ON/OFF (True/False) at the script startup.

 

Edit: script didn't like the new MSSL update, so here is the script with quickfix (update to latest MSSL):

 

{$DEFINE PRSC}

{$I MSSL\MSSL.scar}

const
 USERNAME = ''; // Fill USERNAME and PASSWORD if you want to use autologging.
 PASSWORD = ''; // Leave fields empty, if you want to keep this feature disabled.
 COMBAT_STYLE = PRSC_COMBAT_STYLE_STRENGTH; // PRSC_COMBAT_STYLE_(STRENGTH, DEFENSE, ATTACK, MULTI)
 LOW_HP = 25; // Runs away from combat and eats with this hp.
 CAMERA_ROTATION = True; // Rotate camera when NPCs arent found at screen? True = YES, False = NO.
 COW_COLOR1 = 14342875; // Rat colors. Only re-set these, when/if needed (with color updates).
 COW_COLOR2 = 4934475;
 COW_COLOR3 = 4079166;
 STOP_FKEY = VK_F12; // Stop F-key. Use VK_F1 - VK_12.
 ATTACK_INTERVAL = 2000; // Time before it starts looking for new rat, if player didnt get in fight.
 IDLE_WARN = 120000; // Warns if X-amount of milliseconds has passed since last attack.
                     // 1000 ms. = 1 s. 10000 ms. = 10 s. 60000 ms. = 60 s. 90000 ms. = 90 s.

var
 alarmTM, lastAttackTM, fatiguePercent: Integer;
 bmpSwordfish, bmpTuna, bmpLobster: TSCARBitmap;
 cowColors: TIntArray;
 centerPoint: TPoint;
 macroOptionsSet: Boolean;

procedure ScriptTerminate;
begin
 PlaySound(ScriptPath + 'empty.wav');
 PRSC_RotateCamera(rcd_Nil3);  
 bmpSwordfish.Free;
 bmpLobster.Free;
 bmpTuna.Free;
 MSSL_Unsetup; 
 SetLength(cowColors, 0);
end;

procedure Warning(msg: string);
begin
 if ((GetSystemTime - alarmTM) >= 12000) then
 begin     
   ClearDebug;
   WriteLn('WARNING: ' + msg);
   PlaySound(ScriptPath + 'siren.wav');
   alarmTM := GetSystemTime;
 end;            
end;

function FindCow(var x, y: Integer): Boolean;
var
 TPA: TPointArray;
 ATPA: T2DPointArray;
 t: Integer;
begin
 PRSC_Wait(0);
 if not PRSC_LoggedIn then
   Exit;
 t := GetSystemTime;
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Random3);
 repeat
   if (CountColors(cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) > 500) then
     if FindColorsSpiralEx(RandomRange(136, 377) , RandomRange(90, 214), TPA, cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) then
     begin           
       ATPA := SplitTPA(TPA, 15); 
       SetLength(TPA, 0); 
       MSSL_ATPAFilterSizeMin(ATPA, 500); 
       if (Length(ATPA) > 0) then
       begin
         SortATPAByMiddleEx(ATPA, centerPoint);
         Result := TPAMiddleEx(ATPA[0], x, y);
         SetLength(ATPA, 0);
       end;
     end; 
   PRSC_Wait(0);     
 until (Result or ((GetSystemTime - t) > 60000));  
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Nil3);  
end;

function AttackedCow: Boolean;
var
 x, y: Integer;
begin
 PRSC_Wait(0);
 if FindCow(x, y) then 
 begin
   MSSL_MoveAt(((x - 2) + Random(5)), ((y - 2) + Random(5)));
   PRSC_Wait(25);
   Result := PRSC_UpTextContains('cow (level-8)');
   if not Result then
   begin
     MSSL_Click(mbRight);
     PRSC_Wait(45 + Random(25));
     Result := PRSC_ChooseOptionUse('cow (level-8)');
   end else
     MSSL_Click(mbLeft);
 end;
end;

procedure HandleCombat;
var
 cs, hp, tm: Integer; 
begin
 lastAttackTM := (GetSystemTime - ATTACK_INTERVAL);
 repeat     
   PRSC_Wait(0);
   if not PRSC_LoggedIn then
     Exit; 
   if PRSC_GetCombatStyle(cs) then
     if (cs <> COMBAT_STYLE) then
       PRSC_SetCombatStyle(COMBAT_STYLE);
   if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
   begin   
     hp := PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current);
     if (hp > -1) then
       if (hp <= LOW_HP) then
         if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
         begin
           PRSC_Wait(50);
           tm := GetSystemTime;
           repeat        
             ClickMouse(431, 112, mbLeft);
             PRSC_Wait(100);
           until (((GetSystemTime - tm) > 60000) or not PRSC_InFight);
         end;
   end;        
 until not PRSC_InFight;                 
end;

procedure FightCow;
var
 x, y, tm: Integer;
begin
 PRSC_Wait(0);
 if AttackedCow then
 begin
   lastAttackTM := GetSystemTime;
   tm := GetSystemTime;
   repeat     
     PRSC_Wait(10);          
   until (PRSC_InFight or ((GetSystemTime - tm) >= ATTACK_INTERVAL));
   if PRSC_InFight then
     HandleCombat;  
 end else
   if PRSC_ChooseOptionInUse(x, y) then
     PRSC_Click(x, y, 0, 0, mbRight);
end;

function FoodFound(var Slots: TIntArray): Boolean;
var
 h, x, i: Integer;
 t: TPointArray;
 b: TSCARBitmap;
begin
 SetLength(Slots, 0);
 PRSC_Wait(0);
 if PRSC_LoggedIn then
   if PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY) then
   begin 
     for i := 0 to 2 do
     begin 
       PRSC_Wait(0); 
       case i of
         0: b := bmpSwordfish.Clone;
         1: b := bmpLobster.Clone;
         2: b := bmpTuna.Clone;
       end;   
       try               
         if FindBitmapEx(t, b, 264, 36, 508, 239) then
         begin          
           Result := True;         
           h := High(t);
           for x := 0 to h do
             TIAAppend(Slots, MSSL_BGConvertPointToID(PRSC_Inventory.slot, t[x]));
           SetLength(t, 0);
         end; 
       finally
         b.Free;  
       end;
     end;          
     if Result then
       SortTIA(Slots);     
   end;
end;

function AteFood: Boolean;
var
 h, c, e, t: Integer;
 p: TPoint;
 fs: TIntArray;
 b: TBoxArray;
 a: Boolean; 
begin
 if FoodFound(fs) then
 begin 
   b := MSSL_BGGetBoxesEx(PRSC_Inventory.slot, fs);
   SetLength(fs, 0); 
   t := GetSystemTime;
   repeat 
     PRSC_Wait(0); 
     Result := (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP);
     h := High(b);
     if not Result then
       if ((h > -1) and PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY)) then
       begin
         p := MSSL_BoxCenter(b[h]);
         p.X := ((p.X - 5) + Random(11));
         p.Y := ((p.Y - 3) + Random(7));
         c := GetColor(p.X, p.Y);
         MSSL_ClickAt(p.X, p.Y, mbLeft);
         e := GetSystemTime; 
         repeat
           a := (GetColor(p.X, p.Y) <> c);
           if a then
             Delete(b, h, 1);
           PRSC_Wait(10);  
         until (a or ((GetSystemTime - e) > 1000)); 
       end;
     if ((GetSystemTime - t) > 30000) then
       Warning('EATING FUCKED UP!');       
   until (Result or (h < 0) or ((GetSystemTime - t) > 30000)); 
   if (h < 0) then
     Warning('Out of FOOD!'); 
 end else
   Warning('Out of FOOD!');
end;

procedure SetupScript;
begin
 MSSL_Setup;     
 bmpSwordfish := TSCARBitmap.Create('deNrjYeBg6AroIoiq3auxImLUkIpS' +
   'rVPphkIMQwgiAIvibNU=');
 bmpLobster := TSCARBitmap.Create('deNrjYeBg6PMFoQJbKKp3ZXA11wGS88' +
   'IQCMhdGwdCQJUQETgDzgXKApUhiwNNg3MhxkLMh9gIkYJYDeECFUjwsCOrgZsA' +
   'ZwOleNlBJLI5yMogjgciiDkxRthNgBgCtxqZAXcqUA2QBADOwEsK');
 bmpTuna := TSCARBitmap.Create('deNrjYeBgmF1SQiqqjolBQ5jimOohDFxGI' +
   'YtgakRGXRkZcNMgDKAIVgSUxSUFl8X0CxoCAB7Hgzo=');                                                                      
 PRSC_Wait(1000);  
 cowColors := [COW_COLOR1, COW_COLOR2, COW_COLOR3];
 centerPoint := MSSL_AreaCenter(0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)); 
 lastAttackTM := GetSystemTime;  
end;

begin
 SetupScript;      
 Wait(1000);  
 repeat      
   PRSC_Wait(0);
   if ((GetSystemTime - lastAttackTM) >= IDLE_WARN) then
     Warning('IDLE...');
   if PRSC_LoggedIn then
   begin 
     if not macroOptionsSet then
     begin           
       PRSC_Wait(1000);
       macroOptionsSet := PRSC_SetMacroOptions;
       MSSL_ClickAt(((centerPoint.X - 3) + Random(7)), ((centerPoint.Y - 2) + Random(5)), mbRight);
       PRSC_Wait(550 + Random(50));
       PRSC_ChooseOptionUse('Walk here');  
     end;     
     if not PRSC_Sleeping then
       if PRSC_GetFatigue(fatiguePercent) then
       begin
         if (fatiguePercent < 100) then
         begin    
           if (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) <= LOW_HP) then
           begin
             repeat        
               if not AteFood then
                 Warning('Low HP and we failed to eat food!');
               PRSC_Wait(10);
             until ((PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP) or not PRSC_LoggedIn);
           end else     
             if not PRSC_InFight then
             begin            
               MoveMouse((300 + Random(6)), (10 + Random(15)));
               FightCow;
             end else
               HandleCombat;
           PRSC_Wait(10);    
         end else
           Warning('Fatigue full!');
       end else
         MoveMouse((300 + Random(6)), (10 + Random(15)));
     PRSC_Wait(10);
   end else
     if ((USERNAME <> '') and (PASSWORD <> '')) then
       PRSC_LogIn(USERNAME, PASSWORD)
     else
       Warning('Not logged in.');                        
 until GetKeyState(STOP_FKEY);  
end.

Edited by Janilabo
Link to comment
Share on other sites

Hey jan... so I changed the colors and text in your script to work with chickens.... i also added meat as one of the foods... currently it just spins the camera like it cant find chickens, what did I not change thats breaking it?

 

{$DEFINE PRSC}

{$I MSSL\MSSL.scar}

const
 USERNAME = ''; // Fill USERNAME and PASSWORD if you want to use autologging.
 PASSWORD = ''; // Leave fields empty, if you want to keep this feature disabled.
 COMBAT_STYLE = PRSC_COMBAT_STYLE_STRENGTH; // PRSC_COMBAT_STYLE_(STRENGTH, DEFENSE, ATTACK, MULTI)
 LOW_HP = 8; // Runs away from combat and eats with this hp.
 CAMERA_ROTATION = True; // Rotate camera when NPCs arent found at screen? True = YES, False = NO.
 COW_COLOR1 = 14606046; // Rat colors. Only re-set these, when/if needed (with color updates).
 COW_COLOR2 = 16185078;
 COW_COLOR3 = 41957;
 STOP_FKEY = VK_F12; // Stop F-key. Use VK_F1 - VK_12.
 ATTACK_INTERVAL = 2000; // Time before it starts looking for new rat, if player didnt get in fight.
 IDLE_WARN = 120000; // Warns if X-amount of milliseconds has passed since last attack.
                     // 1000 ms. = 1 s. 10000 ms. = 10 s. 60000 ms. = 60 s. 90000 ms. = 90 s.

var
 alarmTM, lastAttackTM, fatiguePercent: Integer;
 bmpSwordfish, bmpTuna, bmpMeat, bmpLobster: TSCARBitmap;
 cowColors: TIntArray;
 centerPoint: TPoint;
 macroOptionsSet: Boolean;

procedure ScriptTerminate;
begin
 PlaySound(ScriptPath + 'empty.wav');
 PRSC_RotateCamera(rcd_Nil3);  
 bmpSwordfish.Free;
 bmpLobster.Free;
 bmpTuna.Free;  
 bmpMeat.Free;
 MSSL_Unsetup; 
 SetLength(cowColors, 0);
end;

procedure Warning(msg: string);
begin
 if ((GetSystemTime - alarmTM) >= 12000) then
 begin     
   ClearDebug;
   WriteLn('WARNING: ' + msg);
   PlaySound(ScriptPath + 'siren.wav');
   alarmTM := GetSystemTime;
 end;            
end;

function FindCow(var x, y: Integer): Boolean;
var
 TPA: TPointArray;
 ATPA: T2DPointArray;
 t: Integer;
begin
 PRSC_Wait(0);
 if not PRSC_LoggedIn then
   Exit;
 t := GetSystemTime;
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Random3);
 repeat
   if (CountColors(cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) > 500) then
     if FindColorsSpiralEx(RandomRange(136, 377) , RandomRange(90, 214), TPA, cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) then
     begin           
       ATPA := SplitTPA(TPA, 15); 
       SetLength(TPA, 0); 
       MSSL_ATPAFilterSizeMin(ATPA, 500); 
       if (Length(ATPA) > 0) then
       begin
         SortATPAByMiddleEx(ATPA, centerPoint);
         Result := TPAMiddleEx(ATPA[0], x, y);
         SetLength(ATPA, 0);
       end;
     end; 
   PRSC_Wait(0);     
 until (Result or ((GetSystemTime - t) > 60000));  
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Nil3);  
end;

function AttackedCow: Boolean;
var
 x, y: Integer;
begin
 PRSC_Wait(0);
 if FindCow(x, y) then 
 begin
   MSSL_MoveAt(((x - 2) + Random(5)), ((y - 2) + Random(5)));
   PRSC_Wait(25);
   Result := PRSC_UpTextContains('Chicken (level-3)');
   if not Result then
   begin
     MSSL_Click(mbRight);
     PRSC_Wait(45 + Random(25));
     Result := PRSC_ChooseOptionUse('Chicken (level-3)');
   end else
     MSSL_Click(mbLeft);
 end;
end;

procedure HandleCombat;
var
 cs, hp, tm: Integer; 
begin
 lastAttackTM := (GetSystemTime - ATTACK_INTERVAL);
 repeat     
   PRSC_Wait(0);
   if not PRSC_LoggedIn then
     Exit; 
   if PRSC_GetCombatStyle(cs) then
     if (cs <> COMBAT_STYLE) then
       PRSC_SetCombatStyle(COMBAT_STYLE);
   if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
   begin   
     hp := PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current);
     if (hp > -1) then
       if (hp <= LOW_HP) then
         if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
         begin
           PRSC_Wait(50);
           tm := GetSystemTime;
           repeat        
             ClickMouse(431, 112, mbLeft);
             PRSC_Wait(100);
           until (((GetSystemTime - tm) > 60000) or not PRSC_InFight);
         end;
   end;        
 until not PRSC_InFight;                 
end;

procedure FightCow;
var
 x, y, tm: Integer;
begin
 PRSC_Wait(0);
 if AttackedCow then
 begin
   lastAttackTM := GetSystemTime;
   tm := GetSystemTime;
   repeat     
     PRSC_Wait(10);          
   until (PRSC_InFight or ((GetSystemTime - tm) >= ATTACK_INTERVAL));
   if PRSC_InFight then
     HandleCombat;  
 end else
   if PRSC_ChooseOptionInUse(x, y) then
     PRSC_Click(x, y, 0, 0, mbRight);
end;

function FoodFound(var Slots: TIntArray): Boolean;
var
 h, x, i: Integer;
 t: TPointArray;
 b: TSCARBitmap;
begin
 SetLength(Slots, 0);
 PRSC_Wait(0);
 if PRSC_LoggedIn then
   if PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY) then
   begin 
     for i := 0 to 3 do
     begin 
       PRSC_Wait(0); 
       case i of
         0: b := bmpSwordfish.Clone;
         1: b := bmpLobster.Clone;
         2: b := bmpTuna.Clone; 
         3: b := bmpMeat.Clone;
       end;   
       try               
         if FindBitmapEx(t, b, 264, 36, 508, 239) then
         begin          
           Result := True;         
           h := High(t);
           for x := 0 to h do
             TIAAppend(Slots, MSSL_BGConvertPointToID(PRSC_Inventory.slot, t[x]));
           SetLength(t, 0);
         end; 
       finally
         b.Free;  
       end;
     end;          
     if Result then
       SortTIA(Slots);     
   end;
end;

function AteFood: Boolean;
var
 h, c, e, t: Integer;
 p: TPoint;
 fs: TIntArray;
 b: TBoxArray;
 a: Boolean; 
begin
 if FoodFound(fs) then
 begin 
   b := MSSL_BGGetBoxesEx(PRSC_Inventory.slot, fs);
   SetLength(fs, 0); 
   t := GetSystemTime;
   repeat 
     PRSC_Wait(0); 
     Result := (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP);
     h := High(b);
     if not Result then
       if ((h > -1) and PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY)) then
       begin
         p := MSSL_BoxCenter(b[h]);
         p.X := ((p.X - 5) + Random(11));
         p.Y := ((p.Y - 3) + Random(7));
         c := GetColor(p.X, p.Y);
         MSSL_ClickAt(p.X, p.Y, mbLeft);
         e := GetSystemTime; 
         repeat
           a := (GetColor(p.X, p.Y) <> c);
           if a then
             Delete(b, h, 1);
           PRSC_Wait(10);  
         until (a or ((GetSystemTime - e) > 1000)); 
       end;
     if ((GetSystemTime - t) > 30000) then
       Warning('EATING FUCKED UP!');       
   until (Result or (h < 0) or ((GetSystemTime - t) > 30000)); 
   if (h < 0) then
     Warning('Out of FOOD!'); 
 end else
   Warning('Out of FOOD!');
end;

procedure SetupScript;
begin
 MSSL_Setup;     
 bmpSwordfish := TSCARBitmap.Create('deNrjYeBg6AroIoiq3auxImLUkIpS' +
   'rVPphkIMQwgiAIvibNU=');
 bmpLobster := TSCARBitmap.Create('deNrjYeBg6PMFoQJbKKp3ZXA11wGS88' +
   'IQCMhdGwdCQJUQETgDzgXKApUhiwNNg3MhxkLMh9gIkYJYDeECFUjwsCOrgZsA' +
   'ZwOleNlBJLI5yMogjgciiDkxRthNgBgCtxqZAXcqUA2QBADOwEsK');
 bmpTuna := TSCARBitmap.Create('deNrjYeBgmF1SQiqqjolBQ5jimOohDFxGI' +
   'YtgakRGXRkZcNMgDKAIVgSUxSUFl8X0CxoCAB7Hgzo=');                                                                      
 bmpMeat := TSCARBitmap.Create('deNrjZOBkmOqlSipaE6aNVRCCsIoTL4hVnAxH4' +
   'kEAb0JUQw==');
 PRSC_Wait(1000);  
 cowColors := [COW_COLOR1, COW_COLOR2, COW_COLOR3];
 centerPoint := MSSL_AreaCenter(0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)); 
 lastAttackTM := GetSystemTime;  
end;

begin
 SetupScript;      
 Wait(1000);  
 repeat      
   PRSC_Wait(0);
   if ((GetSystemTime - lastAttackTM) >= IDLE_WARN) then
     Warning('IDLE...');
   if PRSC_LoggedIn then
   begin 
     if not macroOptionsSet then
     begin           
       PRSC_Wait(1000);
       macroOptionsSet := PRSC_SetMacroOptions;
       MSSL_ClickAt(((centerPoint.X - 3) + Random(7)), ((centerPoint.Y - 2) + Random(5)), mbRight);
       PRSC_Wait(550 + Random(50));
       PRSC_ChooseOptionUse('Walk here');  
     end;     
     if not PRSC_Sleeping then
       if PRSC_GetFatigue(fatiguePercent) then
       begin
         if (fatiguePercent < 100) then
         begin    
           if (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) <= LOW_HP) then
           begin
             repeat        
               if not AteFood then
                 Warning('Low HP and we failed to eat food!');
               PRSC_Wait(10);
             until ((PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP) or not PRSC_LoggedIn);
           end else     
             if not PRSC_InFight then
             begin            
               MoveMouse((300 + Random(6)), (10 + Random(15)));
               FightCow;
             end else
               HandleCombat;
           PRSC_Wait(10);    
         end else
           Warning('Fatigue full!');
       end else
         MoveMouse((300 + Random(6)), (10 + Random(15)));
     PRSC_Wait(10);
   end else
     if ((USERNAME <> '') and (PASSWORD <> '')) then
       PRSC_LogIn(USERNAME, PASSWORD)
     else
       Warning('Not logged in.');                        
 until GetKeyState(STOP_FKEY);  
end.

Link to comment
Share on other sites

Hey turner, there was required a lot of changes, so here, ChickenKiller (optimized for chickens!):

 

{$DEFINE PRSC}

{$I MSSL\MSSL.scar}

const
 USERNAME = ''; // Fill USERNAME and PASSWORD if you want to use autologging.
 PASSWORD = ''; // Leave fields empty, if you want to keep this feature disabled.
 COMBAT_STYLE = PRSC_COMBAT_STYLE_STRENGTH; // PRSC_COMBAT_STYLE_(STRENGTH, DEFENSE, ATTACK, MULTI)
 LOW_HP = 8; // Runs away from combat and eats with this hp.
 CAMERA_ROTATION = True; // Rotate camera when NPCs arent found at screen? True = YES, False = NO.
 CHICKEN_COLOR1 = 14606046; // Chicken colors. Only re-set these, when/if needed (with color updates).
 CHICKEN_COLOR2 = 16185078;
 CHICKEN_COLOR3 = 12566463; 
 CHICKEN_COLOR4 = 41957; 
 CHICKEN_COLOR5 = 234;
 STOP_FKEY = VK_F12; // Stop F-key. Use VK_F1 - VK_12.
 ATTACK_INTERVAL = 1200; // Time before it starts looking for new chicken, if player didnt get in fight.
 IDLE_WARN = 120000; // Warns if X-amount of milliseconds has passed since last attack.
                     // 1000 ms. = 1 s. 10000 ms. = 10 s. 60000 ms. = 60 s. 90000 ms. = 90 s.

var
 alarmTM, lastAttackTM, fatiguePercent: Integer;
 bmpSwordfish, bmpTuna, bmpMeat, bmpLobster: TSCARBitmap;
 chickenColors: TIntArray;
 centerPoint: TPoint;
 macroOptionsSet: Boolean;

procedure ScriptTerminate;
begin
 PlaySound(ScriptPath + 'empty.wav');
 PRSC_RotateCamera(rcd_Nil3);  
 bmpSwordfish.Free;
 bmpLobster.Free;
 bmpTuna.Free;  
 bmpMeat.Free;
 MSSL_Unsetup; 
 SetLength(chickenColors, 0);
end;

procedure Warning(msg: string);
begin
 if ((GetSystemTime - alarmTM) >= 12000) then
 begin     
   ClearDebug;
   WriteLn('WARNING: ' + msg);
   PlaySound(ScriptPath + 'siren.wav');
   alarmTM := GetSystemTime;
 end;            
end;

function FindChicken(var x, y: Integer): Boolean;
var
 TPA: TPointArray;
 ATPA: T2DPointArray;
 t: Integer;
begin
 PRSC_Wait(0);
 if not PRSC_LoggedIn then
   Exit;
 t := GetSystemTime;
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Random3);
 repeat
   if (CountColors(chickenColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) > 20) then
     if FindColorsSpiralEx(RandomRange(136, 377) , RandomRange(90, 214), TPA, chickenColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) then
     begin           
       ATPA := SplitTPA(TPA, 5); 
       SetLength(TPA, 0);
       if (Length(ATPA) > 0) then
       begin
         SortATPAByMiddleEx(ATPA, centerPoint);
         Result := TPAMiddleEx(ATPA[0], x, y);
         SetLength(ATPA, 0);
       end;
     end; 
   PRSC_Wait(0);     
 until (Result or ((GetSystemTime - t) > 60000));  
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Nil3);  
end;

function AttackedChicken: Boolean;
var
 x, y: Integer;
begin
 PRSC_Wait(0);
 if FindChicken(x, y) then 
 begin
   MSSL_MoveAt(((x - 2) + Random(5)), ((y - 2) + Random(5)));
   PRSC_Wait(25);
   Result := PRSC_UpTextContains('Chicken (level-3)');
   if not Result then
   begin
     MSSL_Click(mbRight);
     PRSC_Wait(45 + Random(25));
     Result := PRSC_ChooseOptionUse('Chicken (level-3)');
   end else
     MSSL_Click(mbLeft);
 end;
end;

procedure HandleCombat;
var
 cs, hp, tm: Integer; 
begin
 lastAttackTM := (GetSystemTime - ATTACK_INTERVAL);
 repeat     
   PRSC_Wait(0);
   if not PRSC_LoggedIn then
     Exit; 
   if PRSC_GetCombatStyle(cs) then
     if (cs <> COMBAT_STYLE) then
       PRSC_SetCombatStyle(COMBAT_STYLE);
   if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
   begin   
     hp := PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current);
     if (hp > -1) then
       if (hp <= LOW_HP) then
         if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
         begin
           PRSC_Wait(50);
           tm := GetSystemTime;
           repeat        
             ClickMouse(431, 112, mbLeft);
             PRSC_Wait(100);
           until (((GetSystemTime - tm) > 60000) or not PRSC_InFight);
         end;
   end;        
 until not PRSC_InFight;                 
end;

procedure FightChicken;
var
 x, y, tm: Integer;
begin
 PRSC_Wait(0);
 if AttackedChicken then
 begin
   lastAttackTM := GetSystemTime;
   tm := GetSystemTime;
   repeat     
     PRSC_Wait(10);          
   until (PRSC_InFight or ((GetSystemTime - tm) >= ATTACK_INTERVAL));
   if PRSC_InFight then
     HandleCombat;  
 end else
   if PRSC_ChooseOptionInUse(x, y) then
     PRSC_Click(x, y, 0, 0, mbRight);
end;

function FoodFound(var Slots: TIntArray): Boolean;
var
 h, x, i: Integer;
 t: TPointArray;
 b: TSCARBitmap;
begin
 SetLength(Slots, 0);
 PRSC_Wait(0);
 if PRSC_LoggedIn then
   if PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY) then
   begin 
     for i := 0 to 3 do
     begin 
       PRSC_Wait(0); 
       case i of
         0: b := bmpSwordfish.Clone;
         1: b := bmpLobster.Clone;
         2: b := bmpTuna.Clone; 
         3: b := bmpMeat.Clone;
       end;   
       try               
         if FindBitmapEx(t, b, 264, 36, 508, 239) then
         begin          
           Result := True;         
           h := High(t);
           for x := 0 to h do
             TIAAppend(Slots, MSSL_BGConvertPointToID(PRSC_Inventory.slot, t[x]));
           SetLength(t, 0);
         end; 
       finally
         b.Free;  
       end;
     end;          
     if Result then
       SortTIA(Slots);     
   end;
end;

function AteFood: Boolean;
var
 h, c, e, t: Integer;
 p: TPoint;
 fs: TIntArray;
 b: TBoxArray;
 a: Boolean; 
begin
 if FoodFound(fs) then
 begin 
   b := MSSL_BGGetBoxesEx(PRSC_Inventory.slot, fs);
   SetLength(fs, 0); 
   t := GetSystemTime;
   repeat 
     PRSC_Wait(0); 
     Result := (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP);
     h := High(b);
     if not Result then
       if ((h > -1) and PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY)) then
       begin
         p := MSSL_BoxCenter(b[h]);
         p.X := ((p.X - 5) + Random(11));
         p.Y := ((p.Y - 3) + Random(7));
         c := GetColor(p.X, p.Y);
         MSSL_ClickAt(p.X, p.Y, mbLeft);
         e := GetSystemTime; 
         repeat
           a := (GetColor(p.X, p.Y) <> c);
           if a then
             Delete(b, h, 1);
           PRSC_Wait(10);  
         until (a or ((GetSystemTime - e) > 1000)); 
       end;
     if ((GetSystemTime - t) > 30000) then
       Warning('EATING FUCKED UP!');       
   until (Result or (h < 0) or ((GetSystemTime - t) > 30000)); 
   if (h < 0) then
     Warning('Out of FOOD!'); 
 end else
   Warning('Out of FOOD!');
end;

procedure SetupScript;
begin
 MSSL_Setup;     
 bmpSwordfish := TSCARBitmap.Create('deNrjYeBg6AroIoiq3auxImLUkIpS' +
   'rVPphkIMQwgiAIvibNU=');
 bmpLobster := TSCARBitmap.Create('deNrjYeBg6PMFoQJbKKp3ZXA11wGS88' +
   'IQCMhdGwdCQJUQETgDzgXKApUhiwNNg3MhxkLMh9gIkYJYDeECFUjwsCOrgZsA' +
   'ZwOleNlBJLI5yMogjgciiDkxRthNgBgCtxqZAXcqUA2QBADOwEsK');
 bmpTuna := TSCARBitmap.Create('deNrjYeBgmF1SQiqqjolBQ5jimOohDFxGI' +
   'YtgakRGXRkZcNMgDKAIVgSUxSUFl8X0CxoCAB7Hgzo=');                                                                      
 bmpMeat := TSCARBitmap.Create('deNrjZOBkmOqlSipaE6aNVRCCsIoTL4hVnAxH4' +
   'kEAb0JUQw==');
 PRSC_Wait(1000);  
 chickenColors := [CHICKEN_COLOR1, CHICKEN_COLOR2, CHICKEN_COLOR3, CHICKEN_COLOR4, CHICKEN_COLOR5];
 centerPoint := MSSL_AreaCenter(0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)); 
 lastAttackTM := GetSystemTime;  
end;

begin
 SetupScript;      
 Wait(1000);  
 repeat      
   PRSC_Wait(0);
   if ((GetSystemTime - lastAttackTM) >= IDLE_WARN) then
     Warning('IDLE...');
   if PRSC_LoggedIn then
   begin 
     if not macroOptionsSet then
     begin           
       PRSC_Wait(1000);
       macroOptionsSet := PRSC_SetMacroOptions;
       MSSL_ClickAt(((centerPoint.X - 3) + Random(7)), ((centerPoint.Y - 2) + Random(5)), mbRight);
       PRSC_Wait(550 + Random(50));
       PRSC_ChooseOptionUse('Walk here');  
     end;     
     if not PRSC_Sleeping then
       if PRSC_GetFatigue(fatiguePercent) then
       begin
         if (fatiguePercent < 100) then
         begin    
           if (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) <= LOW_HP) then
           begin
             repeat        
               if not AteFood then
                 Warning('Low HP and we failed to eat food!');
               PRSC_Wait(10);
             until ((PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP) or not PRSC_LoggedIn);
           end else     
             if not PRSC_InFight then
             begin            
               MoveMouse((300 + Random(6)), (10 + Random(15)));
               FightChicken;
             end else
               HandleCombat;
           PRSC_Wait(10);    
         end else
           Warning('Fatigue full!');
       end else
         MoveMouse((300 + Random(6)), (10 + Random(15)));
     PRSC_Wait(10);
   end else
     if ((USERNAME <> '') and (PASSWORD <> '')) then
       PRSC_LogIn(USERNAME, PASSWORD)
     else
       Warning('Not logged in.');                        
 until GetKeyState(STOP_FKEY);  
end.

 

That works smoothly for chickens. :)

Edited by Janilabo
Link to comment
Share on other sites

I think chickens will always be visible, at least in private servers.. I have been using it and even with 1-shotting there are always chickens.

 

I think it would be a better option to pick up feathers and bones from the spot that you killed the mob, maybe the same X,Y that the mob was clicked.

Link to comment
Share on other sites

Hey I get this error access violation at address 00F5D682 in module scar.exe

 

Theres an error with this statement in text.scar line 395

begin

b := CreateBitmapFromText('Choose option', PRSC_MainFont, 16776960);

 

 

not sure what the problem is, thanks for your awesome work.

Link to comment
Share on other sites

Hey I get this error access violation at address 00F5D682 in module scar.exe

 

Theres an error with this statement in text.scar line 395

begin

b := CreateBitmapFromText('Choose option', PRSC_MainFont, 16776960);

 

 

not sure what the problem is, thanks for your awesome work.

Hello laive, do you get that error in the start up or during script runtime?
Link to comment
Share on other sites

Hmm hmmm.. That means a problem with SCAR's OCR. :S I have never faced that one.

 

Which version of MSSL do you have? Have you updated it to the latest? (From SCAR Divi => Include's Manager)

And which version of SCAR Divi are you using?

 

laive, which Windows version?

Also, webclient or standalone? (If standalone, please try with webclient)

Edited by Janilabo
Link to comment
Share on other sites

I didnt go to SCAR Divi includes manager, cant find that. Im using the newest one 3.35/ The MSSL i have is the one on that respot you had linked, i had to save each file on its own and move it to the folder. Windows is 7 and im using standalone, ill try webclient.

 

 

EDIT: I updated MSSL to 0.99, i found the includes manager

 

EDIT: Fixed :) Thanks! Concerning the sleeping bag what is the best thing to do, use leosleeper?

Edited by laive
Link to comment
Share on other sites

laive, it will alarm with PlaySound() at 100% fatigue (just set it so that you can hear the alarm sound, so you can then manually sleep).

There is no working OCR for sleeping in PRSC as of yet. :( (LeoSleep is broken)

 

If you find working OCR, let me know about it and I will add support for that! :P

 

-Jani

Link to comment
Share on other sites

I tried adding new foods to the list but I must be doing something wrong because he doesn't eat when he bots. So could I get any pointers? Thanks
\

 

Adding food,

 

Step 1. At the top add a new variable for your food, in this case bmpNEWFOOD

var
 alarmTM, lastAttackTM, fatiguePercent: Integer;
 bmpSwordfish, bmpTuna, bmpNEWFOOD, bmpLobster: TSCARBitmap;

 

Step 2

Add a new free step on script terminate.

 

procedure ScriptTerminate;
begin
 PlaySound(ScriptPath + 'empty.wav');
 PRSC_RotateCamera(rcd_Nil3);  
 bmpSwordfish.Free;
 bmpLobster.Free;
 bmpTuna.Free;
 bmpNEWFOOD.Free;
 MSSL_Unsetup; 
 SetLength(cowColors, 0);
end;

 

Step 3

add another step to the FoodFound function. Notice i changed 2 to a 3 in the for line. (4 options of food)

 

for i := 0 to 3 do
     begin 
       PRSC_Wait(0); 
       case i of
         0: b := bmpSwordfish.Clone;
         1: b := bmpLobster.Clone;
         2: b := bmpTuna.Clone;
         3: b := bmpNEWFOOD.Clone;
       end;  

 

Step 4

add the newfood bitmap to the scriptsetup function

 

bmpNEWFOOD := TSCARBitmap.Create('STRING HERE'); 

 

get the string from the bitmap selector in scar

Link to comment
Share on other sites

*** [01:46:49(:157)] Massive SCAR Scripting Library v0.99 Beta STARTED - process took 2075 msec! ***

MSSL Terminate: Problem with Project RSC client!

Stopped execution (2103.9428 ms)

 

Compiler Hint Line 20 Variable 'T' Never Used

Compiler Hint Line 146 Variable 'T' Never Used

Internal Error Line 1 [PS] Internal Error While Running.

 

Scar Divi 3.35, what do?

Link to comment
Share on other sites

{$DEFINE PRSC}

{$I MSSL\MSSL.scar}

const        
 USERNAME = 'nigger';
 PASSWORD = 'nigger';
 COMBAT_STYLE = PRSC_COMBAT_STYLE_STRENGTH; // PRSC_COMBAT_STYLE_(STRENGTH, DEFENSE, ATTACK, MULTI)
 LOW_HP = 25; // Runs away from combat and eats with this hp.
 CAMERA_ROTATION = True; // Rotate camera when NPCs arent found at screen? True = YES, False = NO.
 COW_COLOR1 = 14342875; // Rat colors. Only re-set these, when/if needed (with color updates).
 COW_COLOR2 = 4934475;
 COW_COLOR3 = 4079166;
 STOP_FKEY = VK_F12; // Stop F-key. Use VK_F1 - VK_12.
 ATTACK_INTERVAL = 10000; // Time before it starts looking for new cow, if player didnt get in fight.
 IDLE_WARN = 120000; // Warns if X-amount of milliseconds has passed since last attack.
                     // 1000 ms. = 1 s. 10000 ms. = 10 s. 60000 ms. = 60 s. 90000 ms. = 90 s.
 BLOCK_CHAT_MESSAGES = False;
 BLOCK_PRIVATE_MESSAGES = True;
 BLOCK_TRADE_REQUESTS = False;

var
 alarmTM, lastAttackTM, fatiguePercent, checkSkill, lastXP: Integer;
 bmpSwordfish, bmpTuna, bmpLobster: TSCARBitmap;
 cowColors: TIntArray;
 centerPoint: TPoint;
 macroOptionsSet: Boolean;

procedure ScriptTerminate;
begin
 PlaySound(MSSL_MSSLPath + '\Audio\empty.wav');
 PRSC_RotateCamera(rcd_Nil3);  
 bmpSwordfish.Free;
 bmpLobster.Free;
 bmpTuna.Free;
 MSSL_Unsetup; 
 SetLength(cowColors, 0);
end;

procedure Warning(msg: string);
begin
 if ((GetSystemTime - alarmTM) >= 12000) then
 begin     
   ClearDebug;
   WriteLn('WARNING: ' + msg);
   PlaySound(MSSL_MSSLPath + '\Audio\siren.wav');
   alarmTM := GetSystemTime;
 end;            
end;

function FindCow(var x, y: Integer): Boolean;
var
 TPA: TPointArray;
 ATPA: T2DPointArray;
 t: Integer;
begin
 PRSC_Wait(0);
 if not PRSC_LoggedIn then
   Exit;           
 MoveMouse((300 + Random(6)), (10 + Random(15)));
 t := GetSystemTime;
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Random3);
 repeat
   if (CountColors(cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) > 500) then
     if FindColorsSpiralEx(RandomRange(136, 377) , RandomRange(90, 214), TPA, cowColors, 0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)) then
     begin           
       ATPA := SplitTPA(TPA, 15); 
       SetLength(TPA, 0); 
       MSSL_ATPAFilterSizeMin(ATPA, 500); 
       if (Length(ATPA) > 0) then
       begin
         SortATPAByMiddleEx(ATPA, centerPoint);
         Result := TPAMiddleEx(ATPA[0], x, y);
         SetLength(ATPA, 0);
       end;
     end; 
   PRSC_Wait(0);     
 until (Result or ((GetSystemTime - t) > 60000));  
 if CAMERA_ROTATION then
   PRSC_RotateCamera(rcd_Nil3);  
end;

function AttackedCow: Boolean;
var
 x, y: Integer;
begin
 if not PRSC_LoggedIn then
   Exit;
 PRSC_Wait(0);  
 lastXP := PRSC_GetSkillAmount(checkSkill, sam_TotalXP);
 if FindCow(x, y) then 
 begin  
   MSSL_MoveAt(((x - 2) + Random(5)), ((y - 2) + Random(5)));
   PRSC_Wait(20 + Random(15));
   if PRSC_UpTextContains('cow (level-8)') then
   begin
     MSSL_Click(mbRight);
     PRSC_Wait(35 + Random(15));
     Result := PRSC_ChooseOptionUse('cow (level-8)');
     if not Result then
       if PRSC_ChooseOptionInUse(x, y) then 
         MSSL_Click(mbRight);
   end;
 end;
end;

procedure HandleCombat;
var
 cs, hp, tm: Integer; 
begin
 repeat     
   PRSC_Wait(0);
   if not PRSC_LoggedIn then
     Exit;
   if PRSC_InFight then
   begin 
     if PRSC_GetCombatStyle(cs) then
       if (cs <> COMBAT_STYLE) then
         PRSC_SetCombatStyle(COMBAT_STYLE);
     if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
     begin   
       hp := PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current);
       if (hp > -1) then
         if (hp <= LOW_HP) then
           if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
           begin
             PRSC_Wait(50);
             tm := GetSystemTime;
             repeat        
               ClickMouse(431, 112, mbLeft);
               PRSC_Wait(100);
             until (((GetSystemTime - tm) > 60000) or not PRSC_InFight);
           end;
     end;
   end;        
 until not PRSC_InFight;                 
end;

procedure FightCow;
var
 m, t: Boolean;
 x, y, tm: Integer;
begin
 PRSC_Wait(0);
 if not PRSC_LoggedIn then
   Exit;   
 if AttackedCow then
 begin   
   tm := GetSystemTime;
   repeat  
     if not PRSC_InFight then
       if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
         m := MSSL_AnimationEx(PRSC_MinimapBx, 50, 300, 800);  
     if not m then
       if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
         if (PRSC_GetSkillAmount(checkSkill, sam_TotalXP) > lastXP) then
           Exit;   
     PRSC_Wait(0);
   until (m or PRSC_InFight or ((GetSystemTime - tm) > 600));
   tm := GetSystemTime;
   m := False;
   repeat        
     if not PRSC_InFight then
       if PRSC_OpenGameTab(PRSC_GAMETAB_MAP) then
         m := not MSSL_AnimationEx(PRSC_MinimapBx, 50, 300, 800);
     if not m then
       if PRSC_OpenGameTab(PRSC_GAMETAB_STATS) then
         if (PRSC_GetSkillAmount(checkSkill, sam_TotalXP) > lastXP) then
           Exit;         
     PRSC_Wait(0);
   until (m or PRSC_InFight or ((GetSystemTime - tm) > ATTACK_INTERVAL));
   lastAttackTM := GetSystemTime;
   if PRSC_InFight then
     HandleCombat;  
 end else
   if PRSC_ChooseOptionInUse(x, y) then
     PRSC_Click(x, y, 0, 0, mbRight);
end;

function FoodFound(var Slots: TIntArray): Boolean;
var
 h, x, i: Integer;
 t: TPointArray;
 b: TSCARBitmap;
begin
 SetLength(Slots, 0);
 PRSC_Wait(0);
 if PRSC_LoggedIn then
   if PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY) then
   begin 
     for i := 0 to 2 do
     begin 
       PRSC_Wait(0); 
       case i of
         0: b := bmpSwordfish.Clone;
         1: b := bmpLobster.Clone;
         2: b := bmpTuna.Clone;
       end;   
       try               
         if FindBitmapEx(t, b, 264, 36, 508, 239) then
         begin          
           Result := True;         
           h := High(t);
           for x := 0 to h do
             TIAAppend(Slots, MSSL_BGConvertPointToID(PRSC_Inventory.slot, t[x]));
           SetLength(t, 0);
         end; 
       finally
         b.Free;  
       end;
     end;          
     if Result then
       SortTIA(Slots);     
   end;
end;

function AteFood: Boolean;
var
 h, c, e, t: Integer;
 p: TPoint;
 fs: TIntArray;
 b: TBoxArray;
 a: Boolean; 
begin
 if FoodFound(fs) then
 begin 
   b := MSSL_BGGetBoxesEx(PRSC_Inventory.slot, fs);
   SetLength(fs, 0); 
   t := GetSystemTime;
   repeat 
     PRSC_Wait(0); 
     Result := (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP);
     h := High(b);
     if not Result then
       if ((h > -1) and PRSC_OpenGameTab(PRSC_GAMETAB_INVENTORY)) then
       begin
         p := MSSL_BoxCenter(b[h]);
         p.X := ((p.X - 5) + Random(11));
         p.Y := ((p.Y - 3) + Random(7));
         c := GetColor(p.X, p.Y);
         MSSL_ClickAt(p.X, p.Y, mbLeft);
         e := GetSystemTime; 
         repeat
           a := (GetColor(p.X, p.Y) <> c);
           if a then
             Delete(b, h, 1);
           PRSC_Wait(10);  
         until (a or ((GetSystemTime - e) > 1000)); 
       end;
     if ((GetSystemTime - t) > 30000) then
       Warning('EATING FUCKED UP!');       
   until (Result or (h < 0) or ((GetSystemTime - t) > 30000)); 
   if (h < 0) then
     Warning('Out of FOOD!'); 
 end else
   Warning('Out of FOOD!');
end;

procedure SetupScript;
begin
 MSSL_Setup;     
 PRSC_Wait(0);
 case COMBAT_STYLE of
   1: checkSkill := 2;
   2: checkSkill := 0;
   3: checkSkill := 1;
 else
   checkSkill := 2;
 end;
 PRSC_BlockChatMessages := BLOCK_CHAT_MESSAGES;
 PRSC_BlockPrivateMessages := BLOCK_PRIVATE_MESSAGES;
 PRSC_BlockTradeRequests := BLOCK_TRADE_REQUESTS;     
 bmpSwordfish := TSCARBitmap.Create('deNrjYeBg6AroIoiq3auxImLUkIpS' +
   'rVPphkIMQwgiAIvibNU=');
 bmpLobster := TSCARBitmap.Create('deNrjYeBg6PMFoQJbKKp3ZXA11wGS88' +
   'IQCMhdGwdCQJUQETgDzgXKApUhiwNNg3MhxkLMh9gIkYJYDeECFUjwsCOrgZsA' +
   'ZwOleNlBJLI5yMogjgciiDkxRthNgBgCtxqZAXcqUA2QBADOwEsK');
 bmpTuna := TSCARBitmap.Create('deNrjYeBgmF1SQiqqjolBQ5jimOohDFxGI' +
   'YtgakRGXRkZcNMgDKAIVgSUxSUFl8X0CxoCAB7Hgzo=');      
 cowColors := [COW_COLOR1, COW_COLOR2, COW_COLOR3];
 centerPoint := MSSL_AreaCenter(0, 0, (PRSC_APPLET_WIDTH - 1), (PRSC_APPLET_HEIGHT - 1)); 
 lastAttackTM := GetSystemTime;  
end;

begin
 SetupScript;        
 repeat      
   PRSC_Wait(0);
   if ((GetSystemTime - lastAttackTM) >= IDLE_WARN) then
     Warning('IDLE...');
   if PRSC_LoggedIn then
   begin 
     if not macroOptionsSet then
     begin           
       PRSC_Wait(100);
       macroOptionsSet := PRSC_SetMacroOptions;
       MSSL_ClickAt(((centerPoint.X - 3) + Random(7)), ((centerPoint.Y - 2) + Random(5)), mbRight);
       PRSC_Wait(550 + Random(50));
       PRSC_ChooseOptionUse('Walk here');  
     end;     
     if not PRSC_Sleeping then
       if PRSC_GetFatigue(fatiguePercent) then
       begin
         if (fatiguePercent < 100) then
         begin    
           if (PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) <= LOW_HP) then
           begin
             repeat        
               if not AteFood then
                 Warning('Low HP and we failed to eat food!');
               PRSC_Wait(10);
             until ((PRSC_GetSkillAmount(PRSC_SKILL_HITS, sam_Current) > LOW_HP) or not PRSC_LoggedIn);
           end else     
             if not PRSC_InFight then
             begin            
               MoveMouse((300 + Random(6)), (10 + Random(15)));
               FightCow;
             end else
               HandleCombat;
           PRSC_Wait(10);    
         end else
           Warning('Fatigue full!');
       end else
         MoveMouse((300 + Random(6)), (10 + Random(15)));
     PRSC_Wait(10);
   end else
     if ((USERNAME <> '') and (PASSWORD <> '')) then
       PRSC_LogIn(USERNAME, PASSWORD)
     else
       Warning('Not logged in.');                        
 until GetKeyState(STOP_FKEY);  
end. 

Edited by moaL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...