SRL Archive - Reflection Tutorials

Using animations


Frt

2009-03-09 19:55:06

Hi,

In this tutorial we will go through the basics of Animations and how to use them.

First of all go download RsBot (www.rsbot.org). This will be used for getting the information we need.

Now that you have downloaded RsBot start it and log in to your account. In the top of RsBot you will see the field Debug - click on it. Now choose Animation - this will show you the characters current animation.
Simply do what it takes to perform the animation - I will be using the net-fishing animation whish is 1903.

Now you're probably thinking "what can I use this information to?"
- This information is great for failsafes. Imagine making a fishing bot. You could easyli check if you account is fishing by calling this piece of code:

if(GetAnimation = 1903) then
Writeln('We are fishing with a net.');

The GetAnimation function return the users currently animation - in this case we are checking if our account is fishing with a net.

Now to move just a bit further on we could use this to make a couple of functions that might be handy in a script:

// Returns true if GetAnimation returns Ani
function IsAnimation(Ani: integer): Boolean;
begin
if(GetAnimation = Ani) then
Result := True;
end;

// Waits until we are not doing the Ani anymore or until 30 seconds have passed
function AnimationWait(Ani: integer): Boolean;
var
i: integer;
begin
repeat
if(i > 30) then Break;
Wait(1000);
Inc(i);
until(not(GetAnimation = Ani));
end;

I hope you learned something from this tutorial, feel free to ask questions :)

Home

2009-03-09 20:05:40

He, he simple and effective :)

turbobk

2009-03-09 20:36:00

Or..

// Returns true if GetAnimation returns Ani
function IsAnimation(Ani: integer): Boolean;
begin
Result := (GetAnimation = Ani);
end;
 
// Waits until we are not doing the Ani anymore or until 30 seconds have passed
function AnimationWait(Ani: integer): Boolean;
var
c: integer;
begin
while IsAnimation(Ani) do
begin
if (c >= 30) then
break;
inc(c);
wait(1000);
end;
end;

Method

2009-03-09 21:18:42

You can also debug your animation using our reflection system. Good tutorial, nonetheless! :)

marpis

2009-03-10 15:13:38

I'd like to see the complete list of animations. where could i get them?

Frt

2009-03-10 15:21:11

I don't think such list exists.
But why anyway? It takes a sec to log in to Runescape in Rsbot and check the animation.

marpis

2009-03-11 08:42:58

i cant get rsbot working

Frt

2009-03-11 11:38:10

Run the Compile file in the folder, then it should work.

Baked0420

2009-03-11 13:51:41

how can you get NPC's animations?

Frt

2009-03-11 15:19:43

When finding a NPC you will get the animation in the TNPC.
To get the Animation ID you can use this small script to get it.

program NPCAnimationID;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

var
NPCs: array of TNPC;
i: integer;

begin
SmartSetupEx(121, false, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
NPCs := GetNPCs;
for i := 0 to High(NPCs) do
begin
if not(NPCS[i].Animation = -1) then
begin
Writeln('NPC named: ' + NPCs[i].Name);
Writeln('Animation: ' + IntToStr(NPCs[i].Animation));
Writeln('');
end;
end;
end.

This will only write NPCs who are not just standing/walking but actually doing something.

cycrosism

2009-03-12 04:59:08

Try This:


Program New;

var
C,l:Integer

begin
C:= GetAnimation;
repeat
Wait(30);
L:= C;
C:= GetAnimation;
if(not(C = L)) then
Writeln(IntToStr(C));
until(IsFKeyDown(12));
end.

OR you could try

while(GetAnimation > 0) do