SRL Archive - OSR Help

MMToMS w/ fighting


[D]ude

2012-06-04 01:37:07

So I couldn't find exactly the correct forum to put this in, but I thought this one would suite it well. To the point I was wondering about everyone's opinions on using mmtoms in a fighting script.

Sir R. M8gic1an

2012-06-04 09:17:54

Naike used to do it in his avianses script and it worked rather well.

~RM

litoris

2012-06-04 10:27:53

Narcle uses it in his fighter, and it is the best AIO fighter around.

putonajonny

2012-06-04 10:32:02

I use it for looting in my script to narrow down to an area then I search in that area for items by colour, so yeah It could be used for fighting

Wreck

2012-06-05 08:09:27

var
NPCs: TPointArray;
BoxArr: TBoxArray;
L, i: Integer;
P: TPoint;

NPCs := GetMMDotsOnMS('npc'); //Get NPC dots on MiniMap.
L := Length(NPCs);
if L < 1 then //If no NPC dots on MiniMap then exit.
Exit;

SetLength(BoxArr, L);
For i := 0 To L-1 Do
begin
P := MMtoMS(NPCs[i]); //For every dot on MiniMap get a point on mainscreen.
BoxArr[i] := IntToBox(Max(P.x-50, MSX1), Max(P.y-50, MSY1), Min(P.x+50, MSX2), Min(P.y+50, MSY2)); //Draw a box 50x50 around the point returned from MMtoMS.
end;

This gives you an array of areas to search in and all you have to do is use that in a For..To..Do loop searching for colors in the area BoxArr.x1, BoxArr.y1, BoxArr.x2, BoxArr.y2 and then the usual uptext checking etc.
EDIT: Forgot to mention that it is better to include IsFightAt before you check for uptext as it will save time jumping from point to point where there is a monster that is already in combat.


There could be better ways but thats pretty much how it can be used, hope this helps!