Log in

View Full Version : Help - Error



Grumps
02-23-2012, 08:31 PM
Hi,

I have a quite basic HPchecker which all i want is to tell me my HP is good at the moment for my fighting script

Function HPchecker: Boolean;
Begin
if (HPPercent > 50) then
Begin
Result := False
WriteLn('Hp is good');
end;
end;

All it really does is suppose to check HP and tell me its good. " Its in the testing phase"

However I compile, its all ok and click Run and this happens

Error: Out Of Range at line 950
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

Any help? :duh:

Heavenzeyez1
02-23-2012, 08:38 PM
Well, you're missing a semicolor after Result := False";" but I don't think that's causing the error.

~Eerik.

begginer
02-23-2012, 09:46 PM
You can post the full script if the user's above didn't find your problem.

Grumps
02-24-2012, 07:41 AM
Hmm, well it seems like nobody knows. Here are parts of my script

program EdgeVille_Hillie_Tanker;
{$i SRL\SRL.simba}
{$DEFINE SMART}


const
SMART_HIGHDETAIL = false;

var
Plus: Integer;

function chop:Boolean;
Var
xon,yay : Integer;
Begin
If FindObjCustom(xon,yay, ['Attack','Hill','Giant'], [7712978 ,6786233 ,5667738], 5) Then
Begin
GetMousePos(xon,yay);
Case Random(2) of
0:Begin
Mouse(xon,yay,7,7,False)
ChooseOption('Attack')
Wait(5000 + random(1000));
Writeln('attacking a hill giant')


Begin

Case Random(2) of
0: If FindObjCustom(xon,yay, ['Take','Coins','Lip'], [9409174,11514808], 5) then
Case Random(1) of
0:Begin
Mouse(xon,yay,7,7,False);
wait(500);
ChooseOption('Big');

end;
end;
end;
end;
// end;
// end;
// end;


Function HPchecker: Boolean;
Begin
if (HPPercent > 50) then
Begin
Result := False
WriteLn('Hp is good');
end;
end;


begin
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True; // Signed client?
Smart_SuperDetail := False; // SMART high detail?
SetupSRL;
ClearDebug;
//HPchecker;

//Repeat
chop;

//Until(false);

end.

if that helps at all and this

Procedure chop;
Var
xon,yay : Integer;

Begin
if FindObjCustom(xon,yay, ['Attack','Hill','Giant'], [7712978 ,6786233 ,5667738], 5) then
Begin
GetMousePos(xon,yay);
wait(500)
Mouse(xon,yay,7,7,False);
ChooseOption('Attack');

end;
end;

Its all messed up so I dont need people telling me that as I know what am going to do but it will not be as good as other fighting scripts if I do not in-clude a hp checker and food eater, as then people wil have to wear ring of lifes :fiery:

:duh:

begginer
02-24-2012, 07:52 AM
You got the script from a treecutting script and trying to make it an attacking one.
You need a lot of changes over there :)

Caotom
02-24-2012, 07:59 AM
Your out of range error seems to be coming from something outside of the script (it compiles fine when a few extra ends are added to the chop function).
function chop:Boolean;

Var
xon,yay : Integer;

Begin
If FindObjCustom(xon,yay, ['Attack','Hill','Giant'], [7712978 ,6786233 ,5667738], 5) Then
Begin
GetMousePos(xon,yay);
Case Random(2) of
0:
Begin
Mouse(xon,yay,7,7,False)
ChooseOption('Attack')
Wait(5000 + random(1000));
Writeln('attacking a hill giant');
end;

1:
Begin
Case Random(2) of
0: If FindObjCustom(xon,yay, ['Take','Coins','Lip'], [9409174,11514808], 5) then
Case Random(1) of
0: Begin
Mouse(xon,yay,7,7,False);
wait(500);
ChooseOption('Big');
end;
end;
end;
end;
end;
end;
end;

Do other scripts run fine on your simba?

~Caotom

Grumps
02-24-2012, 09:02 AM
Yes, it use to be a woodcutter however with a few changes i made it into attacker, that is no problem for me.

However all other simba scripts have worked fine for. Narcales fast fighter worked fine.

Caotom
02-24-2012, 09:31 AM
Do you mind posting the include that it is having an error with? Would be easier to identify the issue with that :)

~Caotom

shithead555
02-24-2012, 10:41 PM
I get the same error too, i dont know why

Grumps
02-26-2012, 12:17 PM
well gametab loads and thats 2700 lines long
It comes up at this bit

function XPTillNextLevel(Skill: Variant): Integer;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
begin
Result := -1;
if (not TabExists(tab_Stats)) then exit;
GameTab(tab_Stats);
if (GetCurrentTab <> tab_Stats) then exit;
P := SkillToCoords(Skill);
if (P.x < 1) then exit;
MMouse(P.x, P.y + 5, 12, 4);
wait(400 + random(200));
if (not WaitFindColors(TPA, 15133931, MIX1, MIY1, MIX2, MIY2, 0, 4000)) then exit;
B := GetTPABounds(TPA);
Wait(200 + Random(150));
Result := StrToIntDef(GetNumbers(GetTextAt(B.X1 + 15, B.Y1 + 45, 0, 1, 4, 4305653, 0, 75, SmallChars)), -1);
end;

xtrapsp
02-27-2012, 11:52 PM
program new;
{$i SRL\SRL.simba}
{$DEFINE SMART}
Const
SRLStats_Username = '';
SRLStats_Password = '';
NumbOfPlayers= 1;
StartPlayer= 0;
Debug = True;


procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
BoxRewards := ['Xp', 'mote', 'ostume', 'ssence'];
Member := True;
Active := True;
end;
end;

Procedure AFK; //Xtrapsp's AFK timer (Play it safe)
begin
* if not loggedIn then Exit;
* * Case Random (100) Of
* * 1..15 : Wait(1000 + Random (3050));
* * 16..24 : Wait (1340 + Random (1093));
* * 25..45: Wait (1211 + Random (6000));
* * 46..47: Wait (20000 + Random (10000)); // This looks like you've gone to get a drink, Cross this out if your a low level
* * end;
end;*





Function HPchecker: Boolean;
Begin
if (HPPercent > 50) then
Begin
Result := False
WriteLn('Hp is good');
end;
AFK;
end;

Procedure AttackGiant;
Var
xon,yay : Integer;
Begin
If FindObjCustom(xon,yay, ['Attack','Hill','Giant'], [7712978 ,6786233 ,5667738], 5) Then
Begin
GetMousePos(xon,yay);
Case Random(2) of
0:Begin
Mouse(xon,yay,7,7,False)
ChooseOption('Attack')
Wait(5000 + random(1000));
Writeln('attacking a hill giant')

Begin
Case Random(2) of
0: If FindObjCustom(xon,yay, ['Take','Coins','Lip'], [9409174,11514808], 5) then
Case Random(1) of
0:Begin
Mouse(xon,yay,7,7,False);
wait(500);
ChooseOption('Big');

end;
end;
end;
end;
end;
end;
end;
end;

begin
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True; // Signed client?
Smart_SuperDetail := False; // SMART high detail?
SetupSRL;
ClearDebug;

Repeat
AttackGiant;
HPchecker;
Until(false);
End.

I just did this.

It compiled correctly :)

Hope it works amigo

putonajonny
02-27-2012, 11:56 PM
Try calling GetAllLevels; just after you log the player in, then again every time you change player, if not then..


Which line out of these is it highlighting when you get the error?

function XPTillNextLevel(Skill: Variant): Integer;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
begin
Result := -1;
if (not TabExists(tab_Stats)) then exit;
GameTab(tab_Stats);
if (GetCurrentTab <> tab_Stats) then exit;
P := SkillToCoords(Skill);
if (P.x < 1) then exit;
MMouse(P.x, P.y + 5, 12, 4);
wait(400 + random(200));
if (not WaitFindColors(TPA, 15133931, MIX1, MIY1, MIX2, MIY2, 0, 4000)) then exit;
B := GetTPABounds(TPA);
Wait(200 + Random(150));
Result := StrToIntDef(GetNumbers(GetTextAt(B.X1 + 15, B.Y1 + 45, 0, 1, 4, 4305653, 0, 75, SmallChars)), -1);
end;

xtrapsp
02-28-2012, 12:01 AM
Try calling GetAllLevels; just after you log the player in, then again every time you change player, if not then..


Which line out of these is it highlighting when you get the error?

function XPTillNextLevel(Skill: Variant): Integer;
var
TPA: TPointArray;
P: TPoint;
B: TBox;
begin
Result := -1;
if (not TabExists(tab_Stats)) then exit;
GameTab(tab_Stats);
if (GetCurrentTab <> tab_Stats) then exit;
P := SkillToCoords(Skill);
if (P.x < 1) then exit;
MMouse(P.x, P.y + 5, 12, 4);
wait(400 + random(200));
if (not WaitFindColors(TPA, 15133931, MIX1, MIY1, MIX2, MIY2, 0, 4000)) then exit;
B := GetTPABounds(TPA);
Wait(200 + Random(150));
Result := StrToIntDef(GetNumbers(GetTextAt(B.X1 + 15, B.Y1 + 45, 0, 1, 4, 4305653, 0, 75, SmallChars)), -1);
end;

Just added that into my version of his script and it recieved a duplicate error?

Is there a XPTillNextLevel function built into simba? It compiled after I named it TheXPTillNextLevel