PDA

View Full Version : How to check if player is active w/ XP Counter



Main
12-24-2011, 03:42 AM
How to check if your player is active using XP Counter


This is a short tutorial, but very useful and easy alternative to reflection's player animation.

Don't know what is a XP Counter (http://runescape.wikia.com/wiki/XP_Counter)?

All this do is simply check the time since the last exp change, and when it goes over certain time (depends on what your doing) you can determine if your player isn't skilling any more.

http://img560.imageshack.us/img560/9588/xpgaint.png

Here is a sample code that you can use, I took this off my clan war fighter. Note that I give script users the option to use this feature or not, although most people does play with it on, there are some ( like me) who play with it off.



Program CounterTest;
{$i srl/srl.scar}

Var
OldXP, TimeSinceFight: Integer;

Procedure DeclarePlayers;
Begin
//Blah blah blah
Players[ 0].Booleans[ 1] := True; //Would you like to have the XP Counter on?
//Turn this to false if you don't normally use this.
End;

Begin
SetupSRL;
If Players[ CurrentPlayer].Booleans[ 1] Then
ToggleXPBar( True);
Repeat

If IsXPBarOpen Then
Begin
If Not( GetXPBarTotal = OldXP) Then
Begin
OldXP := GetXPBarTotal;
MarkTime( TimeSinceFight);
End;
End;

// Insert rest of mainloop;
// And add marktime each time after you click on the tree or monster.
FindMonster/Object/Item;
MarkTime( TimeSinceFight);


If TimeFromMark( TimeSinceFight) > 6600 Then
Begin
Writeln( 'You are not in fight any more!');
ProggieProcedure/blahblahblah;
End;


{
6600 is what you should use for fighting, and you should also combine it with check if HP bar present in the vicinity of
player.
Other skills probably have a different time limit, so you need to find this out yourself.
}
Until False;
End;



Enjoy :redface:

Narcle
12-24-2011, 03:44 AM
I was using this method... but nub accounts this doesn't work well or at all. If you miss twice you get a false positive.

Main
12-24-2011, 03:50 AM
I was using this and along with checking the HP increase ( by more than 5) or decrease and whether or not the HP Bar is present.

I think it covered most of time. But if anyone wants an alternative, there is also the pixel shift thing that cohen used in MSI.

lilcmp1
12-24-2011, 04:08 AM
Yes! Thank you, exactly what I was looking for today.