You'd have to create a proxy of some description, good examples can be found within TibiaAPI (look for the event AddScreenTExt or similar) and BlackD Proxy. I can't go into much more detail as unfortunately I just don't know, sorry!
RedSqaure is in the battle list FYI, so you can find that quite easily just by reading battle list, then for each creature if redsquare == 1 do your ting.
Another method is perhaps to do this:
Listen for red square. When red square found:
1. Store red square creatures addresses/offsets in a set of variables.
2. Read these variables one by one (especially health variable) every X ms.
3. If HP decreases in the creature which has red square, chances are you've probably done damage to it, so do whatever you wanted to do.
Possible limitations include that this won't work if you don't do any melee damage / damage without casting spells, and you can't be 100% certain it was you who did the damage, it's also possible that (if you're trying to make a spell casting system) you could end up getting red skulls using your bot quite easily... If you have a target and another player SDs it, you will cast a spell as you are attacking it and it lost health, if that player then kills it between SDing it and you finishing the spell casting, you will still cast your spell.
Last edited by XtrmJash; 03-06-2013 at 03:34 PM.
Target ID still exists. You simply find the monster with the same ID as target ID and you've found your red square.
I'm already doing this. I'd like it to be more accurate. I want to find the bit of memory that fires when a projectile shoots out of my character. I'd like to know for certain that it's my attack and I'd like to know as early as possible when my attack actually sent.
In case someone has a good solution to my real problem, rather than the stated problem, I'll state my real problem. I'm trying to make an auto-striker(sanner) that strikes as soon as I shoot an Assassin Star or bolt. Using the health reduction method works pretty well, but it feels like I can get it to be more accurate and faster. The attack delay resets after sending San, so the sooner after the first strike you use San, the better.
As it stands right now, I shoot ammo, it takes about 200ms for it to see the health go down, then I San, then it waits 2 seconds before shooting ammo again. (Total cycle time 2.2 seconds) If I attack with only ammo, there is only a two second delay between each attack. (Total cycle time 2 seconds) If I attack, then wait 1 second before sanning, the situation gets worse. It will shoot ammo, wait a second, San, then wait two more seconds to shoot again. (Total cycle time 3 seconds)
I'm trying to get the shooting and sanning as close together as possible so I can attack most effectively.
If you simply just San every 2 seconds, sometimes the shooting blocks the San (you are exhausted), and sometimes the San blocks the shooting. I need to know the exact instant that the projectile is being fired to spell strike at the same time.