Dabbi
2008-09-19 12:16:06
Hey all, I'm in the process of making my first script, it's going to be an anywhere anything smither.
I'm new to scar and pascal, but have been looking at other peoples scripts (mostly the functions and procedures from srl).
Right now I'm trying to make an "AmBusy" function. my idea was to count how many times GetMe.Animation returns -1 over a period of runs
[PHP]Function AmBusy: integer;
var i, summa: integer;
Begin
for i := 0 to 9 do
begin
wait(300);
summa := summa + GetMe.Animation;
end;
Result := summa;
End;[/PHP]
but.. as you might see if you run this, i get type mismatch.
any idea why? i'm thinking it's because it is a negative number, but can't find anything to solve this.
And here is another method i tried. but that also gives an error (Out of Global Vars range)
[PHP]Function AmBusy: integer;
var i, summa: integer;
Begin
for i := 0 to 9 do
begin
wait(300);
if(GetMe.Animation > 0) then
summa := summa + 1;
end;
Result := summa;
End;[/PHP]
Final?
I'm new to scar and pascal, but have been looking at other peoples scripts (mostly the functions and procedures from srl).
Right now I'm trying to make an "AmBusy" function. my idea was to count how many times GetMe.Animation returns -1 over a period of runs
[PHP]Function AmBusy: integer;
var i, summa: integer;
Begin
for i := 0 to 9 do
begin
wait(300);
summa := summa + GetMe.Animation;
end;
Result := summa;
End;[/PHP]
but.. as you might see if you run this, i get type mismatch.
any idea why? i'm thinking it's because it is a negative number, but can't find anything to solve this.
And here is another method i tried. but that also gives an error (Out of Global Vars range)
[PHP]Function AmBusy: integer;
var i, summa: integer;
Begin
for i := 0 to 9 do
begin
wait(300);
if(GetMe.Animation > 0) then
summa := summa + 1;
end;
Result := summa;
End;[/PHP]
Final?
{*******************************************************************************
Function Busy: boolean;
By: Dabbi
Description: Returns false if only idle animation is found, true otherwise.
Checks 10 times over a period of 3 seconds.
*******************************************************************************}
Function Busy: boolean;
var i, summa: integer;
Me: TMe;
Begin
Result := false;
for i := 0 to 9 do
begin
wait(200 + random(250));
Me := GetMe;
if(Me.Animation > 0) then
Inc(summa)
else
Result := true;
End;
End;