SRL Archive - Help

Woodcutting Chopping Animation Detection


smithsps

2010-12-26 02:52:26

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

2010-12-26 02:55:40

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

2010-12-26 11:08:18

From: kongking
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

2010-12-26 12:16:02

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

2010-12-26 13:02:07

From: Dynamite
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

2010-12-26 13:10:16

Thanks everyone.

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

Troll

2010-12-26 13:20:51

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

2010-12-26 13:25:46

Well with colour you can use:
if IsMoving then
Result := StillCutting;

smithsps

2010-12-26 18:01:55

Thanks for all the help.

Xanith

2010-12-27 01:28:00

From: Dynamite
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

2010-12-27 12:02:10

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

2010-12-27 14:19:03

From: 3Garrett3
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

2010-12-27 14:52:19

I think it searches only the box directly around the player, not the entire screen. So it is unlikely to get confused.

Her0n

2010-12-31 01:21:17

From: 3Garrett3
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