SRL Archive - OSR Help

Recognizing In-fight?


AFools

2015-05-19 04:58:16

I am having trouble with AeroLib/Reflection recognizing when i'm in a fight.

while (ReflectPlayer.IsUnderAttack) or (ReflectPlayer.GetAnimation <> -1) do sleep(100+random(100));;
if not ReflectPlayer.IsUnderAttack then
begin
if R_TryInteractNPC…..


In a mining script "inIntArray(MineAnimationID" i tried using this and changing the mineanimationID without any luck?

A few suggestions would be nice =D


Currently i have to adjust the time between looking for NPC's; which is hard to release a public script, if newcomers can't amend;
it to suit their combat lvl and npc

Thanks in Advance =D

Hoodz

2015-05-19 05:43:46

@FullPottatoHarry; thats because your character is not always doing an animation.
this function is useful for this: TReflectLocalPlayer.WaitForAnimation(WaitPerLoop, Timeout: Integer): Boolean;
checks every WaitPerLoop for an animation until result or Timeout is reached.

AFools

2015-05-20 01:44:47

Thank you Chief Hoods =D


I had another dumb question; i solved.

AFools

2015-05-29 03:52:14

From: hoodz
@FullPottatoHarry; thats because your character is not always doing an animation.
this function is useful for this: TReflectLocalPlayer.WaitForAnimation(WaitPerLoop, Timeout: Integer): Boolean;
checks every WaitPerLoop for an animation until result or Timeout is reached.


I have tried.. with out any luck…


while ReflectPlayer.WaitForAnimation(250,5000) do sleep(100+random(100));
Fight;
dismissAllRandoms;
AntiBan;
sleep(250+random(700));
end;

It is still is not checking for combat; even if i make it.

if not ReflectPlayer.WaitForAnimation(250,5000) then
Fight;
………….

Please help or throw me an idea when your ready

Pavement

2015-05-29 05:25:55

Well when I do combat with the pascal reflection this is what I use and works fine.

function NoAnimation: Boolean;
begin
Result := True
if R_WaitForAnimation(1000) then
Result := False;
end;

Then call it with:

WaitFunc(@NoAnimation, 250, 20000);

I think you should try:

if ReflectPlayer.WaitForAnimation(250,5000) then
begin
Dofightingstuff;
end else
begin
Writeln('No animation detected');
end;

The function waits per loop anyway and I don't think there is a need to add sleep(); or use a while loop. Tell me how it goes :)

AFools

2015-05-29 06:23:59


begin
if not ReflectPlayer.WaitForAnimation(250,15000) or (ReflectPlayer.IsUnderAttack) or (ReflectPlayer.GetAnimation <> -1) then
begin
Fight;
end else
begin
Writeln('No animation detected');
end;
dismissAllRandoms;
AntiBan;
end;
//randomdrops;
end;
until(false);
end

Still doesn't recognize animation. if i put -

if ReflectPlayer.WaitForAnimation(250,15000);
Begin
fight;
etc..

It doesn't even attack.

I am using Lape obviously]

Pavement

2015-05-29 07:44:54

Maybe you should try debugging ReflectPlayer.WaitForAnimation(); and see if it returns true while you are attacking something.

Or write a quick script which gets the players animation ID and draws in on smart. Manually attack an enemy then run the script and watch the animation IDs if it stays -1 while attacking then there might be something wrong with the reflection function. Normally it should alternate between -1 and the ID of your player attacking.

mocrosoft

2015-05-29 08:51:37

I use elffy reflection and all I have to do is this :


repeat
if (R_UnderAttack = false) then
writeLn('we are not under attack.');
wait(Randomrange(500, 1000));
until R_UnderAttack;
//exit loop code, looks like we are under attack
writeLn('Looks like we are under attack.');

Harrier

2015-05-29 08:57:45

I'm worried to why so many people are still developing scripts under the pascal includes. They are highly outdated and one day elfyyy should stop updating the hooks for it as well.

mocrosoft

2015-05-29 09:04:42

From: Hawker
I'm worried to why so many people are still developing scripts under the pascal includes. They are highly outdated and one day elfyyy should stop updating the hooks for it as well.


Why are they outdated? I made amazing scripts in pascalscript, so don't see the problem?

Harrier

2015-05-29 09:09:22

From: mocrosoft
Why are they outdated? I made amazing scripts in pascalscript, so don't see the problem?

Since no one updates them anymore, elfyyy only updates the hooks for the pascal reflection include just to keep a few scripts going and in the end he will most likely stop. I'm not saying you cannot make scripts for them, but in the end the include will become totally broken and you'll be unable to use the scripts you've written or you'll have to maintain the include your self.

mocrosoft

2015-05-29 09:44:25

From: Hawker
Since no one updates them anymore, elfyyy only updates the hooks for the pascal reflection include just to keep a few scripts going and in the end he will most likely stop. I'm not saying you cannot make scripts for them, but in the end the include will become totally broken and you'll be unable to use the scripts you've written or you'll have to maintain the include your self.


Whats the reason he does not update the pascal script anymore?