SRL Archive - OSR Help

Need help with making a fighting script.


J J

2012-03-03 06:02:45

Hi

I'm working to make a fighting script that can loot certain items and that will use a summoning familiar to help with the fighting.

Onto my questions.
If I'm in combat I want the script to click on the summoning icon() and on the monster I'm fighting.

This is what I have so far, it works but it has some flaws.
procedure FamiliarAttack;
var
X, Y, SumIcon: integer;

begin
SumIcon := BitmapFromString(6, 6, 'meJybN7N5/bLpEHTs9IG7b292VufB' +
'RTZsXQsUDPB3AwrOQ1KZmZ0IFOyqzps/s3k+WByooAumBiII1AhBE' +
'JGNW9cCAPuxQX4=');

if srl_InFight then
if (FindBitmapToleranceIn(SumIcon, X, Y, 688, 130, 725, 163, 10)) then
begin
MMouse(X, Y, 5, 5);
Mouse(X, Y, 0, 0, True);
if FindColorSpiralTolerance(X, Y, 7488848, 216, 106, 327, 227, 10) then
begin;
MMouse(X, Y, 5, 5);
Mouse(X, Y, 0, 0, True);
end;
end;
FreeBitMap(SumIcon);
WriteLn('We are in fight and let the familiar attack');
end;


This checks if there is a HP bar above my character and if there is, it will click on the summoning icon, look for a color of the monster close to me and click on the monster.

The problem is that it might click on a different monster that is close to me. And if a monster is walking around you can't really attack it with FindColorSpiralTolerance because it will misclick.

Questions:
  • How can I make the script randomly click anywhere between the red outlined area: . A bitmap would only click around that part, how can I let the script click anywhere between the red outlined area? Is there any special function?
  • What is the best way of detecting monsters? I have been looking at other fighting scripts and they seem to use a lot of interesting stuff to detect the monsters, is there anyone that can help me out with a short guide or a link to a guide (I couldn't find one)
  • Is there a function hardcoded in Simba that can detect the HP bar of the monster you are fighting? If not, what is the best way of doing this?

That's pretty much it for now
Summarized:
I'm looking for help with detecting and attacking walking monsters; detecting the HP bar of the monster I'm fighting and clicking anywhere on the summoning icon.

Thanks in advance!

Nebula

2012-03-03 12:44:51

To click the summoning Icon, since it doesn't move, I'd create something like this:


Case Random(2) of
0: MouseBox();
2: MouseCircle();
end;

If you dont know how to use MouseBox and MouseCircle, look for it in the functions list.

J J

2012-03-03 14:32:02

From: Nebula
To click the summoning Icon, since it doesn't move, I'd create something like this:


Case Random(2) of
0: MouseBox();
2: MouseCircle();
end;

If you dont know how to use MouseBox and MouseCircle, look for it in the functions list.

Thanks, about to look into this. I was also thinking of making a DTM for the summoning icon and let simba click somewhere randomly inside of the DTM. But I'm not sure if that works. I'll look into the mousebox and mousecircle.

bud_wis_er_420

2012-03-03 20:22:40

For monster misclicking, maybe check if monster has a health bar too b4 clicking to attack with summoned creature.

Edit: sry sould have explained better.
Make a bitmap or dtm of the health bar and look for it directly above where it found the monster.

J J

2012-03-04 10:07:33

From: bud_wis_er_420
For monster misclicking, maybe check if monster has a health bar too b4 clicking to attack with summoned creature.

Edit: sry sould have explained better.
Make a bitmap or dtm of the health bar and look for it directly above where it found the monster.

Yeah I think that is the best way - as far as I know :P I've had some help from YoHoJo and I'm using auto color right now which is great. If anyone has some more tips, let me know :)

xtrapsp

2012-03-05 09:28:47

From: RuneScapeJJ
Yeah I think that is the best way - as far as I know :P I've had some help from YoHoJo and I'm using auto color right now which is great. If anyone has some more tips, let me know :)


Have a look at my monk script:
http://villavu.com/forum/showthread.php?t=76595

It's basic but it has the principles all there :) feel free to use it amigo

just change the monk settings + add your parts