SRL Archive - OSR Help

AntiRandoms Error in Combat Script


Emarian

2013-03-29 16:50:55

I'm trying to implement antirandoms in my cowkilling SRL-OSR SMART8 script. I added the lines to declareplayers on 19, lines 28-31, and lines 143-146 in an effort to implement antirandoms and that was what broke it. It compiles but after it kills a few cows I get 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]

Thanks in advance for your help - this error is really frustrating because I was about to move onto making a functional progress report and then try banking >.< so I'm looking forward to getting this out of the way

http://pastebin.com/9MNRGJTm

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;

procedure DeclarePlayer;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
with Players[0] do
begin
Name := ''; // Username here
Pass := ''; // Password here
Active := True;
end;
end;

procedure AntiRandoms;
begin
FindNormalRandoms;
LampSkill := 'woodcutting'; // Skill you want to use the genie lamp on here
LevelUp;
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 SetupCowKiller;
begin
if (not LoggedIn) then
begin
LogInPlayer;
MakeCompass('N');
KeyDown(VK_UP);
Wait(RandomRange(1473, 2541));
KeyUp(VK_UP);
end
else
begin
KeyDown(VK_UP);
Wait(RandomRange(1473, 2541));
KeyUp(VK_UP);
end;
end;

function ClickCow: Boolean;
begin
repeat
wait(RandomRange(824, 1457));
until (FindColor(x, y, greenLifeBar, 206, 127, 298, 196) = false);
if FindObjCustom(x, y, ['Cow'], [cowCOLOR1, cowCOLOR2], 50) 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_DOWN);
Wait(RandomRange(246, 632));
KeyUp(VK_DOWN);
KeyDown(VK_RIGHT);
repeat
Wait(RandomRange(74, 236));
until (FindObjCustom(x, y, ['Cow'], [cowCOLOR1, cowCOLOR2], 25))
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);
Result := DidRedClick
end
else
begin
case Random(2) of
0: Antiban();
1: MiniBreaker();
end;
end;
wait(RandomRange(2017, 2451));
end;

begin
ClearDebug;
writeln('Thank you for trying my cowkiller!')
SetupSRL;
DeclarePlayer;
ActivateClient;
Wait(RandomRange(2011, 2461));
SetupCowKiller;
repeat
while ClickCow(True) do
AntiRandoms;
until(not LoggedIn);
end.

rj

2013-03-29 16:53:48

This might be a problem with the OSR include I have seen a couple people get it on the 2007 randoms thread. Can

@Ashaman88 @DannyRS @euphemism @J J @Justin @Le Jingle

Confirm?

tealc

2013-03-29 16:54:00

not positive but i think u need to include a nickname
Nick := '';//use 3-4 letters of your display name

Ashaman88

2013-03-29 17:02:45

From: tealc
not positive but i think u need to include a nickname
Nick := '';//use 3-4 letters of your display name


This and put delcareplayers before setupsrl. Also since this is a combat script, set SRL_COMBATRANDOMS :=False;

Emarian

2013-03-29 17:42:59

Thanks for the quick response guys. Where exactly should I place SRL_COMBATRANDOMS and where should I put Nick := '';?

tealc

2013-03-29 17:58:34

From: Emarian
Thanks for the quick response guys. Where exactly should I place SRL_COMBATRANDOMS and where should I put Nick := '';?

try like this

Name:= ''; // Username here
Pass:= ''; // Password here
Nick:=''
Active:= True;

begin
ClearDebug;
writeln('Thank you for trying my cowkiller!')
DeclarePlayer;
SetupSRL;
SRL_COMBATRANDOMS :=False;
ActivateClient;
Wait(RandomRange(2011, 2461));
SetupCowKiller;
repeat
while ClickCow(True) do
AntiRandoms;
until(not LoggedIn);
end.

Emarian

2013-03-29 18:04:46

Sorry I asked that dumb question. I actually found it with the search function before I even came back to the thread. I got it all working now THANKS SO MUCH :P. I wouldn't know what to do without you guys. v3 will be up in the morning EST. Can anyone recommend a good way to include a fail-safe if it doesn't find a cow and is there any way to check if you are trying to attack someone else's cow?

EDIT:
It would also be nice if there was a way to pause the script while it is currently killing the cow. So it doesn't click other cows while in combat. This is kind of uncommon but I still want to fix it seems very bot-like.

EDIT2:
I was curious about using this guide to verify whether or not the player is within the falador cow pen (about to start that banking! xD). However, the icons on the minimap are kind of far apart, which can be seen here:


I'm also concerned because that thread said the minimap icons move slightly each time you log in. Would this method be feasible for this, or is there a better area to do this, or a better method?

EDIT3:
Sorry about all the questions, I just want to make this script flawless. How is the antiban on this script? I believe I have it fully implemented, but could someone look over it real fast and just tell me whether or not there is something in there that would make it very bot-like?

Justin

2013-03-29 20:24:13

From: Ashaman88
This and put delcareplayers before setupsrl. Also since this is a combat script, set SRL_COMBATRANDOMS :=False;


We should add a check in the function to check if the nick is set, if not, read the display name and automatically set it?

rj

2013-03-29 22:47:24

From: Emarian
Sorry I asked that dumb question. I actually found it with the search function before I even came back to the thread. I got it all working now THANKS SO MUCH :P. I wouldn't know what to do without you guys. v3 will be up in the morning EST. Can anyone recommend a good way to include a fail-safe if it doesn't find a cow and is there any way to check if you are trying to attack someone else's cow?

EDIT:
It would also be nice if there was a way to pause the script while it is currently killing the cow. So it doesn't click other cows while in combat. This is kind of uncommon but I still want to fix it seems very bot-like.

EDIT2:
I was curious about using this guide to verify whether or not the player is within the falador cow pen (about to start that banking! xD). However, the icons on the minimap are kind of far apart, which can be seen here:


I'm also concerned because that thread said the minimap icons move slightly each time you log in. Would this method be feasible for this, or is there a better area to do this, or a better method?

EDIT3:
Sorry about all the questions, I just want to make this script flawless. How is the antiban on this script? I believe I have it fully implemented, but could someone look over it real fast and just tell me whether or not there is something in there that would make it very bot-like?


try finding distance between pottery and trees


Also you can do a search box around your charactor that checks to see if there are > 2 NPC's inside of it like

CountColorTolerance(YELLOWDOTCOLOR, MMCX-20, MMCY+20, MMCX+20, MMCX-20, 25);