SRL Archive - First Scripts

[OSR] Simple Monster Killer


lollol012

2014-02-03 06:10:02

Hi.

So, while waiting for account activation, most resources were unavalible to me (due to being attachments), so I decided I might as well make a script;


program new;
{$DEFINE SMART}
{$i srl-OSR/srl.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
{$i SRL-OSR/SRL/core/antirandoms/C_AntiRandoms.simba}
var i:integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Nick := 'mxs';
Name := 'aPerson';
Pass := 'aPassword';
Active := true;
end;
end;

procedure KillX;
var
x,y:integer;
var
PBox: TBox;

begin

PBox := IntToBox(245, 130, 285, 195);

repeat
Writeln('Searching for random events...');
FindCustomRandoms;
MakeCompass(randomrange(0, 360));
wait(random(1000));
findobj(x,y,'Cow',122847,500);
// writeln(IntToStr(x) + ' ' + IntToStr(y));
Mouse(x,y,3,3,false);
until(ChooseOptionMulti(['Attack']));

wait(2500+random(1000));

repeat
// writeln(IntToStr(AveragePixelShift(PBox, 250, 1500)));
wait(500);
Writeln('Searching for random events...');
FindCustomRandoms;
until(AveragePixelShift(PBox, 250, 1500)<200);
wait(1000+random(2000));
writeln(i);

end;

Procedure DebugShiftCount;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Writeln(IntToStr(AveragePixelShift(PBox, 250, 1500)));
end;

Procedure Antiban;
begin
case Random(70) of
1:RandomRClick;
24: HoverSkill('Strength', False);
32: PickupMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
68: SmallRandomMouse;
end;
end;


begin
ClearDebug;
DeclarePlayers;
SetupSRL;
SetupCustomRandoms;
LoginPlayer;
i:=0;
repeat
if not LoggedIn then Exit;
Antiban;
KillX;
i:=i+1;
until(i=10000);
end.


Now, this a version I modified just a few minutes ago, as of writing this thread, after finally being able to download C_AntiRandoms. It's relevant due to one of my problems being with randoms.

Problem 1
It seems like this does not detect randoms, or at least didn't do so earlier. I personally saw as it ignores: Box, Rick Turpentine and Mr. Hyde - that's only after I put an antirandom script in every loop. I left it last night, and my char died after about 200 cows (about an hour), which means FindNormalRandoms failed to solve a lethal event.
I now downloaded C_AntiRandoms, so maby it helps. But who knows.

Problem 2
Not directly related, but I can't run SPS. Described it at another thread you can find in OSR Help. This is the reason I can't fight in open areas (cause I can't make a failsafe who runs back to the middle), and why I can't collect loot (cause obviously I can't bank it).

Possible Additions:
Autoheal - It's easy to check your HP and eat food. I just dont see any use for it, as I wont be fighting mobs that require food until I can bank items - and that wont happen until my SPS works.
Pick/Bank Items - As said above. Can't do it without working SPS.

Could you help?
Apart from the problems, I would be thankful if you linked a certain script - assuming it exists, of course.
I really need a better Object Finder for moving objects. For example, a script similar to FindObj that doesn't just move to random points, but checks the colors all along the line (with 10 pixel intervals, for example). Or anything, really. FindObj is just slow as fuck, each point has a huge probability to miss.

Edit: Just had it ignore a Strange Plant, which I had to manually pick in the last second. Failed random event streak continues.

Krazy_Meerkat

2014-02-06 08:21:04

Hmm.. It looks like you included Reflection.simba but you didn't use any reflection functions :p If you do want to use reflection functions you also need to call SetupReflection; after SetupSRL; otherwise, you should remove the it from the top of your script..

For the problem with randoms, you are calling FindCustomRandoms; not FindNormalRandoms;

Try FindColorSpiralTolerance(x, y, 122847, MSX1, MSY1, MSX2, MSY2, 20); for fast object finding..

If you can't get SPS walking working then try using tiles with reflection, elfyyy has set up a guide on reflection here: http://villavu.com/forum/showthread.php?t=107698

lollol012

2014-02-11 08:57:49

Thanks for the reply. It was a script I made when my account asn't activated, so I couldn't download C_Randoms back then =P
It's all fixed, but thanks.

Also, is FindColorSpiralTolerance faster then making DTMs of the monster heads (even multiple ones, each for its own angle) and searching for the monsters this way, when the Camera is at max height?