SRL Archive - OSR Help

Scripting help


00smurf7

2014-11-06 21:37:11

Hi there im currently trying to write a basic combat script for OSRS not something to complex what is the best way to check if in combat? and that being said are there other methods?

Wetish

2014-11-06 21:46:43

The easiest way would be to check if there is a health bar above the player.

Some thing like this. You could change "MSX1,MSY1,MSX2,MSY2" to coordinates of a box surrounding the player if you don't want to search the whole screen for a health bar.

function IsInCombat: Boolean;
var
x, y, : Integer;
begin
Result := false;
//searching for the green of a health bar //searching for the red of a health bar
if ((FindColorTolerance(x, y, 65280, MSX1,MSY1,MSX2,MSY2, 5)) or (FindColorTolerance(x, y, 255, MSX1,MSY1,MSX2,MSY2, 5))) then
begin
Result := true;
end;
end;

You could also check for the red/blue hitsplats on the player. You can check out hoodz' script for an example. https://villavu.com/forum/showthread.php?t=99977

00smurf7

2014-11-09 10:40:24

Thank you so much this will help a ton. Is there a way to pull a list of functions or commands ( not sure the proper term) or is it just based on memorization. IF there is a list/post on this already i apologize. specifically curious about a lot more of the Runescape specific functions such as the smart finding of specific item slots or the deposit button on the bank ect…I like the game but im more taking this oportunity to try and take another hack at learning this, I've tried in the past and i really enjoy learning and the challenge of it.

Wooty

2014-11-09 11:33:56

From: 00smurf7
Thank you so much this will help a ton. Is there a way to pull a list of functions or commands ( not sure the proper term) or is it just based on memorization. IF there is a list/post on this already i apologize. specifically curious about a lot more of the Runescape specific functions such as the smart finding of specific item slots or the deposit button on the bank ect…I like the game but im more taking this oportunity to try and take another hack at learning this, I've tried in the past and i really enjoy learning and the challenge of it.


Looking for this?

Edit: nvm, just saw you meant OSRS.

00smurf7

2014-11-10 16:27:54

thanks for trying but ye OSRS would be nice since i dont play EoC

levunit

2014-11-13 19:42:55

If you use Reflection, you can use R_IsAnimating or R_InFight to check if you are in combat, but the hooks are outdated right now, so you'd have to wait a bit to try it out. As posted above, checking for the health bar above the player with color also works, but if another person if standing on top of you and attacks something, it could mess up, so you might have to back it up with pixelshift.