SRL Archive - Research & Development Lounge

(In-Dev) the iFight framework (for RS3)


KeepBotting

2014-08-07 18:50:27

the iFight framework
development thread

iFight will be an AIO fighter and looter. It's currently in early the alpha stages.

Concise list of features:
  • Fights any monster.
  • Takes any loot.
  • Detects and heals low HP.
  • Detects and cures poison.
  • Is quite stable (can run for ~50 hours).




Pictures
are worth a thousand words,

so some screenshots of the setup constants might do it more justice:


How about the functionlist, too?


Maybe even some progress repports?

From a very very early version, probably 0.2 or 0.3

More recent, 1.4




Media
see the script in action


This video of build version 0.8 demonstrates basic NPC attacking, NPC switching, combat detection, and healing.
At this time, right-clicking the NPC was compulsory, food support had not yet been added, and looting was nothing more than a thought.

[video=youtube;Az7m4Z2__OM]https://www.youtube.com/watch?v=Az7m4Z2__OM[/video]




This video of build version 1.1 demonstrates the above, with the addition of dynamic fight location detection (0.8 only used static TBoxes).
At this time, three different click types (left, right, double) were supported, as well as food, and taking one item from a loot pile was possible.

Try not to pay too much attention to the horrible object finding/clicking in 1.1, I picked these colors in about 5 seconds and didn't adjust my ATPA split correctly.

[video=youtube;ugTypL48hYM]https://www.youtube.com/watch?v=ugTypL48hYM[/video]




Updates
know what's going on

Broke 1,000 lines of code with build version 1.1 (and no, it's not just because there's a massive bitmap in there).

From 1.1 —> 1.4, the script now recovers from misclicks, is much faster in general, heals at much more effective times, and can automatically stop when a certain skill level is reached.

Currently working on Eventually going to work on getting the script to loot multiple items from a single loot pile.

Unfold

2014-08-07 18:54:37

Awesome. it looks great. Can't wait for the public release.

bonsai

2014-08-07 20:48:45

Sweet, I like it! How did you do the videos? Flight asked me to make one and I don't know what s/w to use.

tls

2014-08-07 20:58:04

From: bonsai
Sweet, I like it! How did you do the videos? Flight asked me to make one and I don't know what s/w to use.


http://lmgtfy.com/?q=screen+recording+software

ie: camstudio

KeepBotting

2014-08-07 21:31:30

From: bonsai
Sweet, I like it! How did you do the videos? Flight asked me to make one and I don't know what s/w to use.

CamStudio is the best.

& thanks :)

[XoL]

2014-08-07 21:46:43

Ah like Coh3ns script from the past, but better of course :)
Good luck!

tls

2014-08-07 21:47:42

From: [XoL]
Ah like Coh3ns script from the past, but better of course :)
Good luck!


narcle*

KeepBotting

2014-08-07 21:49:04

From: [XoL]
Ah like Coh3ns script from the past, but better of course :)
Good luck!


Which one of Coh3n's scripts? I haven't used many of them.

& thanks :P

From: tls
narcle*

Oh, that makes more sense. Hah, I doubt it'll beat Fast Fighter, that thing was legendary. But I'm staying hopeful :)

Sin

2014-08-07 22:39:18

Noticed you had TPA.centerPoint() as a function, did you know that

procedure MiddleTPA(TPA:TPointArray, var x,y:Integer);

existed? :P

Looks great though, can't wait to see it.

KeepBotting

2014-08-07 22:46:15

From: Sin
Noticed you had TPA.centerPoint() as a function, did you know that

procedure MiddleTPA(TPA:TPointArray, var x,y:Integer);

existed? :P

Looks great though, can't wait to see it.


function TPointArray.centerPoint():TPoint;
var
tpa:TPointArray;
begin
if (length(self) < 1) then exit;
tpa := self;
tpa.sortFromPoint(self.getMiddle);
result := tpa[0];
end;

Which is more efficient?

And thanks :)

tls

2014-08-07 22:50:14

From: KeepBotting
function TPointArray.centerPoint():TPoint;
var
tpa:TPointArray;
begin
if (length(self) < 1) then exit;
tpa := self;
tpa.sortFromPoint(self.getMiddle);
result := tpa[0];
end;

Which is more efficient?

And thanks :)


well getMiddle most likely calls MiddleTPA…so MiddleTPA is more efficient.

Sin

2014-08-07 22:50:29

From: KeepBotting
function TPointArray.centerPoint():TPoint;
var
tpa:TPointArray;
begin
if (length(self) < 1) then exit;
tpa := self;
tpa.sortFromPoint(self.getMiddle);
result := tpa[0];
end;

Which is more efficient?

And thanks :)


Doesn't really matter, you've already written it so there's no point changing everything now :p.

toxjq

2014-08-07 23:16:47

looks nice. will it have some sort of banking for like food and supplies?

Brandon

2014-08-07 23:18:55

From: Sin
Doesn't really matter, you've already written it so there's no point changing everything now :p.


OP could just wrap it in that case:



function TPointArray.centerPoint():TPoint;
begin
MiddleTPA(self, Result.X, Result.Y);
end;

to reduce the overhead without changing his function signature. Of course it's micro-optimisation but meh.. It counts I guess..

KeepBotting

2014-08-08 08:02:39

From: toxjq
looks nice. will it have some sort of banking for like food and supplies?
I don't forsee it, no.

From: Brandon
OP could just wrap it in that case:



function TPointArray.centerPoint():TPoint;
begin
MiddleTPA(self, Result.X, Result.Y);
end;

to reduce the overhead without changing his function signature. Of course it's micro-optimisation but meh.. It counts I guess..
True :) I wrapped all of these because I didn't want to type actionBar.whatever() every time :P


also, proggy!


cosmasjdz

2014-08-08 09:48:59

nice, myself have similar script for green drags with banking etc. But now the biggest problem is to find loot if its over screen. i mean i tried to get location by determining stable yellow dot on the map during the fight but sometimes actually most of the times it kills drag toofast, since 99range and i dont think any way of determining where loot is gona be about. My drags locating looks perfectly by taking angles of yellow dots in the minimap and settingscreen there. bot atm kills around 100 drags per hour with banking trips average around 15 mins for 20-24 drags, basicly loots only 85 percent of possible loot.

KeepBotting

2014-08-08 20:39:58

From: cosmasjdz
nice, myself have similar script for green drags with banking etc. But now the biggest problem is to find loot if its over screen. i mean i tried to get location by determining stable yellow dot on the map during the fight but sometimes actually most of the times it kills drag toofast, since 99range and i dont think any way of determining where loot is gona be about. My drags locating looks perfectly by taking angles of yellow dots in the minimap and settingscreen there. bot atm kills around 100 drags per hour with banking trips average around 15 mins for 20-24 drags, basicly loots only 85 percent of possible loot.


That's interesting, I never thought about using the minimap. I feel like that'd be pretty unstable because even if you can determine the general direction of the NPC, it'd still take some guesswork to figure out exactly where it is on the mainScreen.

Personally, I like to create a TPA of the red targeting reticule that appears on the ground around the NPC you're fighting.
Then I grab the bounds of the TPA, and get a TBox of the NPC's exact location. Refresh it every ~1 second of combat to track NPC movement.
Then just search inside the TBox for loot.

Also, another proggy :)


cosmasjdz

2014-08-09 02:45:49

From: KeepBotting


Personally, I like to create a TPA of the red targeting reticule that appears on the ground around the NPC you're fighting.
Then I grab the bounds of the TPA, and get a TBox of the NPC's exact location. Refresh it every ~1 second of combat to track NPC movement.
Then just search inside the TBox for loot.



How have i never thought about it……… ur idea is great, gona try to script it tomorrow. Personally what now i am doing is getting minimap angle, then getting each of npc dot on the minimap distance from minimap center, getting npc dots angles and rotating screen to make one of the corners(usually closest one)of the screen to face the closest mob on the minimap(need some trigonometry knowledge, not a quesswork), then if i cant see it i rotate to the second closest and so on. but usually like 95 percent first is enough. because in the corner when u ranging is more room to see either and and loot. but if i rotate to the north of the screen i sometimes dont see loot pile. And it works flawless, althrough i got like +-10 degrees difference but the difference isnt great to make targeting npc fail and that deviation works like antiban too :D

by the way yesterday made quick loot function(also made some deviation in looting), now it runs alittle faster. Made some banking deviation. also bought armadyl crossbow, used rune before with 99 range haha, my poor knowledge of rs3… Need to work on more running deviation, misslicks for antiban, add more failsafes, and return to killing after getting pked, also prolly need to fix switchtoworld function since dont think anyone is working on them atm. My rune miner is unemployed like 3rd week atm because of that :D

The Mayor

2014-08-09 03:49:04

From: cosmasjdz
getting npc dots angles and rotating screen



function TRSMinimap.rotateToPoint(pnt: TPoint): boolean;
begin

end;

Will come in handy, you should do it ;)

cosmasjdz

2014-08-09 04:24:01

From: The Mayor

function TRSMinimap.rotateToPoint(pnt: TPoint): boolean;
begin

end;

Will come in handy, you should do it ;)


how havent i seen that. Anyways i need to alter rotation to a corner. but that function would make it alot eazier

tls

2014-08-09 04:27:19

In my roach killer I played with several different looting methods. First I tracked the npc with onscreen tracking methods and when I detected it dying I waited for the red dot to appear on the minimap then used a minimap-mainscreen calculation, created a box from that point on the screen and then searched for loot colors. I eventually grew tired of adding new loot colors or adjusting the old ones, and actually just filtered out the most common colors(ie floor, larger objects). In the end I found my best method was to actually create a very extensively tested floor color finding and then filtering that out of the box. Worked almost perfectly but took a lot of time to make sure I set up the cts2 values correctly(hopping worlds, resetting smart, using more than one account). I think I got over 2000 screenshots before I trusted it. But my onscreen tracking was almost perfect, it would be very useful for you to check it out…if you can even read my sloppy code.

The Mayor

2014-08-09 07:02:15

From: cosmasjdz
how havent i seen that. Anyways i need to alter rotation to a corner. but that function would make it alot eazier


No no, I mean you should make it :p

cosmasjdz

2014-08-09 10:15:40

ok got it i might do it:D

cosmasjdz

2014-08-09 11:23:37

From: The Mayor
No no, I mean you should make it :p


here it goes, tested, like said before with high angles around 10 degrees deviation.



///////////////////////////////////////////////////////////////////
// function Minimap.RotateToPoint( DotType: integer; MainscreenLocation: integer): boolean;
//
// Rotates the mainscreen to the closest of the selected type minimap point at the selected angle
//
// top is 0 right 90 bottom 180 left 270
//
// by cosmasjdz 2014-08-09
//
// example: Minimap.RotateToPoint(MM_DOT_NPC,0); this rotates screen so the closest yellow dot on the minimap becomes north of the screen
//
////////////////////////////////////////////////////////////////////
function TRSMinimap.RotateToPoint( DotType: integer; MainscreenLocation: integer): boolean;
var
TPA: TPointArray;
t: tpoint;
k,m: extended;
xv,yv,i,ml: integer;
begin
ml:=mainscreenlocation;
t:=self.getCenterPoint();
TPA:=self.getdots(DotType,self.getbounds());
if high(tpa)=-1 then
begin
writeln('No such type dots found on the minimap, quiting procedure');
result:=false;
exit;
end;
SortTPAFrom(TPA, t);
writeln('Trying to rotate to the closest '+tostring(dottype)+' dot '+'at angle of mainscreen of '+tostring(Mainscreenlocation));
xv:=tpa[0].x-t.x;
yv:=t.y-tpa[0].y;
k:=degrees(ArcTan2(yv,xv));
m:=(self.getangledegrees());
self.setangle(trunc(k+m-90+ml));
result:=true;
writeln('Succesfully rotated');
end;

most of the time i use either 45 or 315 degrees to make it go to corner for clearwer view.

KeepBotting

2014-08-09 11:54:55

From: tls
In my roach killer I played with several different looting methods. First I tracked the npc with onscreen tracking methods and when I detected it dying I waited for the red dot to appear on the minimap then used a minimap-mainscreen calculation, created a box from that point on the screen and then searched for loot colors. I eventually grew tired of adding new loot colors or adjusting the old ones, and actually just filtered out the most common colors(ie floor, larger objects). In the end I found my best method was to actually create a very extensively tested floor color finding and then filtering that out of the box. Worked almost perfectly but took a lot of time to make sure I set up the cts2 values correctly(hopping worlds, resetting smart, using more than one account). I think I got over 2000 screenshots before I trusted it. But my onscreen tracking was almost perfect, it would be very useful for you to check it out…if you can even read my sloppy code.
Sounds great, I'll Czech it out :)

writing some new functions :P

function getMousePos2():TPoint; //returns the mouse position as a TPoint
var
x, y:integer;
begin
getMousePos(x, y);
writeDebug('Mouse position: (' + toStr(x) + ', ' + toStr(y) + ')');
result := point(x, y);
end;