SRL Archive - SRL Suggestions

New Infight Procedure


putonajonny

2012-04-13 10:20:32

This procedure uses those hit splats like this: it keeps checking for them until it goes 2000msec without seeing them, in practice it works really well, the can not be confused with other peoples because they are a different colour:
I will talk you through it

Procedure WaitFight;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin

WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
SetDTMName(WaitFight_Shield, 'WaitFight Shield DTM');
SetDTMName(WaitFight_Damage, 'WaitFight Damage DTM');

FFlag(0); //Incase you clicked a monster that isn't close by
MarkTime(Time); //marks the time
Repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2))then //if it finds the blue "shield" dtm it resets the time marker
MarkTime(Time);
if(FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2))then //if it finds the red "damage" dtm it resets the time marker
MarkTime(Time);
Until(TimeFromMark(Time) > 2000); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);

end;

I have made the DTM of the left part of the Red "Damage" image so it doesn't matter if it is one two or three digits it will still find it.

I made this for my Giant Spider Killer, (in SRL Members only atm for testing) feel free to copy it to use it in your scripts if it doesn't go in the include, if you would be so kind to put my name by it that would be nice :)

Test:
Success :D

Another Function that people have talked about could go something like this:
function FindFightSymbols(Var x, y : integer) : Boolean;
Var
WaitFight_Shield, WaitFight_Damage : integer;
begin

WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
SetDTMName(WaitFight_Shield, 'WaitFight Shield DTM');
SetDTMName(WaitFight_Damage, 'WaitFight Damage DTM');

if(FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2))then //if it finds the blue "shield" dtm it returns true
begin
Result := True;
exit;
end;
if(FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2))then //if it finds the red "damage" dtm it returns true
begin
Result := True;
exit;
end;

FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);

end;

Sin

2012-04-13 10:26:45

Verrryyyyy nice!
I'll be using this now for my Giant Spider Killer and Frost Dragoner, +rep for you :)

Flight

2012-04-13 10:28:11

Oh yeah, neat way of detecting our own player's combat event. You could also use the same tactics to determine what type of damage our player is receiving, so we know which armor to use or which prayer to enable.

If I might make a suggestion, there's some WaitFindDTM functions in the timing.Simba file you might find helpful. Here's the best one to use:

function WaitFindDTMEx(DTM: integer; var x, y: integer; xs, ys, xe, ye, WaitPerLoop, MaxTime: integer): boolean;

Oh one more thing. Because the function is stand alone, it's better to keep those DTMs local. Just create them and free them within the function.

putonajonny

2012-04-13 10:35:19

From: Sin
Verrryyyyy nice!
I'll be using this now for my Giant Spider Killer and Frost Dragoner, +rep for you :)


Thanks very much :) feel free :D

From: Flight
Oh yeah, neat way of detecting our own player's combat event. You could also use the same tactics to determine what type of damage our player is receiving, so we know which armor to use or which prayer to enable.

If I might make a suggestion, there's some WaitFindDTM functions in the timing.Simba file you might find helpful. Here's the best one to use:

function WaitFindDTMEx(DTM: integer; var x, y: integer; xs, ys, xe, ye, WaitPerLoop, MaxTime: integer): boolean;

Oh one more thing. Because the function is stand alone, it's better to keep those DTMs local. Just create them and free them within the function.


yes I hadn't thought of using it for that, the script it is on only fights mele monsters, however if there was a request for this I would make it, I think you are probably right they should be created then freed in the same loop, as for using that function, because we are looking for 2 different DTMs (one of which may go some time without being show) without swapping between them a lot I don't know how it would work

Joe

2012-04-13 11:19:22

Very interesting… I've given up on a lot of my fighting "attempts". This may encourage me to revisit them :)

Er1k

2012-04-13 11:47:16

Have been thinking about this all these times but really never thought it would work so nicely! Nice work!

Justin

2012-04-13 11:49:47

I can see this working very well. Nice release, hope this is pushed to SRL5

Abu

2012-04-13 12:28:31

If it works, then full support!

Sassakill

2012-04-13 12:44:50

Ah sweet!
That would be beast to use!

Justin

2012-04-13 12:49:08

http://runescape.wikia.com/wiki/Two-handed_sword

According to RSWikia, 3 seconds is one of the slowest weapons in RuneScape, so you might want to change the wait time to something like 3500

xtrapsp

2012-04-13 12:53:46

It's so simple.. yet… so effective :D Great work!

Couldn't be bothered to do my slayer task.. used this. PERFECT

Coh3n

2012-04-13 14:27:20

From: [J]ustin
http://runescape.wikia.com/wiki/Two-handed_sword

According to RSWikia, 3 seconds is one of the slowest weapons in RuneScape, so you might want to change the wait time to something like 3500
Or have the wait time set by the scripter. ;) I like this. I'm willing to add it with a few improvements suggested and assuming it works.

Harry

2012-04-13 14:29:51

Nice work. The 0 damage hit is a different color than other people's though?

Coh3n

2012-04-13 14:31:15

From: Harry
Nice work. The 0 damage hit is a different color than other people's though?
It'll detect the blue shield, won't it? Or is something different shown if the player hits "0"?

bolshak25

2012-04-13 16:58:06

it would show the blue shield, and you dont see other players hitting 0's so that part is nice

eska

2012-04-13 17:19:39

Very good idea. The other function get confused when an npc/player with his hp bar up walk nearby.

Sir Ducksworthy

2012-04-13 18:19:39

This is the exact same thing Ive been using in Ghetto Bot, In Combination with Xp Counting.
The reason I didn't make it public is because I really didn't want to risk Jagex maybe making a small update to correct the color's.
This should prob's be in the Member's section, It really does effect how Bot Like you look compared to the Infight function.

Total

2012-04-13 18:29:11

Looks like a nice procedure to be used.

Sin

2012-04-13 22:46:51

From: leetsxc
This is the exact same thing Ive been using in Ghetto Bot, In Combination with Xp Counting.
The reason I didn't make it public is because I really didn't want to risk Jagex maybe making a small update to correct the color's.
This should prob's be in the Member's section, It really does effect how Bot Like you look compared to the Infight function.


Not everything needs to be in the members section…

Sir Ducksworthy

2012-04-14 00:42:21

Thx for stating the obvious Sin………
Not everything, but thing's like this do, sharing this here is pointless anyway because I bet you, Barely anyone that hasn't attained members status will even use it and it is here for everyone to see for no reason I don't see the point, this function is exploiting the Color differences why risk an exploit like this to be fixed were just gonna end up with nothing to use if we keep on going without worrying about this once the next nuke comes along. This function let's you speed fighting up significantly which let's you not look like a bot so bad so when stupid gold farmers and other places end up here using our method trying to do the exact same stuff as before the nuke because they wont have reflection we will all look the same now won't that be fun..

riwu

2012-04-14 05:20:10

Great function, will definitely be using it when i start making combat scripts. Rep+!
And leet, dont worry those chinese goldfarmers use reflection/injection, so they wont need this ;)

Coh3n

2012-04-14 16:43:01

From: leetsxc
Thx for stating the obvious Sin………
Not everything, but thing's like this do, sharing this here is pointless anyway because I bet you, Barely anyone that hasn't attained members status will even use it and it is here for everyone to see for no reason I don't see the point, this function is exploiting the Color differences why risk an exploit like this to be fixed were just gonna end up with nothing to use if we keep on going without worrying about this once the next nuke comes along. This function let's you speed fighting up significantly which let's you not look like a bot so bad so when stupid gold farmers and other places end up here using our method trying to do the exact same stuff as before the nuke because they wont have reflection we will all look the same now won't that be fun..
I could say the same thing about all of SRL's functions. SRL is open source, so anyone can look at whatever code they want.

Sex

2012-04-14 17:00:05

From: leetsxc
Thx for stating the obvious Sin………
Not everything, but thing's like this do, sharing this here is pointless anyway because I bet you, Barely anyone that hasn't attained members status will even use it and it is here for everyone to see for no reason I don't see the point, this function is exploiting the Color differences why risk an exploit like this to be fixed were just gonna end up with nothing to use if we keep on going without worrying about this once the next nuke comes along. This function let's you speed fighting up significantly which let's you not look like a bot so bad so when stupid gold farmers and other places end up here using our method trying to do the exact same stuff as before the nuke because they wont have reflection we will all look the same now won't that be fun..


Lol…this thread is about a proposed induction into the include. The include is public therefore this thread should be public if the code within it is going to be public..

m34tcode

2012-04-16 01:09:07

looks like if someone is fighting something near/under you, the script will hang

EDIT: haven't fought in rs in a while, forgot other players hit splats will be darker. The function looks great then. Maybe add another param that accepts a pointerto a func, to be executed while fighting?

Or even better, make the function an Is Fighting function.

Instead of your loop, the user can write his own. maybe search for randoms/wtv he feels necessary.

And also, jagex cant fix the color difference, because then people wouldn't know who hit what. that's why they updated the colors.

Shatterhand

2012-04-16 04:48:32

Some questions:
1. That (MSCenter - 60) circle… I guess this procedure will look for the first hit we GET on our players. But what if someone is standing on us. Blue shields have different colors too?
2. It isnt that fast to detect we are in fight. Sometimes it takes like 2 seconds to GET a hit after we MAKE our first hit. (like ranging)

Best solution would be to look for the first hit we MAKE, but blue shields… fustrating.

By the way my method for fighting: waiting till hpbar appears (2 sec max). This needs that no one is around us, so I made a world changing function. Pretty easy and safe botting, but of course cant do this at anywhere.

Sex

2012-04-16 05:17:26

From: hunt3rx3
Some questions:
1. That (MSCenter - 60) circle… I guess this procedure will look for the first hit we GET on our players. But what if someone is standing on us. Blue shields have different colors too?
2. It isnt that fast to detect we are in fight. Sometimes it takes like 2 seconds to GET a hit after we MAKE our first hit. (like ranging)

Best solution would be to look for the first hit we MAKE, but blue shields… fustrating.

By the way my method for fighting: waiting till hpbar appears (2 sec max). This needs that no one is around us, so I made a world changing function. Pretty easy and safe botting, but of course cant do this at anywhere.

Blue shields don't show up as we don't see other people's zeroes.

Sir R. M8gic1an

2012-04-16 06:43:44

In fact it should be a function rather than a procedure, so that it can result true or false;
If it gets in the include, it'll go into fighting.simba, and personally I'd have the DTMs loading on fighting setup and freeing on a FreeFighting procedure.

I'd also consider making a WaitFightEx, which instead of using MSC uses a TPoing provided by the script, so that WaitFightEx can be used by mages & rangers without having to wait for the monster to reach you, including the possibility that it doesn't reach you at all cus it dies on the way or you are safe spotting.

Other than that, looks good.

-RM

JuKKa

2012-04-16 08:09:07

From: Sir R. M8gic1an
In fact it should be a function rather than a procedure, so that it can result true or false;
If it gets in the include, it'll go into fighting.simba, and personally I'd have the DTMs loading on fighting setup and freeing on a FreeFighting procedure.

I'd also consider making a WaitFightEx, which instead of using MSC uses a TPoing provided by the script, so that WaitFightEx can be used by mages & rangers without having to wait for the monster to reach you, including the possibility that it doesn't reach you at all cus it dies on the way or you are safe spotting.

Other than that, looks good.

-RM


The facto that you are searching for your own damage bubbles, gives you the freedom to search the whole mainscreen, right? so no need for a WaitFightEx. This should be tested however.

this is what i did with the code snippet


Function WaitFight: Boolean;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');

MarkTime(Time); //marks the time
Repeat
Wait(50+Random(50)); //MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70
Result := FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2)or
FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2);
Until(TimeFromMark(Time) > 2250)or(Result); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;

Sir R. M8gic1an

2012-04-16 09:26:11

From: JuKKa
The facto that you are searching for your own damage bubbles, gives you the freedom to search the whole mainscreen, right? so no need for a WaitFightEx. This should be tested however.

this is what i did with the code snippet


Function WaitFight: Boolean;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');

MarkTime(Time); //marks the time
Repeat
Wait(50+Random(50)); //MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70
Result := FindDTM(WaitFight_Shield, x, y, MSX1, MSY1, MSX2, MSY2)or
FindDTM(WaitFight_Damage, x, y, MSX1, MSY1, MSX2, MSY2);
Until(TimeFromMark(Time) > 2250)or(Result); //if it hasn't found either for 2000msec then it exits, (i don't play RS much, is there a very slow weapon that this wouldn't work for?)
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;


I do think that could be quite a speed hogger. In fact I'd love if that coud then return the xy of where it found the fight so that I could then stick it into WaitFightEx and have it run a lot faster.

-RM

JuKKa

2012-04-16 09:36:27

From: Sir R. M8gic1an
I do think that could be quite a speed hogger. In fact I'd love if that coud then return the xy of where it found the fight so that I could then stick it into WaitFightEx and have it run a lot faster.

-RM

You're wrong. Its very fast

Sir R. M8gic1an

2012-04-16 14:28:31

From: JuKKa
You're wrong. Its very fast


Fine, but if I want to check the HP bar to see if there's any green left so that I can change monster as soon as it dies I'd need an x & y.

-RM

putonajonny

2012-04-16 18:00:56

From: Sir R. M8gic1an
Fine, but if I want to check the HP bar to see if there's any green left so that I can change monster as soon as it dies I'd need an x & y.

-RM


Have a look at the function I just put at the bottom of the OP

eska

2012-04-16 18:07:02

Working good. Just took your function and manipulated it to fit my need.

I basicaly use the InFight function to see if the script should use your function. Once it think it might be in fight, it uses your function to confirm if we are the one under attack, or if it is just a false positive.

I'm using it at LRC in w84 (there is a crap load of people there, if it works there, it works everywhere) and it never fail. It only detect when I am the one under attack and it run to the bank to get the living rock creature off my ass.

Brandon

2012-04-18 15:11:49

Magician is right.. This is extremely slow on attack starts.. if ur already in a fight, then it's very fast.. but if ur using it to fight a monster, it is very slow as it will always wait that 2.5 seconds. If you lower the timer any more than that well it will start returning false positives. Using InFight to determine whether to use this function or not would be useless.. is this not supposed to remove the limitation and slowness of looking for an HP Bar? :S

eska

2012-04-18 15:21:26

From: ggzz
Magician is right.. This is extremely slow on attack starts.. if ur already in a fight, then it's very fast.. but if ur using it to fight a monster, it is very slow as it will always wait that 2.5 seconds. If you lower the timer any more than that well it will start returning false positives. Using InFight to determine whether to use this function or not would be useless.. is this not supposed to remove the limitation and slowness of looking for an HP Bar? :S


No, it's used to eliminate false positive, or at least that's what I'm using it for.

function UnderAttack: Boolean;
Var
Time, x, y, WaitFight_Shield, WaitFight_Damage : integer;
begin
if InFight then
begin
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IGaBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8='); //Sets DTMs and Names
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBSBWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA==');
SetDTMName(WaitFight_Shield, 'WaitFight Shield DTM');
SetDTMName(WaitFight_Damage, 'WaitFight Damage DTM');
MarkTime(Time);

repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, x, y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70))
or (FindDTM(WaitFight_Damage, x, y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70)) then
begin
Result:= True;
Break;
end;
until(TimeFromMark(Time) > 3500);

FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;
end;


This is the function I added to the LRC script in your thread. It detect if I am under attack by a living rock creature and decided if I should run away of keep mining.

As you know, LRC is crowded in world 84, and this means that the InFight function will return alot of false positive, since it also detect other's people HP bars.

With this function, everytime it detect an HP bar, it double check with the damage splash (or shield) and that way I can be 100% sure that I am the one under attack.

blother

2012-04-18 18:00:15

Could other players' damage be used to keep from attacking something already in combat with another player? Not sure if there is already a good way to do this.

i3egoHan

2012-04-18 18:26:01

Umm not sure if you added assigned those DTM's in there just so people can test easy… But you should load/free dtms on every function call..

Declare them globally and speed will be much better.

Anyway very nice function, I think it should be added.

m34tcode

2012-04-18 18:26:11

^great idea.

Expanding in the infight proecde, we could get an array of hitsplat locs, and find a monster who is not right next to/on a hit splat. If no matches are found, maybe just click the one farthest from a hitsplat, and hope its not under atk? or could just return false so that it can be called again when a monster has spawned away from hitsplats.