SRL Archive - First Scripts

First Script - PwnDemCows [SMART8] [SRL-OSR]


Emarian

2013-03-28 13:38:09

Alright, this is my first script. This is based off of PwnDemChickens, with permission by the original author, except it kills cows.

I'm going to come back and expand this thread later, but I've been working on this for awhile, my head hurts, and I'm ready to go blaze right now. I'll see you guys tonight.

Changelog:
0.1: Barely works but is working
0.2: Made camera go all the way up when logged in and a few insignificant changes

*UPDATE*
Will clean up the code tomorrow morning, break down Clickcow into several different procedures and a few other changes. Should I increase the tolerance of the FindObj?

*UPDATE2*
Done. Just need to resolve the below antirandoms error.

Features:
Kills cows
Autologin
2 colors for cow detection
Minibreaker


Not yet added features:
Antiban
Random support
Proggy
Pick up hides (working but temporarily removed until cow detection and clicking is perfect)
Banking hides


I really need some help with the cow detection and clicking, so any suggestions/comments or constructive changes to the script would be MUCH MUCH appreciated. I would also really appreciate it if anyone wants to give suggestions as to how to decrease ban chances. How can I improve the anti-ban that is somewhat implemented?


Any help at all is great. You're not going to hurt my feelings - I know I suck right now.

program PwnDemCows;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Misc/Debug.Simba}

const
cowCOLOR1 = 4938351;
cowCOLOR2 = 1188393;
greenLifeBar = 65280;

var
x, y, x1, y1: Integer;

//Declare your username and password
procedure DeclarePlayer;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Active := True;
end;
end;

//More human like movement
Procedure HumanMove;
Begin
case random(200) of
1..160: MMouse(RandomRange(X - 7, X + 7), RandomRange(y - 7, y + 7), 0, 0);
161..190: MMouse(RandomRange(X - 9, X + 9), RandomRange(y - 9, y + 9), 0, 0);
191..200: MMouse(RandomRange(X - 12, X + 12), RandomRange(y - 12, y + 12), 0, 0);
End;
End;


procedure Antiban;
begin
case Random(100) of
1: HoverSkill('magic', False);
2: HoverSkill('random', False);
3: Boredhuman;
4: Wait(2500 + random(4500));
5: HoverSkill('smithing', False);
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;

procedure MiniBreaker;
begin
case Random(160) of
1: Wait(40000 + random(7400));
2: Wait(25500 + random(8550));
3: Wait(60040 + random(6759));
4: Wait(20400 + random(2549));
end;
end;

procedure ClickCow;
begin
if (not LoggedIn) then
begin
LogInPlayer;
MakeCompass('N');
KeyDown(VK_UP);
Wait(RandomRange(1500, 2500));
KeyUp(VK_UP);
end;
repeat
repeat
wait(1200);
until (FindColor(x, y, greenLifeBar, 206, 127, 298, 196) = false);
if FindObjCustom(x, y, ['Cow'], [cowCOLOR1, cowCOLOR2], 25) then
begin
x := x - 20;
y := y - 20;
if x < 0 then
begin
x := 0;
end;
if y < 0 then
begin
y := 0;
end;
end
else
begin
KeyDown(VK_RIGHT);
repeat
Wait(RandomRange(50, 100));
until (FindObjCustom(x, y, ['Cow'], [cowCOLOR1, cowCOLOR2], 5))
KeyUp(VK_RIGHT);
end;
if FindColor(x1, y1, greenLifeBar, x, y, x + 40, y + 40) = false then
begin
x := x + 20;
y := y + 20;
MMouse(x, y, 3, 3);
Writeln('Detected a cow, lets kill it!');
ClickMouse2(mouse_left);
end
else
begin
case Random(2) of
0: Antiban();
1: MiniBreaker();

end;
end;
wait(2000);
until (false)
end;

begin
ClearDebug;
SetupSRL;
DeclarePlayer;
ActivateClient;
Wait(2000);
ClickCow;
end.

Lord Waffles

2013-03-29 01:07:44

Grats on your first script!

Some things I would change that would make it easier to follow and edit (at least in my opinion (which is not the best opinion)) would be to take your:


MakeCompass('N');
KeyDown(VK_UP);
Wait(RandomRange(1500, 2500));
KeyUp(VK_UP);
and put this into it's on procedure. Call it something like setupCowKiller, and this will be any pre-configuration like checking if the player input everything needed, setting up the camera to the best direction, making sure the inventory screen is open, etc….

Next I would take out your loop in clickCow, i'm not the best scripter in the world so however I feel like though this does not affect the script, it would still be good practice to set this up a little differently. So by now i'm assuming you know the last begin/end. with the period is your MAIN method. This is where I would put your 'loop until _____' so something like this:


Procedure ClickCow;
/* All the crap you do to find your cow
and click on it *\
Then down in your main statement I would have:

begin
DeclarePlayer
SetupSRL();
ClearnDebug;
writeln('Thanks for using my cow killer!');
setupCowKiller;
repeat
ClickCow;
wait(randomrange(1245,2452));
MiniBreaker;
AntiBan;
until(not LoggedIn);
end.
This way it is a little easier to manage and add things to your loop. I like to keep my main loop filled with methods instead of lots of code, this way the main method is only a couple lines long and it's easy to see where there is a problem. Then you can go into your procedures and fix the issue. I am guilty of just wanting to quickly fix something and just throwing in some if statements in my main method just to fix it. Not the best way to do it and it clutters up my main method.

Overall great start, I have never personally tried combat…but I would def. checkout some other users fight scripts to see how they do things like burry bones, etc.


EDIT: I just wrote this all really fast lol, it's late and I wrote it all on the website instead of in simba. So apologies if something is wrong xD

Emarian

2013-03-29 12:16:05

Thanks a lot for your help Waffles. I implemented your suggestions, this is what I've got: http://pastebin.com/Gd9arLvs

I've also included anti-random support, vastly improved cow detection (tol still needs some perfecting though), and the whole script works much better now. However, after a few cows, it ends with this error in the antirandoms file:

Error: Exception: Mask is invalid. Width/Height: (9,6). WhiteHi/BlackHi: (-1,53) at line 780
The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]

Any ideas?

EDIT:
38 views, 1 reply…if it wasn't for the extremely helpful people like Lord Waffles I'd take this down….xD

EDIT2:
Forgot to say I was recommended in the chatroom to go from my HumanMouse procedure to MMouse; however, the reason I kept HumanMouse is here

EDIT3:
Got antirandoms fully working, and I believe the antiban is straight. However, I'm going to hold off on the update a little bit longer so I can put a paint on it and get a final word on my antiban. I don't want to say that the antiban works perfect and someone get banned xD. Expect it in the next 24 hours.

EDIT4:
I hoped to receive a response on the antiban by now but not yet. I messaged a prominent member and I hope he gets back in touch about the antiban, but if not, I'll post the script anyway tomorrow morning.

hdxorange

2013-03-30 16:04:48

will try it out later :P

rj

2013-03-30 16:06:02

not bad for a first script

dapstriple

2013-04-13 17:13:22

Good Script I will post a proggy soon been running for 30 minutes.

juggerknot14

2013-04-22 16:44:11

Not bad, a little obvi that it's a bot though, very quick jerks and inaccurate clicks, either way it's a great first release, grats man, looking forward to more.

+1

l6bustank

2013-05-02 10:51:10

if you want to lvl up on ur scripting skill then look into TPA-based object finding. Its much more accurate.

Hoodz

2013-05-02 17:43:43

For the randoms error you need to put your nickname in the declareplayers procedure :)

everettzc

2013-05-23 21:59:32

very good script! ive been running it for about 5 hours now, other then moving my character once a while to make it easier for the bot to find cows its gotten me an effortless str 2-30 so far. other then it not moving my character to find more cows, the slugish clicks and misclicks, it gets the job done.

keep up to great work and ty!

blaker

2013-05-23 22:27:51

My bot does not eat food?

DiVerse

2013-05-29 02:54:30

just came back to runescape, looking to start scripting again more than likely.

If you were to switch;

begin
KeyDown(VK_RIGHT);
repeat
Wait(RandomRange(50, 100));
until (FindObjCustom(x, y, ['Cow'], [cowCOLOR1, cowCOLOR2], 5))
KeyUp(VK_RIGHT);
end;

to something like


move(x,y)
wait(2400)
move(x,y)

and make it work better in specific areas? or am i way off syntax

Biggassfann

2013-05-30 17:44:06

Exception in Script: Unable to find file 'SRL-OSR/SRL.Simba' used from ''

:(

Bearzs

2014-02-26 18:27:40

Script needs a move compass function after a few seconds of not detecting a cow, Not to difficult to add, other then that it would be great.

Coh3n

2014-02-26 20:55:09

From: l6bustank
if you want to lvl up on ur scripting skill then look into TPA-based object finding. Its much more accurate.
FindObjCustom does use TPAs. ;)