From: Tickyy
Here's a little kick to help you in the future about your standards and stuff.
This is the Old one:
procedure GoBank;
var
rx,ry:integer;
begin
if FindSymbol(rx, ry, 'shop') then
begin
mmouse(rx,ry,2,2)
wait(111+random(182))
mouse(rx,ry,2,1,true);
writeln('found shop')
wait(3333+random(1222))
if findsymbol(rx,ry,'water') then
begin
mmouse(rx,ry,2,2)
wait(111+random(121))
mouse(rx,ry,2,1,true);
writeln('found water')
wait(12222+random(2222))
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111+random(321))
mouse(rx,ry,2,1,true);
wait(12444+random(1211))
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333+random(222))
CloseBank;
wait(111+random(333))
MakeCompass('e')
backtofight;
end else
begin
writeln('Did notfind bank')
didnotfindtehbank;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 94, 136, 60, -2, -2) then
begin
writeln('Water not detected, clicking south') ;
wait(12222+random(2223)) ;
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111+random(121))
mouse(rx,ry,2,1,true);
wait(12444+random(322))
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333+random(222))
CloseBank;
wait(1113+random(1222))
MakeCompass('e')
backtofight;
end else
begin
writeln('Did not find bank')
didnotfindtehbank;
end;
end;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 76, 143, 72-random(3), -2, -1) then
begin
writeln('Shop not detected, clicking south')
wait(1222)
if findsymbol(rx,ry,'water') then
begin
mmouse(rx,ry,2,2)
wait(111+random(111))
mouse(rx,ry,2,1,true);
writeln('found water')
wait(12222+random(1234))
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111)
mouse(rx,ry,2,1,true);
wait(12444)
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333)
CloseBank;
wait(333)
MakeCompass('e')
backtofight;
end else
begin
writeln('Did notfind bank')
didnotfindtehbank;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 214, 166, 46, -2, -1) then
begin
writeln('Water not found, clicking west')
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111)
mouse(rx,ry,2,1,true);
wait(12444)
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333)
CloseBank;
wait(1113)
MakeCompass('e')
backtofight;
end;
end;
end;
end;
end;
end;
New ONE:
procedure GoBank;
var
rx, ry, c : integer;
begin
if FindSymbol(rx, ry, 'shop') then
begin
mmouse(rx,ry,2,2)
wait(111+random(182)) // You actually don't need the MMouse
mouse(rx,ry,2,1,true); // Just Mouse, would also work perfectly :)!
writeln('found shop')
wait(3333+random(1222))
if findsymbol(rx,ry,'water') then
begin
mmouse(rx,ry,2,2)
wait(111+random(121)) // same here...
mouse(rx,ry,2,1,true);
writeln('found water')
wait(12222+random(2222))
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111+random(321))
mouse(rx,ry,2,1,true);
wait(12444+random(1211))
Repeat // Shorted by me
if not(bankscreen) then
OpenBankFast('falador west');
Inc(c);
Until((c = 4) or (bankscreen))
If (Not (Bankscreen)) then
begin
writeln('Did notfind bank')
didnotfindtehbank;
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333+random(222))
CloseBank;
wait(111+random(333))
MakeCompass('e')
backtofight;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 94, 136, 60, -2, -2) then
begin
writeln('Water not detected, clicking south');
wait(12222+random(2223));
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111+random(121))
mouse(rx,ry,2,1,true);
wait(12444+random(322)) // You could make it shorter...
if not(bankscreen) then // Like i showed you.
begin
OpenBankFast('falador west');
end; // Btw, you don't need begin and end for every single Function/Procedure
if not(bankscreen) then
OpenBankFast('falador west'); // <--- Here's an example
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333+random(222))
CloseBank;
wait(1113+random(1222))
MakeCompass('e')
backtofight;
end else
begin
writeln('Did not find bank')
didnotfindtehbank;
end;
end;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 76, 143, 72-random(3), -2, -1) then
begin
writeln('Shop not detected, clicking south')
wait(1222)
if findsymbol(rx,ry,'water') then
begin
mmouse(rx,ry,2,2)
wait(111+random(111))
mouse(rx,ry,2,1,true);
writeln('found water')
wait(12222+random(1234))
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111)
mouse(rx,ry,2,1,true);
wait(12444)
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333)
CloseBank;
wait(333)
MakeCompass('e')
backtofight;
end else
begin
writeln('Did notfind bank')
didnotfindtehbank;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 214, 166, 46, -2, -1) then
begin
writeln('Water not found, clicking west')
if FindSymbol(rx, ry, 'bank') then
begin
mmouse(rx,ry,2,2)
wait(111)
mouse(rx,ry,2,1,true);
wait(12444)
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
writeln('Attempting to find bank')
Withdraw(1, 1, 28);
wait(333)
CloseBank;
wait(1113)
MakeCompass('e')
backtofight;
end;
end;
end;
end;
end;
end;
If you still need some help, just PM me or add me, [email]Tickyy_@msn.com[/email] :)!
just felt like i needed to say, you don't need begin/end; nests if there is only one procedure. :p e.g.:
if not(bankscreen) then
begin
OpenBankFast('falador west');
end;
could simply be:
if not(bankscreen) then
OpenBankFast('falador west');
This is a great script, way better then most first scripts i have seen! This deserves a promising newcomer's cup imo ;)
EDIT: I have gone through your script and fixed your standards for you, please look over what I did and learn :)
{========================Guard Fighter V[1].1============================
~~~~~~~~~~~~~~~~~~~~~~~~Written by IWriteCode~~~~~~~~~~~~~~~~~~~~~~~~~~~
=! !=
========================================================================
========|Features|=========================|Optional Features|==========
========================================================================
.AntiRandoms .Heals HP when low
.AntiBan .Picks up items
.Rotates screen/random chat etc .When out of food:
.SMART Enabled -Log out
-Fight till death
========================================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~|Set Up instructions|~~~~~~~~~~~~~~~~~~~~~~~~~
========================================================================
1.Set up player in declare players. In lines 39-41. Your DONE!
/=-=-=-optional==-=-
2.If you want it to pick up items fill in lines 300-301.
3.Change guard color codes if the current ones dont work for you(lines 347-348)
4.Automatically send progress report every 20 minutes.
}
program GuardFighter;
{.include SRL\SRL\misc\SMART.SCAR}
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\fighting.scar}
var
x, y, corx, cory, progtime, numberkilled, tunaa, coloroffallyroad, logwhenout, attkguard, monstercolor1, monstercolor2, randx, randy, pickitem, itemcolor, take: integer;
//===========================Set Up Players here=====================
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //username
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3 or 4 letters of your username
Players[0].Active := true;
end;
procedure ProgressReport;
begin
if (GetSystemTime >= Progtime) then
begin
WriteLn('**************************************************');
WriteLn('{} Guard Fighter V[1].1 ');
WriteLn('{} Worked for ' +TimeRunning)
WriteLn('{} Killed '+inttostr(numberkilled)+ ' guards');
WriteLn('{} Total experience gained '+inttostr(numberkilled*88));
WriteLn('**************************************************');
progtime:=getsystemtime+1200000;
end;
end;
procedure BankFailSafe;
begin
if not(bankscreen) then
OpenBankFast('falador west');
end;
procedure GetFallyRoadColor;
var
xx, yy: integer;
begin
if findcolorcircletolerance(xx,yy,7504775 ,MMCX, MMCY,50,10) then
coloroffallyroad:=getcolor(xx,yy);
end;
procedure BackToFight;
begin
wait(2122+randomrange(111,888));
mouse(mmcx-57,mmcy-37,2,2,true);
wait(4013+randomrange(1000,2000));
mouse(mmcx-57,mmcy-37,2,2,true);
wait(2013+random(1000));
end;
procedure GetFoodReturn;
begin
Withdraw(0, 0, 28);
wait(333+random(222));
CloseBank;
wait(111+random(121));
MakeCompass('e');
wait(100+random(500));
BackToFight;
end;
procedure DidNotFindTheBank;
var
rx, ry, d: integer;
begin
logout;
wait(4777+random(1000));
loginplayer;
MakeCompass('e');
FindNormalRandoms;
if FindSymbol(rx, ry, 'bank') then
begin
wait(111);
mouse(rx+6,ry,2,1,true);
wait(4444+random(1222));
repeat
BankFailSafe;
inc(d);
until((d=4) or (bankscreen));
GetFoodReturn;
end;
end;
procedure GoBank;
var
rx, ry, c: integer;
begin
if FindSymbol(rx, ry, 'shop') then
begin
mouse(rx,ry,2,1,true);
WriteLn('found shop');
FindNormalRandoms;
wait(3333+random(1222));
if findsymbol(rx,ry,'water') or findsymbol(rx,ry,'mace shop') then
begin
mouse(rx+39,ry,2,1,true);
WriteLn('found water/mace shop');
FindNormalRandoms;
wait(12222+random(2222));
if FindSymbol(rx, ry, 'bank') then
begin
mouse(rx+6,ry,2,1,true);
FindNormalRandoms;
wait(9444+random(1211));
repeat
FindNormalRandoms;
BankFailSafe;
inc(c);
until((c=4) or (bankscreen));
GetFoodReturn;
end else
begin
WriteLn('Did notfind bank');
FindNormalRandoms;
DidNotFindTheBank;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 94, 136, 60, -2, -1) then
begin
WriteLn('Water not detected, clicking south');
wait(9222+random(2223));
if FindSymbol(rx, ry, 'bank') then
begin
FindNormalRandoms;
mouse(rx+6,ry,2,1,true);
wait(9444+random(322));
c:=0;
repeat
FindNormalRandoms;
BankFailSafe;
inc(c);
until((c=4) or (bankscreen));
c:=0;
GetFoodReturn;
end else
begin
WriteLn('Did not find bank');
FindNormalRandoms;
DidNotFindTheBank;
end;
end;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 76, 143, 72-random(3), -2, -1) then
begin
WriteLn('Shop not detected, clicking south');
wait(1222);
if findsymbol(rx,ry,'water') or findsymbol(rx,ry,'mace shop') then
begin
FindNormalRandoms;
mouse(rx+39,ry,2,1,true);
WriteLn('found water/mace shop');
wait(9222+random(1234));
if FindSymbol(rx, ry, 'bank') then
begin
FindNormalRandoms;
mouse(rx+6,ry,2,1,true);
wait(9444);
repeat
FindNormalRandoms;
BankFailSafe;
inc(c);
until((c=4) or (bankscreen));
c:=0;
GetFoodReturn;
FindNormalRandoms;
end else
begin
WriteLn('Did notfind bank');
DidNotFindTheBank;
end;
end else
begin
if RadialRoadWalk(coloroffallyroad , 214, 166, 46, -2, -1) then
begin
WriteLn('Water not found, clicking west');
if FindSymbol(rx, ry, 'bank') then
begin
wait(111);
FindNormalRandoms;
mouse(rx+6,ry,2,1,true);
wait(8444+random(1000));
repeat
FindNormalRandoms;
BankFailSafe;
inc(c);
until((c=4) or (bankscreen));
c:=0;
GetFoodReturn;
end;
end;
end;
end;
end;
end;
procedure ScreenSettings;
begin
wait(222+randomrange(222,321));
SetAngle(true);
wait(200+randomrange(0,145));
MakeCompass('e');
wait(100+random(100));
Retaliate(true);
wait(300+random(800));
SetRun(true);
end;
procedure AntiBan;
begin
case random(90) of
0: begin
HoverSkill('strength',false);
end;
1: begin
PickUpMouse;
end;
2: begin
MakeCompass('s');
Wait(341 + Random(124));
Makecompass('w');
Wait(124 + Random(131));
MakeCompass('e');
end;
3: begin
MakeCompass('n');
Wait(100 + Random(133));
Makecompass('e');
end;
4: begin
HoverSkill('hitpoints',false);
end;
end;
end;
procedure EatFood;
begin
logwhenout:=1; //1 to restock when no food remaining. 0 to fight till death.
if (HpPercent<50) then //heal when less that 50% of hp
begin
if FindDTM(tunaa, x, y, 518, 170, 750, 490) then
begin
FindNormalRandoms;
mmouse(x,y,1,1);
wait(200+randomrange(0,212));
mouse(x,y,1,1,true);
wait(222);
end else
begin
WriteLn('Cannot find food!');
if (logwhenout=1) then
begin
WriteLn('No food remaining proceeding to find bank');
FindNormalRandoms;
GoBank;
end;
end;
end;
end;
procedure PickUpItem;
begin
itemcolor:=1252487; //item color code
pickitem:=0; //1 to pick up item, 0 else.
if (pickitem=1) then
begin
if (FindColorCircletolerance(x, y, itemcolor, 260, 180,300,1)) then
begin
Mouse(x, y, 1, 1,true);
wait(1000);
if (Findbitmaptolerance(take,x,y,2)) then
begin
Mouse(x+11, y+11, 1, 1,true);
end;
end;
end;
end;
procedure LoadTheBitmaps;
begin
tunaa := DTMFromString('78DA63E4626060E0614001A991E10CBF80342' +
'310FF070246714C350C0C4C609211CA6304717909A8E1870BE156' +
'C30E24C4F0AB0100C3C20694');
attkguard := BitmapFromString(86, 11, 'beNr7zxDkZautLjOSEXIIHNsx' +
'FYJoaiORVvz/zwBHNHIJxHB4CMAdhuZCTAdTGErEaEf2OO0CATkE8' +
'Pia/iFA03gfDQH8IYCG0AoHPCK4BPFoxxMU8BDALAfw5A6s5Qauwg' +
'RZnCppAJd6rH7EFVa40gAuXxPPxup9qucCPOkHl0oicwExPkWLVjy' +
'lKKbsSEgDgzME8BeJ1PI1VUIAa7rFXxLiLyEJBhHxhRgucfxtCRSV' +
'AMUWcGQ=');
take := BitmapFromString(32, 11, 'beNpTlynIitPVUArysj22Yyoa' +
'0laXwYUIKoAjuPkkaRw1H80oNHE4F6s4siB+85G5mGxiFJPkfkzzc' +
'QUakeaT4X4qhg8eBeTFL367sCpGM5/KCADzOFGn');
end;
procedure RemoveTheBitmaps;
begin
if (IsFunctionKeyDown(1)) and (IsFunctionKeyDown(2)) then
begin
FreeDTM(tunaa);
freebitmap(attkguard);
freebitmap(take);
end;
end;
procedure Fight;
begin
monstercolor1:=1252485; //monster color1 these work for me..
monstercolor2:=2502961; //monster color1
if (FindColorCircletolerance(x, y, monstercolor1, 260, 180,300,2)) or (FindColorCircletolerance(x, y, monstercolor2, 260, 180,300,2)) then
begin
if not(InFight) then
begin
FindNormalRandoms;
randx:=randomrange(0,2);
randy:=randomrange(0,3);
Mouse(x, y, randx, randy,false);
wait(randomrange(20,30));
if (Findbitmaptolerance(attkguard,x,y,2)) then
begin
randx:=randomrange(0,6);
randy:=randomrange(1,2);
Mouse(x+22, y+4, randx, randy,true);
numberkilled:=numberkilled+1;
wait(5500+random(2000));
end;
end;
end;
end;
begin
SetupSRL;
DeclarePlayers;
cleardebug;
activateclient;
LoadTheBitmaps;
loginplayer;
ScreenSettings;
wait(randomrange(0,11));
GetFallyRoadColor;
wait(random(5));
progtime:=1200000;
repeat
if FindSymbol(corx, cory, 'furnace') then
begin
WriteLn('Furnace detected, fixing position');
if RadialRoadWalk(coloroffallyroad , 260, 293, 68-random(3), -2, -1) then
WriteLn('Found correct position, moving now');
end;
if (not(loggedin) and (logwhenout=1)) then
begin
loginplayer;
ScreenSettings;
GetFallyRoadColor;
end;
AntiBan;
wait(11+randomrange(0,11));
FindNormalRandoms;
wait(11+RandomRange(11, 38));
EatFood;
if not(GetCurrentTab=25) then
gameTab(25);
wait(500+randomrange(0,21));
PickUpItem;
wait(111+random(50));
Fight;
RemoveTheBitmaps;
ProgressReport;
until(false);
end.
The three bigest things:
- Indents/spaces
- Camel-Cap all procedures/functions
- Semi-Colons
Great job non-the-less, and good luck with any future scripts! If you need more help, or have a few questions u can PM me, or add my msn, [email]L.-.0.-.L@hotmail.com[/email]