SRL Archive - OSR Help

Scripting Help


King

2012-12-14 20:32:12

Working on the waterfiend script tonight, I have finding them, banking and the DTM's made. I just need some help determinging if we are in a fight. I know We can sue the target bar, as it instanitly switches when you are done fighting. But how would I go about that? Should I make a TPA or DTM that checks, the Target box? Or is there a way to check if we have a target already? Aslo, how would I keep track of the loot piles I have already checked? I remember reading about converting the red dots on the mini map to piles and checking them and then marking them checked, but how would I go about this? Any help is appreciated! and an example or tutorial link on the idea would be appreciated as well(:

Rezozo

2012-12-14 22:36:33

For the fighting, before the EOC update, I used pixel shift mainly for mine. That and the chat box. After the EOC, you could use the bar for detirmining I guess. Or you could check if your adrenaline is increasing, or if ther is a blue/red hitmark in the middle of the screen etc.

I do not understand your second question. If there is something to loot, would you not just turn the screen, if it is found, you loot it?
~Rez

King

2012-12-14 23:43:30

From: Rezozo
For the fighting, before the EOC update, I used pixel shift mainly for mine. That and the chat box. After the EOC, you could use the bar for detirmining I guess. Or you could check if your adrenaline is increasing, or if ther is a blue/red hitmark in the middle of the screen etc.

I do not understand your second question. If there is something to loot, would you not just turn the screen, if it is found, you loot it?
~Rez


The second question I meant how would I already know the pile has been checked for loot, somewhere somebody mentioned using the mini map to mark the dots to show that they have been looted >,<

Wardancer

2012-12-14 23:50:56

For the loot thing, you'd first need a very powerful and precise positioning system to be able to record the red dots in an array and still be able to localize them after you move. After that, it's a matter of going through these stacks when they're on screen and removing them from the array once you're done with them (that part would be a bit tricky and difficult to explain if you have to remove a point in the array that isn't at the end). I'd recommend you not to waste too much time with this and focus on the core of the script though.

As for how to know when you're in fight, I believe most people use the combat tab to see if you have a target. It's fairly simple and effective.

xtrapsp

2012-12-17 08:11:13

Checking if your in a fight can be done with Pixelshift :)
Function Fighting: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 500, 650) > 400);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
end;



Procedure Fighting;
begin
if (Fighting) then
begin
writeln('Waiting for you to stop fighting');
wait(100);
end else
begin
writeln('Lets look for a fight');


// PUT FIGHTING PART HERE


end;
end;

DannyRS

2012-12-17 08:15:39

From: xtrapsp
Checking if your in a fight can be done with Pixelshift :)


:S duno if thats the best way to do it, you'll be losing the time it takes for a weapon swing, or what if you dodge or whatever all attacks for that interval?

would using the new combat inventory thing added in EoC to see if you have a target not be good?

if they make it that easy for us, why not

xtrapsp

2012-12-17 08:18:39

From: DannyRS
:S duno if thats the best way to do it, you'll be losing the time it takes for a weapon swing, or what if you dodge or whatever all attacks for that interval?

would using the new combat inventory thing added in EoC to see if you have a target not be good?

if they make it that easy for us, why not


I thought if you dodged your character moved back.
If there are pixels inside the box moving out of it then the pixels inside will still move… Just mess around with the numbers or make the box bigger to the left.

DannyRS

2012-12-17 08:37:10

From: xtrapsp
I thought if you dodged your character moved back.
If there are pixels inside the box moving out of it then the pixels inside will still move… Just mess around with the numbers or make the box bigger to the left.


your supposed to move back, and get the small blue no damage shield thing, but jagex have balls'd that up with EoC and sometimes, the mob will hit you, and no damage is taken, and nothing is displayed and no animation,

if the EoC target screen will make it so easy, wouldent bother messing with pixelshift :)

xtrapsp

2012-12-17 08:40:38

Hmm I don't know if this helps:

Function InCombat() : boolean;
var
x,y : integer;
begin
if (TimeFromMark(TimeLastClick) > 60000) then
begin
result := false
writeln('May have gotten stuck. Havent attacked something new for 60 sec. Logging Out in 60 sec if true...');
exit;
end;
if not (GetCurrentTab = tab_Combat) then
GameTab(tab_Combat);
Result := false
Result := not(FindDTM(No_Target, x, y, MIx1, MIy1, MIx2, MIy2));
if (Result = True) then
begin
TimesBeforeTurn := 0;
MarkTime(LastInCombat);
exit;
end;
end;

I found it here:

http://villavu.com/forum/showthread.php?t=93707

Be sure to credit them if it works

King

2012-12-17 17:00:08

I tried usinfb a function like that, but it did not work. I ended up making a custom DTM for the crossbow( their weakness) ad just finding that in the target screen. My script switches targets hecka fast now because it instantly disappears and reappears :p

Ian

2012-12-17 18:06:03

If you want you can use something like this from my DeadlyRedSpiderSmasher:
Function Fighting: Boolean;
begin
if not LoggedIn then Exit;
if ((GetColor(600,236)) = 2183217) then
begin
if Debug then
WriteLn('Fighting');
Result := True;
end else
begin
if Debug then
WriteLn('Not Fighting');
Result:= False;
end;
end;

Basically looks for the static greenish health-bar color on a pixel right at the end. Idea by Footballjds :)

Way faster and less memory hungry than a DTM :)

P1ng

2012-12-18 02:15:42

So many un-necessary things in both those functions…

function InCombat :boolean;  //TimeLastClick and DTM must be script specific vars
var
x,y : integer;
begin
while TimeFromMark(TimeLastClick) < 60000) do //make roughly time to kill npc
begin
if not (GetCurrentTab = tab_Combat) then
GameTab(tab_Combat);

Result := not(FindDTM(No_Target, x, y, MIx1, MIy1, MIx2, MIy2));

if Result then
Break;
end;
end;

function Fighting: Boolean;
begin
if not LoggedIn then
Exit;

Result := ((GetColor(600,236)) = 2183217);

if Result then
begin
if Debug then
WriteLn('Fighting');
end else
if Debug then
WriteLn('Not Fighting');
end;

In another thread somewhere I helped someone and actually wrote a function that checked for the 'no target' DTM, but I'm not sure where that is at present

mr. pali

2012-12-18 02:18:39

Check out my AIO fighter, check the InFight Function, you can steal it. Make sure you get the DTM from the LoadDTMs procedure, too!

the thread p1ng is talking about is this one, definitely visit it. http://villavu.com/forum/showthread.php?t=93697

King

2012-12-21 01:38:31

From: mr. pali
Check out my AIO fighter, check the InFight Function, you can steal it. Make sure you get the DTM from the LoadDTMs procedure, too!

the thread p1ng is talking about is this one, definitely visit it. http://villavu.com/forum/showthread.php?t=93697


I tried it an couldn't get it to work, so I made my own :P. I made it check for the Crossbow of the Waterfiend( weakness is bolts) that way it would only fight them! I wrote the procedure by hand as well!