Log in

View Full Version : Woodcutting Chopping Animation Detection



smithsps
12-26-2010, 07:52 AM
I was wonder what the best way to detect when a player is chopping wood.
I have seen animation.scar and I know Reflection can do it.

But what is the best way detect the animation of chopping wood?

KingKong
12-26-2010, 07:55 AM
Imo, reflection is good for that kind of stuff, and here is how to check it:

var
Me: Tme;
begin
Me := GetMe;
if Me.Animation = 867 then
writeln('Character is still woodcutting');
end.

3Garrett3
12-26-2010, 04:08 PM
Imo, reflection is good for that kind of stuff, and here is how to check it:

var
Me: Tme;
begin
Me := GetMe;
if Me.Animation = 867 then
writeln('Character is still woodcutting');
end.


Unfortunately this is inefficient and only works for chopping with one type of axe.

The more efficient (efficient looking at least) way to get animations is to use the GetAnimation function from reflection. It returns an integer.

The lazy way to check if you are chopping wood (or fighting, or fishing, or smithing, etc) is to do this:


if GetAnimation > 0 then
Writeln('We are not standing still');


When doing nothing (I'm not sure about animation when walking..) your animation is -1 so it's a simple check to make sure that you're still chopping wood.

**BANNED The Man
12-26-2010, 05:16 PM
You could do:
var
Me: Tme;
Animations : TIntegerArray;
begin
Me := GetMe;
Animations := [867, 1, 2, 3, 4] //etc
if Me.Animation = Animations then
writeln('Character is still woodcutting');
end.

:)

-Boom

Dgby714
12-26-2010, 06:02 PM
You could do:
var
Me: Tme;
Animations : TIntegerArray;
begin
Me := GetMe;
Animations := [867, 1, 2, 3, 4] //etc
if Me.Animation = Animations then
writeln('Character is still woodcutting');
end.

:)

-Boom

var
Animations : TIntegerArray;
begin
Animations := [867, 1, 2, 3, 4];
if (InIntArray(Animations, GetAnimation)) then
writeln('Character is still woodcutting');
end.

smithsps
12-26-2010, 06:10 PM
Thanks everyone.

So I guess that reflection is the best way by far?

Troll
12-26-2010, 06:20 PM
Yeah it kinda of hard with color, the only way i know with color is when cutting normal tree you look to see if you have one more item in my inv, but its possible poeple have done it. Its just a lot harder :)

**BANNED The Man
12-26-2010, 06:25 PM
Well with colour you can use:
if IsMoving then
Result := StillCutting;

smithsps
12-26-2010, 11:01 PM
Thanks for all the help.

Xanith
12-27-2010, 06:28 AM
Well with colour you can use:
if IsMoving then
Result := StillCutting;

IsMoving Determines if your char is walking, he would have to use PixelShift to determine if the char is still chopping. I found that out when I was trying to make a waiting procedure for my willow cutter.

3Garrett3
12-27-2010, 05:02 PM
I believe that the correct colour function is "IsAnimating". You just need to look through animating.scar in SRL. It uses pixel shifts to determine if the player is animating, iirc.

smithsps
12-27-2010, 07:19 PM
I believe that the correct colour function is "IsAnimating". You just need to look through animating.scar in SRL. It uses pixel shifts to determine if the player is animating, iirc.

Is it possible it can get confused with other players animating at the same time?

3Garrett3
12-27-2010, 07:52 PM
I think it searches only the box directly around the player, not the entire screen. So it is unlikely to get confused.

Her0n
12-31-2010, 06:21 AM
I believe that the correct colour function is "IsAnimating". You just need to look through animating.scar in SRL. It uses pixel shifts to determine if the player is animating, iirc.

This is very helpful! Thank you! Time to start working on that script again:p