Code:
program EldevinCombat30;
(* Pascal programming language
___________________________
Name: Eldevin Combat 3.0
Date: 02/01/2016
Next: V3.1 on/before 02/05/2016
Created by: Kevin
Base Credits: EldevinFighterReloaded
*)
(* Calls *)
{$I SRL-OSR/SRL.simba}
//{$I SRL-OSR/SRL/misc/al_functions.simba}
(* Procedures *)
procedure JAM_InteractKeys(Action: string; SleepTime: Integer);
begin
TypeSendEx(Action, False);
Sleep(Sleeptime + random(150));
end;
procedure JAM_InteractNPC(Action: string);
begin
TypeSendEx('\', False);
Sleep(250 + Random(25));
TypeSendEx(Action, False);
Sleep(250 + Random(50));
end;
(* Functions *)
(* JAM Traits *)
function JAM_HighHP: Boolean; //Checks if health is full.
begin
result := (GetColor(371, 924) = 857797 );
end;
function JAM_MidHP: Boolean; //Checks if health is below fifty percent.
begin
result := (GetColor(400, 920) = 1776412 );
end;
function JAM_LowHP: Boolean; //Checks if health is below twenty-five percent.
begin
result := (GetColor(440, 920) = 1776412 );
end;
function JAM_Dead: Boolean; //Checks if health is empty.
begin
result := (GetColor(471, 916) = 1908513 );
end;
function JAM_Mana: Boolean; //Checks if mana is low.
begin
result := (GetColor(500, 920) = 1776412 );
end;
function JAM_LogBackIn: Boolean; //Checks if player needs to log back in.
begin
result := (GetColor(110, 180) = 1710361 );
end;
(* NPC Traits *)
function NPC_HighHP: Boolean; //Checks if NPC health is high.
begin
result:= (GetColor(520,180) = 1313692 );
end;
function NPC_LowHP: Boolean; //Checks if NPC health is low.
begin
result := (GetColor(395, 180) = 1710361 );
end;
(* Main Loop *)
procedure MainLoop;
begin
if JAM_LowHP() then //If players health is low, heal until full.
begin
WriteLn('Players health is low, begin healing loop.');
repeat
if JAM_Dead() then //If player dies, alerts host.
begin
WriteLn('Player has died, alerting host, then terminates script.');
MoveMouse(115, 30);
Wait(500);
ClickMouse(115, 30, mouse_Left);
Wait(1000);
MoveMouse(550, 100);
Wait(500);
ClickMouse(550, 100, mouse_Left);
Wait(1000);
TerminateScript()
end;
JAM_InteractKeys('-', 1100);
JAM_InteractKeys('0', 2300);
JAM_InteractKeys('5', 1500);
JAM_InteractKeys('0', 2300);
JAM_InteractKeys('6', 1300);
until (JAM_HighHP);
end;
if JAM_MidHP() then //If players health is past caution, heal.
begin
WriteLn('Health is below caution point, restoring now.');
JAM_InteractKeys('0', 2500);
JAM_InteractKeys('5', 1500);
JAM_InteractKeys('2', 2000);
end;
if JAM_LogBackIn() then //If player has logged out, logs back in.
begin
WriteLn('Player logged out, logging back in.');
MoveMouse(670, 670);
Wait(500);
ClickMouse(670, 670, mouse_Left);
Sleep(15000);
end;
if JAM_Mana() then //If players mana is low, restore.
begin
WriteLn('Players mana is low, restoring.');
JAM_InteractKeys('`', 1000);
end;
if NPC_LowHP() then //After you complete a kill, heal (could drain mana fast).
begin
WriteLn('Begin caution healing, may drain mana.');
JAM_InteractKeys('0', 2500);
end;
if NPC_HighHP() then //If NPC health is high, use different ability.
begin
WriteLn('NPC health is high, activating secondary attack.');
Wait(1000);
JAM_InteractKeys('e', 250);
JAM_InteractKeys('2', 1500);
end;
//After processing, begins combat.
begin
WriteLn('Processing Complete, begin combat.');
Wait(500);
JAM_InteractNPC('e');
Wait(500);
JAM_InteractNPC('1');
end;
end;
begin //Repeats the process, if the script is still active.
MouseSpeed := 25;
SetDesktopAsClient();
Sleep((2000 + random(200)));
ActivateClient();
repeat
MainLoop();
Sleep(500);
until (false);
end;
I am aware that the comments in here make it "messy", but they help newcomers see what's going on. I know there are multiple things I can change, and improve. But I am still working on this, and I plan to improve it even more!