>>Vampire<<
04-13-2009, 08:24 AM
I taked my names and passwords out..
{===============================Script Info====================================|
| ScriptName = Narcle's Autofight |
| Author = Narcle |
| Description = Fights any monster: Melee & Ranging |
| Version = 0.91 |
| Date = 8/28/08 |
| SRL Version = 4.0 Rev 23 |
| SCAR Divi = 3.15 |
|================================================= =============================|
| Instructions. |
|================================================= =============================|
| Make sure File access is set to "Allow All" to do this go: |
| Tools > Options... > FiLewall settings > check "Allow All" > hit OK |
| |
| Please let this script connect to narcle.100webspace.net for NEWS |
| |
| Instructions are now on the thread to prevent leechers. |
| |
| Credits: |
| HyperSecret, Chitin, nose_smasher, Logik, Versace, Cruel100 |
|_________________________________________________ _____________________________}
{.include srl/srl/misc/Smart.scar}
{.include srl/srl.scar}
{.include srl/srl/misc/Users.scar}
var PickupColors: array of integer; PickupNames, DropAllBut, AmmoEquip: array of string;
const
{------------------------------------------------------------------------------}
{===============================Player Setup===================================}
{------------------------------------------------------------------------------}
//SRL - Stats
MySRLID = '';//example: ''<---real i have it
MySRLPassword = '';//example: ''<---real i have it
UseForm = false;//Use form? [true/false]
LogoutEvery = 9;//Logout and back in every ? minutes. (9-14 is best)
UseFileLogging = true;//This will keep a record of your fighting on computer, will also keep your SRL id & password now.
FileLogStats = false;//Show your current stats on startup of script.
//SMART setup
WorldNumber = 59;
//Sleeping / Breaking options:
TakeBreaks = true;//Take 5-15 min breaks every 1-3 hours?
TakeSleeps = false;//Take couple hour sleeps?
SleepAt = '23:30';//In Military time! Must be in 'hh:mm' format.
//Advance options:
FindMobByMM = false;//Clicks to closes mob on Minimap
DebugMode = false;//debug mode
UseReportWin = false;//Use report window for status?
RightClickOnly = false;//Use right click attacking only?
//Pick-ups:
PickUpPriority = true;//pick up even while in combat?
PickupTol = 3;//Color tolerance for picking up items
//Inventory Management
DropCrap = false;
BuryBones = true;
EquipAmmo = false;
procedure DeclarePlayers;
begin
//Custom Pickup
PickupColors := []; //edit here
PickupNames := ['charm', 'oin', 'rune']; //edit here
{ Example:
PickupColors := [2130543,1035462,4641275]
PickupNames := ['rimy','ranarr','rune','oin','rrow','ones']
}
//Inventory Management
DropAllBut := ['ones', 'oin', 'rune','rrow']//names of items not to drop [drops everything else]
AmmoEquip := []//full name perfect spelling, ['Equips 1st', 'Equips 2nd'] etc.
if not(UseForm) then
begin
{================================================= =====}
{!!!!! If UseForm = true then this does not APPLY !!!!!}
{================================================= =====}
HowManyPlayers := 1;//Change this accordinly
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Character Name<-----real i have it
Players[0].Pass := ''; //Character Pass<----real i have it
Players[0].Nick := ''; //Nickname 3 - 4 Letter's of char name<--real i have it but always reads:WARNING : Nick does NOT match the name.
Players[0].Active := True; //Use player in script?
Players[0].Booleans[0] := false;//Toggle Pickups?
Players[0].Booleans[1] := false;//Inventory management?
Players[0].Booleans[2] := false;//Use Special?
Players[0].Strings[0] := '';//Monster Colors<---real i have it
Players[0].Strings[1] := '';//Monster Name(s) 'giant uard oblin'<---real i have it
Players[0].Strings[2] := 'defence'; //> strength, attack, defence, pure, even, accurate, rapid or longrange <
Players[0].Strings[3] := 's';//Player run direction > n, e, s, w <
{
Players[1].Name := ''; //Character Name
Players[1].Pass := ''; //Character Pass
Players[1].Nick := ''; //Nickname 3 - 4 Letter's of char name
Players[1].Active := True; //Use player in script?
Players[0].Booleans[0] := false;//Toggle Pickups?
Players[0].Booleans[1] := false;//Inventory management?
Players[0].Booleans[2] := false;//Use Special?
Players[1].Strings[0] := '';//Monster Colors '231234 1243123 123123'
Players[1].Strings[1] := '';//monster Name(s) 'giant uard oblin'
Players[1].Strings[2] := 'even'; //> strength, attack, defence, pure, even, accurate, rapid or longrange <
Players[1].Strings[3] := 's';//Player run direction > n, e, s, w <
}
{
Players[2].Name := ''; //Character Name
Players[2].Pass := ''; //Character Pass
Players[2].Nick := ''; //Nickname 3 - 4 Letter's of char name
Players[2].Active := True; //Use player in script?
Players[0].Booleans[0] := false;//Toggle Pickups?
Players[0].Booleans[1] := false;//Inventory management?
Players[0].Booleans[2] := false;//Use Special?
Players[2].Strings[0] := '';//Monster Colors '231234 1243123 123123'
Players[2].Strings[1] := '';//monster Name(s) 'giant uard oblin'
Players[2].Strings[2] := 'even'; //> strength, attack, defence, pure, even, accurate, rapid or longrange <
Players[2].Strings[3] := 's';//Player run direction > n, e, s, w <
}
{
Players[3].Name := ''; //Character Name
Players[3].Pass := ''; //Character Pass
Players[3].Nick := ''; //Nickname 3 - 4 Letter's of char name
Players[3].Active := True; //Use player in script?
Players[0].Booleans[0] := false;//Toggle Pickups?
Players[0].Booleans[1] := false;//Inventory management?
Players[0].Booleans[2] := false;//Use Special?
Players[3].Strings[0] := '';//Monster Colors '231234 1243123 123123'
Players[3].Strings[1] := '';//monster Name(s) 'giant uard oblin'
Players[3].Strings[2] := 'even'; //> strength, attack, defence, pure, even, accurate, rapid or longrange <
Players[3].Strings[3] := 's';//Player run direction > n, e, s, w <
}
{
Players[4].Name := ''; //Character Name
Players[4].Pass := ''; //Character Pass
Players[4].Nick := ''; //Nickname 3 - 4 Letter's of char name
Players[4].Active := True; //Use player in script?
Players[0].Booleans[0] := false;//Toggle Pickups?
Players[0].Booleans[1] := false;//Inventory management?
Players[0].Booleans[2] := false;//Use Special?
Players[4].Strings[0] := '';//Monster Colors '231234 1243123 123123'
Players[4].Strings[1] := '';//monster Name(s) 'giant uard oblin'
Players[4].Strings[2] := 'even'; //> strength, attack, defence, pure, even, accurate, rapid or longrange <
Players[4].Strings[3] := 's';//Player run direction > n, e, s, w <
}
{------------------------------------------------------------------------------}
{========================Don't touch Below this!===============================}
{------------------------------------------------------------------------------}
end else
begin
SRLPlayerForm(True, ['Toggle Pickups', 'Inv Manage', 'Use Special'], [], ['Monster Colors','Monster Name (tack)', 'Skill to train (even)','Run Direction (s)'], []);
end;
end;
const
Version = '0.91';
ScriptINIid = 'NAFFight';
ScriptName = 'Narcle''s AutoFight';
DebugName = 'NAF';
var
TArrowAmount,Txp,TKilled,TFoodate,Titemspicked,TBo nesBuried:integer;//Total Stats
StartXP, ArrowStartAmount:integer;//Stats
LogoutTime, MobTackTime, RoundTimer, RanCheckTime, BreakTime:integer;//Timers
Hoverskillis, CurrentRunDir, CurrentStyle:string;//Various Strings
ColorArray: array of integer;//Monster color array
NameArray: array of String;//Monster name array
procedure LogoutSeq(reason:string); forward;
function NInFight: Boolean;
var
x, y : Integer;
begin
Result := (FindColor(x, y, 65280, 242, 142, 283, 158) or
FindColor(x, y, 255, 242, 142, 283, 158));
end;
function MouseInvTextCustom(istextup: TStringArray; option:string; waitt, times:integer; IsUp: Boolean; Action :fnct_ActionOptions): integer;
var
i,x,y:integer;
leftclick: boolean;
begin
gametab(4);
if Action = ClickLeft then leftclick := true;
if Action = ClickRight then leftclick := false;
for i := 1 to 28 do
if (ExistsItem(i)) then
begin
if NInFight then
Exit;
MMouseItem(i);
GetMousePos(x, y);
wait(100+random(50));
if IsUp then if (IsUpTextMultiCustom(istextup)) then
begin
if not (Action = Nothing) then Mouse(x,y,0,0,leftclick);
if Action = Nothing then result := result+1;
if Action = ClickLeft then result := result+1;
if Action = ClickRight then if Chooseoption(option) then result := result+1;
if not (Action = Nothing) then wait(waitt+random(100));
end;
if not(IsUp) then if not(IsUpTextMultiCustom(istextup)) then
begin
if not (Action = Nothing) then Mouse(x,y,0,0,leftclick);
if Action = Nothing then result := result+1;
if Action = ClickLeft then result := result+1;
if Action = ClickRight then if Chooseoption(option) then result := result+1;
if not (Action = Nothing) then wait(waitt+random(100));
end;
if (result = times) then exit;
end;
end;
procedure NoID;
begin
ClearDebug;
if (MySRLPassword = '') and not(MySRLID = '') then writeln('You need a ID & password entered.');
writeln('To set up a SRL stats ID go here: http://www.stats.srl-forums.com');
Disguise('No more leeching');
ShowMessage('Please register at SRL-stats to use this script' +Chr(13)+
'To set up a SRL stats ID go here: '+Chr(13)+' http://www.stats.srl-forums.com'+Chr(13)+
+Chr(13)+' -Narcle');
end;
procedure NarcSig;
var
I,II:integer;
s:string;
begin
Disguise('Sig Call');
ChangeReportWidth(255);
Status('Signature call; Watch the report box!');
for I := 0 to 57 do
begin
clearreport;
for II := 0 to 5 do
Addtoreport(s+'||');
wait(30);
if I < 29 then s := s + ' ' else delete(s, Length(s), 1);
end;
for I := 1 to 29 do
begin
ClearReport;
AddtoReport(Left(' _ _ _ ', I));
AddtoReport(Left('| \ | | made by | | ', I));
AddtoReport(Left('| \| | __ _ _ __ ___| | ___ ', I));
AddtoReport(Left('| . ` |/ _` | ''__/ __| |/ _ \', I));
AddtoReport(Left('| |\ | (_| | | | (__| | __/', I));
AddtoReport(Left('|_| \_|\__,_|_| \___|_|\___|', I));
wait(50);
end;
AddtoReport(ScriptName+' v'+Version);
end;
procedure ScriptNews;
var
i, len : Integer;
news: string;
begin
ClearDebug;
Status('Getting NEWS...');
try
news := GetPage('http://narcle.100webspace.net/'+DebugName+'/NEWS.txt');
if news = '' then
begin
writeln('#@ Failed to get News');
exit;
end;
Writeln('#@ NEWS '+Between('{da}','{te}', news)+ ' | Online version: '+Between('{ver}','{sion}', news));
Case Between('{sta}', '{tus}', news) of
'banage': Writeln('#@ Possible bug in script causing bans, recommend to stop autoing till fixed.');
'1bugged': Writeln('#@ Minor bug(s) in script, read forums/below for details.');
'2bugged': Writeln('#@ Major bug(s) in script, read forums/below for details.');
'urgent': Writeln('#@ Urgent News please read!');
'urgentforums': Writeln('#@ Urgent News please read the forums for details.');
'perfect': Writeln('#@ Script is working fine, report any problems via forums.');
end;
len := strtoint( Between('{len}','{gth}', news) );
for i := 0 to len do
writeln('## '+Between('{'+inttostr(i)+'}','{'+inttostr(i+1)+'} ', news) );
except
writeln('#@ Failed to get News');
exit;
end;
end;
procedure NarclesINI;
var
Killed,XPGained,Timeran:integer;
begin
Disguise('Watch SCAR!');
if not FileExists(AppPath+'Chars.ini') then
begin
WriteINI('NarclesINI', 'TTimeran', '0', AppPath+'Chars.ini');
Writeln('#@ File Logging is ON.');
WriteINI(ScriptINIid, 'Timeran', '0', AppPath+'Chars.ini');
WriteINI(ScriptINIid, 'YourKills', '0', AppPath+'Chars.ini');
WriteINI(ScriptINIid, 'XPGained', '0', AppPath+'Chars.ini');
WriteINI(ScriptINIid,'CurrentVersion',Version,AppP ath+'Chars.ini');
end else
begin
if ReadINI(ScriptINIid, 'Timeran', AppPath+'Chars.ini')='' then
WriteINI(ScriptINIid, 'Timeran', '0', AppPath+'Chars.ini');
if ReadINI(ScriptINIid, 'YourKills', AppPath+'Chars.ini')='' then
WriteINI(ScriptINIid, 'YourKills', '0', AppPath+'Chars.ini');
if ReadINI(ScriptINIid, 'XPGained', AppPath+'Chars.ini')='' then
WriteINI(ScriptINIid, 'XPGained', '0', AppPath+'Chars.ini');
if FileLogStats then
begin
Killed := strtoint(ReadINI(ScriptINIid, 'YourKills', AppPath+'Chars.ini'));
XPGained := strtoint(ReadINI(ScriptINIid, 'XPGained', AppPath+'Chars.ini'));
Timeran := strtoint(ReadINI(ScriptINIid, 'Timeran', AppPath+'Chars.ini'));
Writeln('## __ File Logging __');
Writeln('## Welcome back, you have ran '+ScriptName+' for '+inttostr(Timeran)+' minutes,');
Writeln('## Killed '+inttostr(Killed)+' Monsters, Gained '+inttostr(XPGained)+' XP');
end;
if not (ReadINI(ScriptINIid, 'CurrentVersion',AppPath+'Chars.ini') = Version) then
begin
WriteINI(ScriptINIid,'CurrentVersion',Version,AppP ath+'Chars.ini');
end;
end;
if not (MySRLID = '') and not(MySRLPassword = '') then
begin
if (ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini')='') then
begin
writeln('#@ Your SRL id & password for SRL-stats has been stored in Chars.ini');
writeln('## To update this just put in new MySRLid & MySRLpassword and push play');
writeln('## After this is done you won''t have to put it in again for newer versions');
end;
WriteINI('NarclesINI', 'SRLid', MySRLID, AppPath+'Chars.ini');
WriteINI('NarclesINI', 'SRLpassword', MySRLPassword, AppPath+'Chars.ini');
end;
if not(ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini')='') then
begin
SRLid := ReadINI('NarclesINI', 'SRLid', AppPath+'Chars.ini');
SRLPassword := ReadINI('NarclesINI', 'SRLpassword', AppPath+'Chars.ini');
writeln('#@ SRL id & password loaded from ini file.');
end;
wait(3000);
end;
procedure NarcDebug(ln:string);
begin
if (debugmode) then
WriteINI(TheDate(2), TheTime+' '+inttostr(getsystemtime)+' :', ' '+ln, AppPath+DebugName+'Debug.ini');
end;
function ActiveCount:integer;
var i:integer;
begin
for i := 0 to HowManyPlayers-1 do
if Players[i].Active then
result := result+1;
end;
function FightOnScreen: Boolean;
var
x,y:integer;
B:TBox;
begin
B:=IntToBox(240, 140, 285, 160);
result := FindColorSkipBox(x, y, 65280, MSX1, MSY1, MSX2, MSY2, B) or
FindColorSkipBox(x, y, 255, MSX1, MSY1, MSX2, MSY2, B);
end;
Function MobTPAs: TPointArray;
Var
TPA: TPointArray;
begin
FindColorsSpiralTolerance(MMCX, MMCY, TPA, 195836, MMX1, MMY1, MMX2, MMY2, 0);
If Length(TPA) < 1 Then
Exit;
RAaSTPA(TPA, 4);
SortTPAFrom(TPA, IntToPoint(MMCX, MMCY));
result := TPA;
end;
Function MobsOnScreen: integer;
var
i: integer;
TPA : TPointArray;
begin
TPA := MobTPAs;
for i := 0 to High(TPA) do
If InAbstractBox(590, 62, 656, 62, 646, 100, 600, 100, TPA[i].x, TPA[i].y) then
result := result + 1;
end;
function ChangeCamera: boolean;
var
i, II, PosNeg:integer;
begin
Case random(2) of
0: PosNeg := 1;
1: PosNeg := -1;
end;
i := Round(rs_GetCompassAngleDegrees/45 - 1);
if i < 0 then i := 0;
if i > 7 then i := 7;
For II := 0 to 7 do
begin
if (MobsOnScreen > 0) then
begin
result := true;
exit;
end;
i := i+PosNeg;
if i > 7 then i := 0;
if i < 0 then i := 7;
MakeCompass(inttostr(i*45));
end;
end;
procedure InvManagement;
begin
if Players[currentplayer].Booleans[1] then
begin
NarcDebug('Inv Management');
if BuryBones then
ReportVars[4] := ReportVars[4] + MouseInvTextCustom(['ones'], 'ury', 600, 28, true, ClickRight);
if EquipAmmo then
MouseInvTextCustom(AmmoEquip, 'eild', 550, 1, true, ClickRight);
if DropCrap then
MouseInvTextCustom(DropAllBut, 'rop', 550, 28, false, ClickRight);
ArrangeInv;
end;
end;
function GetArrowCount:integer;
begin
gametab(5);
result := GetAmount(666, 249);
end;
procedure Antiban;
begin
if not LoggedIn then Exit;
case Random(60) of
0: wait(500+random(10000));
1: begin
RandomMovement;
SetAngle(true);
end;
2: HoverSkill(Hoverskillis ,false);
3: PickUpMouse;
end;
end;
Function AFWait(Time: Integer): Boolean;
var
ti,t: Integer;
begin
if not(loggedin) then exit;
if time = 0 then Ti := 1 else Ti := Time;
begin
for T := 1 to Ti do
begin
if ( GetSystemTime > RanCheckTime ) then
begin
if FindNormalRandoms then
result:=true;
RanCheckTime := Getsystemtime + 120000+random(20000);
end;
if FindNonInventoryRandoms then
begin
FindInventoryRandoms;
result := true;
end;
if FindTalk then
Result := True;
if Time = 0 then exit else Wait(200 + Random(50));
end;
end;
end;
{************************************************* ******************************
function strToIntArrayEx(intArray, Separater : String) : Array of Integer;
By: moparisthebest and Ron modified by Narcle
Description: Loads a String into an array of integer.
************************************************** *****************************}
function strToIntArrayEx(intArray, Separater : String) : Array of Integer;
var
i, spacePos: Integer;
begin
try
repeat
SetArrayLength(Result, i + 1);
spacePos := Pos(Separater, intArray);
if (not (spacePos = 0)) then
Result[i] := StrToInt(Copy(intArray, 1, spacePos - 1))
else
begin
Result[i] := StrToInt(Copy(intArray, 1, Length(intArray)));
break;
end;
Delete(intArray, 1, spacePos);
i := i + 1;
until (False)
except
writeln('');
Writeln('Check your color setup, its incorrect.');
TerminateScript;
end;
for i := 0 to High(Result) do
begin
if Result[i] < 1 then
begin
swap(Result[i], Result[High(Result)])
SetArrayLength(Result, High(Result)-1);
end;
end;
end;
{************************************************* ******************************
function strToStrArrayEx(strArray, Separater : String) : Array of String;
By: moparisthebest and Ron modified by Narcle
Description: Loads a String into an array of String.
************************************************** *****************************}
function strToStrArrayEx(strArray, Separater : String) : Array of String;
var
i, spacePos: Integer;
begin
repeat
SetArrayLength(Result, i + 1);
spacePos := Pos(Separater, strArray);
if (not (spacePos = 0)) then
Result[i] := (Copy(strArray, 1, spacePos - 1))
else
begin
Result[i] := (Copy(strArray, 1, Length(strArray)));
Break;
end;
Delete(strArray, 1, spacePos);
i := i + 1;
until (False)
for i := 0 to High(Result) do
begin
if Result[i] = '' then
begin
swap(Result[i], Result[High(Result)])
SetArrayLength(Result, High(Result)-1);
end;
end;
end;
procedure CombatLookup;
var
x, y, i, T:integer;
Xarr, Yarr:array of integer;
TB: TBox;
TP: TPointArray;
begin
Xarr := [600, 685, 600, 685];
Yarr := [275, 275, 330, 330];
GameTab(1);
for i := 0 to 3 do
begin
MMouse(Xarr[i], Yarr[i], 7, 7);
T := GetSystemTime + 10000;
repeat
wait(50);
if GetSystemTime > T then Exit;
until FindColor(x, y, 10551295, 540, 205, 750, 465);
wait(200);
GetClientDimensions(TB.X2, TB.Y2);
TB.X1 := 0;
TB.Y1 := 0;
FindColorsTolerance(TP, 10551295, TB.X1, TB.Y1, TB.X2, TB.Y2, 0);
If Length(TP) = 0 Then Exit;
TB := GetTPABounds(TP);
//Writeln(Inttostr(TB.X1)+', '+inttostr(TB.Y1));
Players[currentplayer].Strings[i+50] := Lowercase(Between('(', ' XP', GetTextAtEx(TB.X1+2, TB.Y1+27, 0, SmallChars, False, True, 0, 1, -1, 30, False, tr_AllChars)));
if Players[currentplayer].Strings[i+50] = '' then
begin
Players[currentplayer].Strings[i+50] := Lowercase(Between('(', ' XP',
GetTextAtEx(TB.X1+2, TB.Y1+14, 0, SmallChars, False, True, 0, 1, 0, 20, False, tr_AllChars)));
end;
Writeln(Players[currentplayer].Strings[i+50]);
end;
end;
function CombatSelect(kind: string): boolean;
var
i:integer;
begin
for i := 0 to 3 do
if Lowercase(kind) = Players[currentplayer].Strings[i+50] then
begin
SetFightMode(i+1);
Hoverskillis := kind;
Result := true;
Exit;
end;
end;
procedure SetupPlayer;
Var
Mode, i:integer;
begin
if (not(LoggedIn)) then LoginPlayer;
Status('Setting up player: '+Players[CurrentPlayer].Name+'...');
MouseSpeed := RandomRange(11, 16);
ClickContinue(true,true);
if Not Players[CurrentPlayer].Booleans[9] then
begin
Players[CurrentPlayer].Integers[8] := MouseInvTextCustom(['Eat'],'Eat', 100, 28, true, Nothing);
Players[CurrentPlayer].Booleans[9] := true;
writeln('Food = '+inttostr(Players[CurrentPlayer].Integers[8]));
end;
if Players[CurrentPlayer].Strings[3] = '' then
CurrentRunDir := 's'
else
CurrentRunDir := lowercase(Players[CurrentPlayer].Strings[3]);
if Players[CurrentPlayer].Strings[2] = '' then
CurrentStyle := 'even'
else
CurrentStyle := lowercase(Players[CurrentPlayer].Strings[2]);
ColorArray := strToIntArrayEx(Players[CurrentPlayer].Strings[0], ' ');;
if (Players[CurrentPlayer].Strings[1] = '') then
begin
SetArrayLength(NameArray, 1);
NameArray[0] := 'tack';
end
else NameArray := strToStrArrayEx(Players[CurrentPlayer].Strings[1], ' ');
If (CurrentPlayer > 0) and (Players[CurrentPlayer].Strings[0]= '') then
begin
ColorArray := strToIntArrayEx(Players[0].Strings[0], ' ');
try
NameArray := strToStrArrayEx(Players[0].Strings[1], ' ');
except
SetArrayLength(NameArray, 1);
NameArray[0] := 'tack';
end;
end;
if High(ColorArray) < 2 then
begin
Logout;
Writeln('Error: Please enter at least 2 monster colors for player(s).');
terminatescript;
end;
GetAllLevels;
if Players[currentplayer].Strings[50] = '' then
begin
CombatLookup;
Players[currentplayer].Strings[60] := 'melee';
for i := 0 to 3 do
begin
if ( Players[currentplayer].Strings[i+50] = 'ranged' ) then
Players[currentplayer].Strings[60] := 'range';
if ( Players[currentplayer].Strings[i+50] = 'magic' ) then
Players[currentplayer].Strings[60] := 'magic';
end;
Writeln(Players[currentplayer].Strings[60])
end;
case Players[currentplayer].Strings[60] of
'melee': begin
case CurrentStyle of
'attack': mode := 1;
'strength': mode := 2;
'defence': mode := 3;
'even': begin
if (Players[CurrentPlayer].level[3] <= Players[CurrentPlayer].level[1]) and
(Players[CurrentPlayer].level[3] <= Players[CurrentPlayer].level[2]) then mode := 3;
if (Players[CurrentPlayer].level[1] <= Players[CurrentPlayer].level[3]) and
(Players[CurrentPlayer].level[1] <= Players[CurrentPlayer].level[2]) then mode := 1;
if (Players[CurrentPlayer].level[2] <= Players[CurrentPlayer].level[1]) and
(Players[CurrentPlayer].level[2] <= Players[CurrentPlayer].level[3]) then mode := 2;
end;
'pure': begin
if Players[CurrentPlayer].level[2]<15 then mode := 2 else
if Players[CurrentPlayer].level[1]<30 then mode := 1 else
if Players[CurrentPlayer].level[2]<25 then mode := 2 else
if Players[CurrentPlayer].level[1]<40 then mode := 1 else mode := 2;
end;
end;
Case mode of
1: if not CombatSelect('attack') then
if not CombatSelect('strength') then
CombatSelect('defence');
2: if not CombatSelect('strength') then
if not CombatSelect('attack') then
CombatSelect('defence');
3: if not CombatSelect('defence') then
if not CombatSelect('strength') then
CombatSelect('attack');
end;
end;
'range': begin
case CurrentStyle of
'accurate' : SetFightMode(1);
'rapid' : SetFightMode(2);
'longrange': SetFightMode(3);
'even': SetFightMode(2);
end;
Players[CurrentPlayer].Booleans[6] := true;
HoverSkillIs := 'ranged';
ArrowStartAmount:=GetArrowCount;
If (ArrowStartAmount <= 200) then
begin
LogoutSeq('Low ammo count! (below 200)');
exit;
end;
end;
'magic': begin
writeln('NAF doesn''t support Magic yet.');
TerminateScript;
end;
end;
Retaliate(True);
StartXP := GetXP(Hoverskillis);
SetRun(True);
SetAngle(true);
LogoutTime := Getsystemtime + RandomRange((LogoutEvery-2)*60000, (LogoutEvery+2)*60000);
MarkTime(RoundTimer);
MarkTime(MobTackTime)
if UseReportWin then
begin
ClearReport;
ChangeReportWidth(284);
AddtoReport('/~~~' +Scriptname+' v'+Version+' ~~\');
AddtoReport('|________Made by Narcle_________|');
AddtoReport('| Active Players: '+inttostr(ActiveCount)+' False: '+inttostr(HowManyPlayers-ActiveCount)+' |');
AddtoReport('Current Player: '+Players[Currentplayer].Name);
end;
Status('Script Running...');
end;
function ScriptRunTime: string;
var
H,M,S:integer;
begin
ConvertTime(gettimerunning, H, M, S);
result := inttostr(H) + 'h:' + inttostr(M) + 'm:' + inttostr(S)+'s';
end;
procedure ProgressReport;
Var
AmmoPerHour, XPpH, CurRemXP, CurXP, CurAmmo, TimeToLvl, I, H,M,S,rH,rM,rS:integer;
TimeToLvlStr:string;
FailedRemXP: boolean;
begin
if not(loggedin) then LoginPlayer;
ConvertTime(GetTimeRunning, rH, rM, rS);
CurXP := GetXP(Hoverskillis);
if (CurXP > Startxp) then
ReportVars[1] := CurXP - Startxp;//XP gained this round
ReportVars[0] := Round(ReportVars[0]*0.80);//Miss-click rate
TKilled := TKilled + ReportVars[0];//Total Kills
Txp := Txp + ReportVars[1];//Total XP
TFoodate := TFoodate + ReportVars[2];//Total Food ate
Titemspicked := Titemspicked + ReportVars[6];//Total Item picked up
TBonesBuried := TBonesBuried + ReportVars[4];//Total Bones Buried
if (HowManyPlayers = 1) then
begin
CurRemXP := XpTillNextLevel(Hoverskillis);
if (CurRemXP = -1) then FailedRemXP := true;
XPpH := Round( Txp / (rH+rM/60.0) );//XP per Hour
TimeToLvl := Round( CurRemXP / ( Txp / ((rH*3600.0+rM*60.0+rS)*1000) ) ); //Time to Level in MS
ConvertTime(TimeToLvl, H, M, S);
if FailedRemXP then TimeToLvlStr := 'Failed'
else TimeToLvlStr := inttostr(H) + 'h:' + inttostr(M) + 'm:' + inttostr(S) +'s';
end;
if Players[CurrentPlayer].Booleans[6] then
begin
CurAmmo := GetArrowCount;
if (ArrowStartAmount > CurAmmo) then
ReportVars[7] := ArrowStartAmount - CurAmmo;
TArrowAmount := TArrowAmount + ReportVars[7];
AmmoPerHour := Round( TArrowAmount / (rH+rM/60.0) );
end;
if (HowManyPlayers = 1) then
begin
Cleardebug;
Writeln('***************************************** *****************************************');
Writeln(Padr('| Narcle''s AutoFight v'+Version, 27) + Padr('| - Single Player -',27)+
Padr('| '+ScriptRunTime, 27)+ '|');
Writeln('***************************************** *****************************************');
WriteLn(Padr('| Total Kills: ' + inttostr(TKilled), 27) + Padr('| Total XP: ' + inttostr(Txp), 27) +
+ Padr('| XP/hour: ' + inttostr(XPpH), 27) + '|');
WriteLn(Padr('| Round Kills: ' + inttostr(ReportVars[0]), 27) + Padr('| Round XP : ' + inttostr(ReportVars[1]), 27)+
+ Padr('| '+Capitalize(HoverskillIs) + ' lvl: ' + TimeToLvlStr, 27) + '|');
If Players[CurrentPlayer].Booleans[6] then
writeln(Padr('| Ammo Remain: '+inttostr(GetArrowCount), 27) + Padr('| Ammo used: ' +inttostr(TArrowAmount), 27) +
+ Padr('| Ammo Used/hour: '+inttostr(AmmoPerHour), 27)+'|');
if (TFoodate > 0) or (Titemspicked > 0) or (TBonesBuried >0) then
WriteLn(Padr('| Pick ups: ' + inttostr(Titemspicked)+' ', 27) + Padr('| Food ate: '+inttostr(TFoodate)+' ', 27) +
+ Padr('| Bones Buried: ' + inttostr(TBonesBuried)+' ', 27)+'|');
Writeln('***************************************** *****************************************');
end;
if (HowManyPlayers > 1) then
begin
Players[currentplayer].Integers[11] := Players[currentplayer].Integers[11] + ReportVars[1];//XP
Players[currentplayer].Integers[12] := Players[currentplayer].Integers[12] + ReportVars[0];//Kills
Players[currentplayer].Integers[13] := Players[currentplayer].Integers[13] + ReportVars[7];//Ammo Used
Players[currentplayer].Integers[14] := Players[currentplayer].Integers[14] + ReportVars[6];//Items Picked-up
Players[currentplayer].Integers[15] := Players[currentplayer].Integers[15] + ReportVars[2];//Food Ate
Players[currentplayer].Integers[31] := Players[currentplayer].Integers[31] + TimeFromMark(RoundTimer);//Time in MS
Players[currentplayer].Integers[32] := Round( (Players[currentplayer].Integers[11]*3600)/(Players[currentplayer].Integers[31]/1000) );//XP per Hour
ClearDebug;
Writeln('***************************************** **********************************************');
Writeln('| - Multi - Player - Narcle''s AutoFight v'+Version+' by Narcle_| Run Time: '+
+Padr(ScriptRunTime, 17)+' |');
Writeln('***************************************** **********************************************');
Writeln('| # | Nick | Active | XP Gained | Kills | XP/Hour | Food ate | Pick-ups | Ammo Used |');
Writeln('| -- | ALL | Totals | '+Padr(IntToStr(Txp),9) + ' | ' + Padr(IntToStr(TKilled),6) +
+ ' | ------- | ' + Padr('Ate: ' + IntToStr(TFoodate),8) + ' | ' +Padr(inttostr(Titemspicked), 8) +
+ ' | '+ Padr(IntToStr(TArrowAmount),9) + ' |');
For I := 0 to HowManyPlayers - 1 do
begin
Writeln('| '+Padl(IntToStr(I), 2)+' | '+Padr(Players[i].Nick, 4)+' | '+ Padr(BoolToStr(Players[i].Active), 6) + ' | ' +
+ Padr(IntToStr(Players[i].Integers[11]),9) + ' | ' + Padr(IntToStr(Players[i].Integers[12]),6) + ' | ' +
+ Padr(IntToStr(Players[i].Integers[32]),7) + ' | ' + Padr('Ate: ' + IntToStr(Players[i].Integers[15]),8) + ' | ' +
+ Padr(IntToStr(Players[i].Integers[14]),8) + ' | ' + Padr(IntToStr(Players[i].Integers[13]),9) + ' |');
end;
Writeln('***************************************** ***********************************');
end;
if UseFileLogging then
begin
WriteINI(ScriptINIid, 'Timeran',inttostr(strtoint(ReadINI(ScriptINIid, 'Timeran', AppPath+'Chars.ini')) + (TimeFromMark(RoundTimer)/60000) ), AppPath+'Chars.ini');
WriteINI(ScriptINIid, 'YourKills',inttostr(strtoint(ReadINI(ScriptINIid, 'YourKills', AppPath+'Chars.ini')) + ReportVars[0]), AppPath+'Chars.ini');
WriteINI(ScriptINIid, 'XPGained',inttostr(strtoint(ReadINI(ScriptINIid, 'XPGained', AppPath+'Chars.ini')) + ReportVars[1]), AppPath+'Chars.ini');
end;
SendSRLReport;
end;
procedure NAFHpCheck;
var
c:Integer;
begin
if (not LoggedIn) or (HPPercent > 64) then
Exit;
if (HPPercent < 30) then
begin
Status('Running away HP% < 30...');
RunAway(CurrentRunDir, true, 1, 5000+random(5000) );
end;
if (HPPercent < 65) then
begin
Status('HP low doing HP checks...');
if Players[CurrentPlayer].Integers[8] > 0 then
if not(InvEmpty) then
for c := 0 to 2 do
begin
if (MouseInvTextCustom(['Eat'],'Eat', 550, 1, true, ClickLeft) > 0) then
begin
ReportVars[2] := ReportVars[2] + 1;
Players[CurrentPlayer].Integers[8] := Players[CurrentPlayer].Integers[8]-1;
end;
if (not(loggedin)) or (HPPercent > 64) then exit;
end;
repeat
if not LoggedIn then
Exit;
AFWait(4);
Case random(20) of
0: RandomMovement;
end;
if NInFight then
begin
RunAway(CurrentRunDir, true, 1, 10000+random(2000) );
if (HPPercent < 50) and NInFight then
begin
Status('Waiting to auto-logout...');
repeat
AFwait(4);
until(not(loggedin))
LogoutSeq('');
end;
end;
MarkTime(MobTackTime);
if (Getsystemtime > LogoutTime) then LogoutSeq('');
Status('HP is ' + inttostr(HPPercent) + '%');
until(HPPercent > 64);
SetAngle(true);
end;
end;
function CustomPickup:boolean;
var
i,x,y,L:integer;
B: TBox;
P: TPointArray;
begin
for i := 0 to (GetArrayLength(PickupColors)-1) do
begin
x:=MSCX;
y:=MSCY;
if (FindColorSpiralTolerance(x, y, PickupColors[i], MSX1, MSY1, MSX2, MSY2, PickupTol)) then
begin
MMouse(x,y,3,3);
Wait(200+random(50));
if IsUpText('ake') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
wait(25+random(25));
L := High(PickupNames);
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0; B.Y1 := 0;
FindColorsTolerance(P, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(P) = 0 Then Exit;
B := GetTPABounds(P);
for i := 0 to L do
begin
if (FindText(x, y, PickupNames[i], upchars, B.X1, B.Y1, B.X2, B.Y2)) then
begin
Wait(10);
Mouse(x + 5, y + 3, Length(PickupNames[i]) * 6, 4, True);
Result := True;
NarcDebug('Picking up item');
ReportVars[6] := ReportVars[6] + 1;
AFWait(1);
FFlag(0);
end;
end;
if Not Result then
MMouse(x, y-40, 30, 10)
end;
end;
end;
end;
procedure NAFOutFight;
var
T: integer;
begin
if Players[CurrentPlayer].Booleans[6] then
T := GetSystemTime - 12000
else
T := GetSystemTime;
while not NInFight and (TimeFromMark(T) < 5000) do wait(100);
if NInFight then
begin
Status('Killing monster...');
repeat
AFWait(1);
NAFhpcheck;
If Players[CurrentPlayer].Booleans[0] then
If PickUpPriority then
CustomPickup;
until(not NInFight) or (not FightOnScreen) or (not LoggedIn)
Status('');
end else
Wait(300);
end;
procedure LogoutSeq(reason:string);
begin
NAFOutFight;
ProgressReport;
if HowManyPlayers = 1 then
begin
while LoggedIn do Wait(100);
wait(5000+random(30000));
end;
if (reason = '') then
nextplayer(true)
else
begin
writeln(reason+' '+Players[CurrentPlayer].Name+' is now inactive.');
nextplayer(false);
end;
SetupPlayer;
end;
function TakeABreak: boolean;
var
H, M, S, BreakFor, T: integer;
begin
if ( GetSystemTime >= BreakTime ) then
begin
result := true;
ProgressReport;
BreakFor := RandomRange(5 * 60000, 25 * 60000);
ConvertTime(BreakFor, H, M, S);
Writeln('Break for: '+inttostr(M)+ 'm:' +inttostr(S)+ 's');
Logout;
MarkTime(T);
Repeat
ConvertTime(BreakFor - TimeFromMark(T), H, M, S)
Disguise(inttostr(M)+ 'm:' +inttostr(S)+ 's Break');
wait(1000);
until (BreakFor < TimeFromMark(T))
BreakTime := GetSystemTime+RandomRange(45*60000, 180*60000);
Disguise('Resuming...');
NextPlayer(true);
SetupPlayer;
end;
end;
function TakeASleep(SleepTime: string): boolean;
var
H, M, S, ms: Word;
SleepH, SleepM, SleepFor, Hr, Mr, Sr, T: integer;
begin
SleepH := StrToInt(Left(SleepTime, 2));
SleepM := StrToInt(Right(SleepTime, 2));
DecodeTime(Now, H, M, S, ms);
if (H = SleepH) and (M > SleepM) then
begin
Result := true;
ProgressReport;
SleepFor := RandomRange(350 * 60000, 730 * 60000);
ConvertTime(SleepFor, Hr, Mr, Sr);
Writeln('Sleep for: '+inttostr(Hr)+ 'h:'+inttostr(Mr)+ 'm:' +inttostr(Sr)+ 's');
Logout;
MarkTime(T);
Repeat
ConvertTime(SleepFor - TimeFromMark(T), Hr, Mr, Sr);
Disguise(inttostr(Hr)+ 'h:'+inttostr(Mr)+ 'm:' +inttostr(Sr)+ 's Sleep');
wait(1000);
until (SleepFor < TimeFromMark(T))
BreakTime := GetSystemTime+RandomRange(45*60000, 180*60000);
Disguise('Resuming...');
NextPlayer(true);
SetupPlayer;
end;
end;
var
SpecTime: integer;
procedure UseSpecial;
begin
if ( GetSystemTime > SpecTime) then
begin
gametab(1);
Status('Using Special...');
NarcDebug('Using special');
wait(100+random(50));
Mouse(640,421,8,4,true);
SpecTime := GetSystemTime + RandomRange(66000, 132000);
end;
end;
function SeekMob: Boolean;
var
Mobs : TPointArray;
begin
if not FindMobByMM then
begin
Result := false;
exit;
end;
FindColorsTolerance(Mobs, 195836, MMX1, MMY1, MMX2, MMY2, 19);
if Length(Mobs) > 3 then
begin
RAaSTPA(Mobs, 4);
SortTPAFrom(Mobs, IntToPoint(MMCX, MMCY));
if Length(Mobs) > 0 then
begin
Mouse(Mobs[0].x, Mobs[0].y, 3, 3, True);
FFlag(0);
Result := True;
end;
end;
end;
function NAFAttack(Names:TStringArray; Colors:TintegerArray; R_ClickOnly:Boolean): boolean;
var
xx, yy, c, x, y, L, ClickNum: integer;
begin
if not LoggedIn then
Exit;
if NInFight then
if FightOnScreen then
Exit;
L := High(Colors);
Status('Searching...');
for c := 0 to L do
begin
if (MobsOnScreen = 0) or NInFight then
Exit;
x:=MSCX;
y:=MSCY;
if FindColorSpiralTolerance(x, y, Colors[c], MSX1, MSY1, MSX2, MSY2, 3) then
begin
MMouse(x, y, 3, 3);
if FindColorSpiral(xx, yy, 65280, x - 15, y - 40, x + 15, y+ 40) then
Continue;
wait(150+random(50));
if IsUpTextMultiCustom(Names) then
begin
GetMousePos(x, y);
if R_ClickOnly then ClickNum := 0 else ClickNum := Random(2);
case ClickNum of
0: begin
Mouse(x, y, 0, 0, false);
if ChooseOption('tack') then
result := true;
end;
1: begin
HoldMouse(x, y, True);
Wait(80 + Random(60));
GetMousePos(x, y);
ReleaseMouse(x, y, True);
try
Result := FindColor(x, y, 255, x-10, y-10, x+10, y+10);
except
Result := False;
end;
end;
end;
if result then
begin
MarkTime(MobTackTime);
FFlag(0);
if Players[CurrentPlayer].Booleans[6] then AFWait(20);
ReportVars[0] := ReportVars[0] + 1;
Exit;
end;
end;
end;
end;
end;
function SitAndWait: Boolean;
var
WaitTime: integer;
TPA: TPointArray;
begin
MarkTime(WaitTime);
repeat
if not LoggedIn then exit;
AFWait(2);
NAFHpCheck;
TPA := MobTPAs;
if (Getarraylength(TPA) > 0) then
if ChangeCamera then
if NAFattack(NameArray, ColorArray, RightClickOnly) then
begin
result := true;
Exit;
end;
until (TimeFromMark(WaitTime) > 120000)
end;
procedure NAFSetup;
var
V: TVariantArray;
begin
ScriptNews;
NarcSig;
LoadSMART(8, True, true);
while not SmartActive do wait(100);
SetTargetDC(SmartGetDC);
SetupSRL;
if UseFileLogging then
NarclesINI
else
begin
SRLid:= MySRLId;
SRLpassword:= MySRLPassword;
end;
if (SRLID = '') or (SRLPassword = '') then<---real have it
begin
ThreadSafeCall('NoID', V);
TerminateScript;
end;
ScriptID := '418';
Disguise(ScriptName+' v'+Version);
Status('Start Narcle''s AutoFight!');
AddtoReport('Start time: '+TheTime);
DeclarePlayers;
CheckUserNicks;
Status('Waiting for Runescape to load.');
SetupPlayer;
BreakTime := GetSystemTime+RandomRange(60*60000, 150*60000);
end;
{------------------------------------------------------------------------------}
{===============================Main Execution=================================}
{------------------------------------------------------------------------------}
begin
NAFSetup;
repeat
if not LoggedIn then
LoginPlayer;
NAFhpcheck;
if NInFight then
if FightOnScreen then
NAFOutFight;
if (MobsOnScreen = 0) then
if not ChangeCamera then
if not SeekMob then SitAndWait;
if (TimeFromMark(MobTackTime) >= 180000) then
LogoutSeq('Couldn''t find monsters.');
if (Players[CurrentPlayer].Booleans[2]) then
UseSpecial;
if NAFattack(NameArray, ColorArray, RightClickOnly) then
NAFOutFight;
if Players[CurrentPlayer].Booleans[0] then
CustomPickup;
if (Getsystemtime > LogoutTime) then
LogoutSeq('');
if InvFull then
InvManagement;
if TakeSleeps then
TakeASleep(SleepAt);
if TakeBreaks then
TakeABreak;
Antiban;
AFWait(0);
until(false);
end.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.