PDA

View Full Version : Problem with "Actor" isNull ?



nenci494
12-08-2015, 07:19 PM
Hello guys,

recently came back to scripting ( cant log into my old account)..
So i started looking into the new reflection feature. (Pretty usefull btw ;) ).
Now it seems i got a problem with the functions in "Actor". Everytime i try to use on of them ill get a error for example:

function TReflectActor.IsUnderAttack: Boolean;
begin
if Reflect.Smart.IsNull(Self.Reference) then
Exit;
Result := (Self.GetCombatCycle > Reflect.Misc.GetClientLoopCycle);
end;

the IsNull part giving me trouble with the error: Access violation..
I learned java a few years ago but cant seem to figure out what i am doing wrong..
here is an example of how i wanted to use the methods:



While TReflectLocalPlayer.isMoving do
sleep(50);


Hopefully someone can help me :)

Kyle
12-08-2015, 07:52 PM
...

Well, since you say that you know java, i'll explain it using that at first.

It's as if you have a non static class and you are trying to access that class statically and not creating a new instance of it. Since in lape we can't prevent you from doing that, it will just error out on runtime.
Assuming you want to see if your player is moving, you need to do something along these lines:


var
LocPlayer: TReflectLocalPlayer;
begin
LocPlayer.Create; //After properly defining LocPlayer, can also just call .Login
while LocPlayer.IsMoving do
Sleep(50);
end;


I suggest you check this (https://villavu.com/forum/showthread.php?t=111664) guide out.

nenci494
12-09-2015, 02:54 PM
thanks for the quick answer everything working like a charm now :)