SRL Archive - First Scripts

My First Script!


IwriteCode

2009-11-23 09:00:47

HI all, I'm fairly new here and enjoy this site alot!, anyway i have been reading and learning from some great tuts from you guys on bitmaps, DTM's, road walking etc and have made my first working script.

Features
.Auto Heal when low hp
.Gets food from bank when out of food
.Option to pick up items
.Antirandom+antiban

It basically kills guards at north fally(and heals when low) and banks at fally west bank to get more food when out of food. It only works with tuna(make sure u have the tuna in the first column and first row in your bank invent!)



**************************************************
{ Guard Fighter V[1].1
{ Worked for 3 Hours, 1 Minutes and 31 Seconds
{ Killed 620 guards
{ Total experience gained 54560
**************************************************

Note:I am not responsible for what you do with this code and its consequences thereby.
EDIT:Added standardized version(GuardFightV1.1)
EDIT:Please re download as i found a bug in the last one!
EDIT:Updated banking! Re download!

Old Version:20 views.

Gu3st...

2009-11-23 09:12:13

I have to say; this is a big script for a first script! O_O
Good job! :)
I would work a bit on my standards if I were you, makes reading scripts you make easier :)

IwriteCode

2009-11-23 10:33:18

From: Zyt3x
I have to say; this is a big script for a first script! O_O
Good job! :)
I would work a bit on my standards if I were you, makes reading scripts you make easier :)


Ill take note of that for future scripts thanks for that.

EDIT: any further comments?

Raskolnikov

2009-11-23 23:43:54

Good job, a few things to mention….

Do work on your standards, the link in my signature is a tutorial about standards(that won me the tutorial cup).

The code looks good except…

wait(12444)

i would recommend this:

wait(12300+random(40));

They will get used to your script always waiting 12444 milliseconds and that = banned. Random operations remove that risk.

Good luck! :D

Edit: Ask me if you have any questions, I am here to help!

IwriteCode

2009-11-23 23:58:28

Yea i did add random(time) to most of them but got lazy at the end.
Thanks i will read that tut on standards

YoHoJo

2009-11-24 00:25:33

Nice job, great start. You standards are really off :p, also, no need for the Inventory and Stats bitmaps, you can just do
GameTab(tab_Inv); ect, look in GameTab.scar for all of them.

Ill examine this more later and edit this post with more feedback, once again great start! Woo!

You dont need stuff like
MMouse(x+11, y+11, 0, 0);
wait(200)
Mouse(x+11, y+11, 1, 1,true);

Just
Mouse(x+11,y+11,1,1,True) would work.
(Mouse MOVES AND CLICKS)

IwriteCode

2009-11-24 02:06:47

From: YoHoJo
Nice job, great start. You standards are really off :p, also, no need for the Inventory and Stats bitmaps, you can just do
GameTab(tab_Inv); ect, look in GameTab.scar for all of them.

Ill examine this more later and edit this post with more feedback, once again great start! Woo!

You dont need stuff like
MMouse(x+11, y+11, 0, 0);
wait(200)
Mouse(x+11, y+11, 1, 1,true);

Just
Mouse(x+11,y+11,1,1,True) would work.
(Mouse MOVES AND CLICKS)

oh thanks that GameTab() would be very helpful! no bitmaps for it less cpu usage less coding etc. thanks for helpful post!

Wanted

2009-11-24 02:24:39

Hahaha! I love it!

This is the best first attempt at a script I've ever seen, it like your logic goes straight to the code :)

But yea, this needs a mountain load of improvement though, I suggest you look at other well-known-working scripts to see how they work so you can get a feel for the proper techniques, since you already got the basics down.

YoHoJo

2009-11-24 02:55:16

Agreed, BY FAR one of the best first scripts I've seen, (because of your previous coding experience), i see lots of hope in you!

IwriteCode

2009-11-24 21:17:32

When i try to use GameTab(int) i get a warning. ** Warning in GameTab: Tab 4 is not a valid tab number.**

Mr. Doctor

2009-11-24 22:13:26

Go to SRL/SRL/Core/GameTabs.

Valid arguments are…



tab_Combat = 21;
tab_Stats = 22;
tab_Quest = 23;
tab_Diary = 24;
tab_Inv = 25;
tab_Equip = 26;
tab_Prayer = 27;
tab_Magic = 28;
tab_Objectives = 29;
tab_Friends = 30;
tab_Ignore = 31;
tab_Clan = 32;
tab_Options = 33;
tab_Emotes = 34;
tab_Music = 35;
tab_Notes = 36;
tab_LogOut = 37;

You could use both tab_ect or the number.

IwriteCode

2009-11-25 07:59:21

From: Junkj
Go to SRL/SRL/Core/GameTabs.

Valid arguments are…



tab_Combat = 21;
tab_Stats = 22;
tab_Quest = 23;
tab_Diary = 24;
tab_Inv = 25;
tab_Equip = 26;
tab_Prayer = 27;
tab_Magic = 28;
tab_Objectives = 29;
tab_Friends = 30;
tab_Ignore = 31;
tab_Clan = 32;
tab_Options = 33;
tab_Emotes = 34;
tab_Music = 35;
tab_Notes = 36;
tab_LogOut = 37;

You could use both tab_ect or the number.


Haha they make it so easy for us. thanks

Tickyy

2009-11-25 09:54:25

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] :)!

Nava2

2009-11-25 10:17:45

Check out using loops to make repeated code less.. repeated!

Looks great, you are very promising!

If you want a hand, feel free to add me on MSN: nava2[at]live.ca :)

Gu3st...

2009-11-25 15:28:05

From: Nava2
Looks great, you are very promising!
This is not something nava2 is saying just so that you should be flattered/feel better; it actually looks like you can reach high here in these forums :)
Keep it up! :D

IwriteCode

2009-11-27 05:42:45

Thanks guys! I went over my code and managed to write it in 390 lines as opposed to 510 lines, and performing the same tasks of course.

Camaro'

2009-11-27 21:30:19

From: IwriteCode
Thanks guys! I went over my code and managed to write it in 390 lines as opposed to 510 lines, and performing the same tasks of course.


Post it :) Im gonna test this script to give you some comments.

IwriteCode

2009-11-28 01:04:59

[QUOTE=Camaro';659992]Post it :) Im gonna test this script to give you some comments.[/QUOTE]

OK, i will also add a progress report and fix the walking to bank to bank a bit more then i will post it up in my first post. Should be done within an hour of posting this!

EDIT: Added the new Version! Put tuna in first slot of bank(ie 1st column and 1st row!)

Kyle Undefined

2009-12-05 04:38:22

Looks very good! Here's something you could do, instead of having to place the food in a certain spot, have it search the bank for the food. Let the food be a user variable and have it grab what they want. Just a suggestion.

~Camo

Bionicle

2009-12-05 11:54:43

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]