SRL Archive - OSR Help

A bit of TPA help please.


l6bustank

2013-07-29 18:01:36

I want to write a looter function for my 07 melee fighter.
I was planning to find the drop by finding the hp bar of my current enemy (the drop will appear relative to the coords of the hpbar). To find my enemys hp bar, I think
1. I need to find all the hp bars on mainscreen (as TPAs)
2. Make an ATPA of them
3. Find the array (ATPA) member that is in the center (my own hp bar)
4. Find the next member which is closest to the member in the center (that would be the NPC I am fighting)
5. Wait for its color to turn all red (getting the NPC "redbarred")+store the coords at the same moment
6. Wait for the red bar disappear
7. Move mouse to coords relative to the ones stored in 5.
8. Loot.

my problems are: 1)how to find the center member 2)how to find the ATPA member closest to it 3)how to detect the "all red"?
I understand there is sth like FindAllHPBars in the include but how to use it (if possible)?

Really appreciate the help :)

Ian

2013-07-29 18:12:27

1) Find the closest one with
SortATPAFromMidPoint(ATPA, (Point(MSCX, MSCY)));
then ATPA[0] will be the closest

2) Find the closest one to that by saving the closest one's x and y and then sorting from that like we did last time, but we'd use Point(Closest.x, Closest.y) instead of Point(MSCX, MSCY).

3) To detect all red, make an ATPA of all the red bar colors. Then extend the TPA bounds by a few pixels on the left, and search for green. If it finds the green, delete the TPA. After you do this for all of them the ones left will be the TPAs that are only red :)

l6bustank

2013-07-31 14:00:38

From: BMWxi
1) Find the closest one with
SortATPAFromMidPoint(ATPA, (Point(MSCX, MSCY)));
then ATPA[0] will be the closest

2) Find the closest one to that by saving the closest one's x and y and then sorting from that like we did last time, but we'd use Point(Closest.x, Closest.y) instead of Point(MSCX, MSCY).

3) To detect all red, make an ATPA of all the red bar colors. Then extend the TPA bounds by a few pixels on the left, and search for green. If it finds the green, delete the TPA. After you do this for all of them the ones left will be the TPAs that are only red :)


ok, thx for the tip :)

Btw, does anyone know how to convert a TIntegerArray into something that I can read from console (like IntToStr does)?

rj

2013-07-31 14:03:27

From: l6bustank
ok, thx for the tip :)

Btw, does anyone know how to convert a TIntegerArray into something that I can read from console (like IntToStr does)?


ToStr(varhere)

l6bustank

2013-07-31 14:17:29

thanks m8 :D