SRL Archive - SRL Archives

InFight - No Gametab Switch!


FrÕzÑ_§ÕµL

2008-01-26 02:56:27

{*******************************************************************************
Function InFight: Boolean;
By: FrÕzÑ_§ÕµL, based on FindFight by Stupid3ooo.
Description: Checks for fights without changing game tabs. Prevents multiple runs.
*******************************************************************************}
Function InFight: Boolean;
var
x, HPTime : Integer;
ColorSign : String;

Begin
if Players[CurrentPlayer].level[8] <= 0 then
Players[CurrentPlayer].level[8] := GetSkillInfo('hitpoints',False);
if Players[CurrentPlayer].level[8] > HP then
if TimeFromMark(HPTime) >= 60000 then
Begin
x := TimeFromMark(HPTime) - 60000;
MarkTime(HPTime);
DecEx(HPTime, x);
Inc(HP);
end;
if FindColor(x, y, 65280, 217, 129, 297, 209) then
Begin
x := GetMMLevels('hp', ColorSign);
if x = -1 then
Begin
Result := FindFight;
Exit;
end;
if (x < HP) then
Begin
Result := True;
WriteLn('******** FOUND FIGHTING RANDOM ********');
WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' + Chr(13));
TakeScreen('Found Fight');
Inc(Fights);
MarkTime(HPTime);
HP := GetMMLevels('hp', ColorSign);
if HP = -1 then
HP := Players[CurrentPlayer].level[8];
end;
end;
end;

What it does is when it finds the green health bar above your character it checks to see if the HP next to the MM is lower than the one recorded (If none then it does it first) and then returns true. All fights found after this will be checked against your current hp before running away.

Just tested and works well. I think I have prevented the running away again when it runs back to where it found the fight when another player is fighting, using a mark time - 1min = HP + 1 :)

I realize it is a simple function but it means we do not have to get unnecessary bans because of this, and also since the old one switches back gametabs after use some players are dead by that time :p

Enjoy all :)

n3ss3s

2008-01-26 04:07:55

Good, I think I dropped niels a pm before that FindFight still checks from tabs, which would now be especially detectable.

FrÕzÑ_§ÕµL

2008-01-26 04:09:44

Ah kool, yes I agree :) thank god for this update lol… well maybe not for all reasons hehe.

Markus

2008-01-26 04:55:06

What if the scripter didn't call GetSkillLevels? It'll fuck up.

ZephyrsFury

2008-01-26 05:00:51

I'm not too sure about his but if the HP isn't full isn't the text orange or something? Can't we just check if the text is orange and return true if it is?

Rikje

2008-01-26 05:18:02

It can also be red :p

ZephyrsFury

2008-01-26 05:20:02

From: rikjess
It can also be red :p


Ok… so Result := not(FindColor(x, y, {Green}, {some coords}))?

Negaal

2008-01-26 05:53:56

I'v been using this since update…works well, no annoyning tab switch, or…
Hmm I have to improve Frosn Souls infight…well example, you got attacked, you ran away…you hp is still lower than 100%, you'll run away again if green bar is above youre head…


PlayerSetup…
Players[CurrentPlayer].integers[1]:=GetHP;
Edit: You may use GetMMstatsinfo or something instead of GetHP, I do GetHP, because it has to get lvls anyways, and GetMMStatsinfo has been failed me few times

Somewhere in youre randoms finding procedure…
if InFight then //Don't use Findfight here...try to import Infight to your script
begin
HP := GetHpMyWay; //it uses MM stat info, if it fails it gets it manually
if Players[CurrentPlayer].integers[1] > HP then
Players[CurrentPlayer].integers[1]:= HP
else
begin
Players[CurrentPlayer].integers[1]:= HP;
Exit;
end;
RunAway('N', True, 1 , 5000 + random(5000));
end;

So every time it checks for hp it saves the current hp value to integers[1], if it's higher or same then it exit, if it's lower than on last check then it rans away

mastaraymond

2008-01-26 06:33:30

You double posted this..

Anyway:
Or you could just look at the colorsign.. If Colorsign <> 'green' then Result := True;

n3ss3s

2008-01-26 06:36:05

Except for that the health points can be lost in other than fighting, for example gas - who runs away and waits 6 seconds when their pickaxe gets fucked? :S

ZephyrsFury

2008-01-26 06:39:36

From: n3ss3s
Except for that the health points can be lost in other than fighting, for example gas - who runs away and waits 6 seconds when their pickaxe gets fucked? :S


Well thats why we need a good gas detection function. :p. Wouldn't this also happen with the normal FindFight?

n3ss3s

2008-01-26 13:02:58

So Piv's and SKy's aren't worthy enough?

Though when I get a gas I'll give a try making one :)

FrÕzÑ_§ÕµL

2008-01-26 14:25:09

Yea ok so theres quite a bit that could be changed and made better. I agree on the change of color one, even though for higher levels they will be injured more before it then realizes it is hurt. And yea I know about the second run away, but that is also there in the current FindFight :) So I was thinking we find how long it takes to recover an hp, and using MarkTime(TempHP) we can then get it all exact. In fact, I'm going to go do that now :D

Edit : HP regen is 1/min.

FrÕzÑ_§ÕµL

2008-02-13 04:18:23

Updated with new function! Comments please!!!

No longer need to get HP at start of player login if you don't want. Prevent multiple runs.

BobboHobbo

2008-02-14 00:14:32

This function, well the one you gave me over MSN works like a charm. :)

FrÕzÑ_§ÕµL

2008-02-14 15:08:04

:) yup itst he one I gave you, just with the
 if Players[CurrentPlayer].level[8] <= 0 then
Players[CurrentPlayer].level[8] := GetSkillInfo('hitpoints',False);
Added as you said it would be better, and I very much agree :D

Does it prevent the multiple runs?