Log in

View Full Version : Error



SamSatanas
04-24-2012, 02:08 PM
Every time I run a script, simba opens the GameTab and my script stops. I even get the error when I run a simple script.


program CowKiller;
{$DEFINE SMART}
{$DEFINE SRL5}
{$i SRL/srl.simba}

procedure start;
begin
ClearDebug;
Smart_Server := 14;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
activateclient;
SetupSRL;
end;



Function CheckAndClick (UpText, Option:String; x, y:Integer; RClick:Boolean):Boolean;
begin
MMouse(x, y, 5, 5);
If WaitUptext(UpText, 1500+Random(500)) Then
begin
Result:=True
GetMousePos(x, y);
If RClick Then
begin
Mouse(x, y, 0, 0, False);
Result:=WaitOption(Option, 2000);
If Result Then FFlag(0);
end else
begin
Mouse(x, y, 0, 0, True);
Wait(100+Random(50));
FFlag(0);
end;
end;
end;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;

function InFight: Boolean;
begin
Result := srl_InFight;
end;

Procedure Antiban;
begin
Case Random(250) of
0: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('WoodCutting', False) GameTab(28)end;
1: Begin StatsGuise('AntiBan') SleepAndMoveMouse(7000 + Random(500)); end;
2: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28)end;
3: Begin StatsGuise('AntiBan') RandomAngle(1); end;
4: Begin StatsGuise('AntiBan') GameTab(tab_Stats); Wait(3000 + Random(500)); GameTab(28)end;
5: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('random', False); GameTab(28)end;
end;
end;


Procedure FailSafe(Reason:String);
begin
Players[CurrentPlayer].Loc:=Reason;
Logout;
Stats_Commit;
Writeln(Reason);
TerminateScript;
end;

function CColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.57);

if not (FindColorsTolerance(arP, 10859196, MSX1, MSY1, MSX2, MSY2, 24)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


Function AttackingCow:Boolean;
Var
x,y:Integer;
begin
x:=MSCX;
y:=MSCY;
SetAngle(SRL_ANGLE_HIGH);
if InFight then
begin
repeat
FindNormalRandoms;
until ((not LoggedIn) or (not InFight))
end;
If FindObjEx(x,y, ['Attack'], [CColor], 10, 50, 1, 5, 690, 400) then
Begin
StatsGuise('Attacking Cow');
GetMousePos(x,y);

Case random(2) of
0: Mouse(X, Y, 5, 5, True);
1: Begin
Mouse(X, Y, 5, 5, False);
WaitOption('ttack', 500);
end;
End;
End;
end;

Procedure Eat;
begin
Writeln(HPPercent);
end;


begin
start;
CColor;
Eat;
repeat
Antiban;
AttackingCow;
until(false);
end.



SRL Compiled in 15 msec
SMART Initialized.
Loaded: Server 14, Members: True, Signed: True, Super Detail: False.
AutoColor = 9672602
Error: Out Of Range at line 957
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]

Kyle Undefined
04-24-2012, 02:14 PM
Can you post the line it highlights when it opens the new tab?

SamSatanas
04-24-2012, 05:33 PM
Can you post the line it highlights when it opens the new tab?

if (GetCurrentTab <> tab_Stats) then exit;

Abu
04-24-2012, 05:35 PM
Have you tried un-defining SRL 5?

So take away this:
{$DEFINE SRL5}

SamSatanas
04-24-2012, 08:31 PM
Have you tried un-defining SRL 5?

So take away this:
{$DEFINE SRL5}

yes, still can't use any scripts. It seems like any findcolor or HPPercent code makes the error. I have even download other scripts and get the same error.




program HPCeck;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}

Procedure WhatIsYourHP;
begin
Writeln('What is your hp ' + IntToStr(HPPercent));
end;

begin
Smart_Server := 77;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
WhatIsYourHP;
SetupSRL;
end.



This simple script should work without errors right?
gametab gets opened and this code is highlighted
if (GetCurrentTab <> tab_Stats) then exit;

Debug Box

[Hint] C:\Simba\Includes\SRL/SRL/core/mapwalk.simba(1353:3): Variable 'BOX' never used at line 1352
Compiled successfully in 1279 ms.
Error: Out Of Range at line 957

JuKKa
04-24-2012, 08:54 PM
program HPCeck;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}

Procedure WhatIsYourHP;
begin
Writeln('What is your hp ' + IntToStr(HPPercent));
end;

begin
Smart_Server := 77;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
WhatIsYourHP;
end.


try that.

always remember to SetupSRL; before you use any SRL functions.

x[Warrior]x3500
04-24-2012, 08:57 PM
add a declareplayers procedure

SamSatanas
04-24-2012, 10:48 PM
program HPCeck;
{$i srl/srl/misc/smart.simba}
{$i srl/srl.simba}

Procedure WhatIsYourHP;
begin
Writeln('What is your hp ' + IntToStr(HPPercent));
end;

begin
Smart_Server := 77;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
WhatIsYourHP;
end.


try that.

always remember to SetupSRL; before you use any SRL functions.

Thanks for the tip, but still get the error. I tried reinstalling simba and updating everything, still no luck.

x[Warrior]x3500
04-24-2012, 10:58 PM
Thanks for the tip, but still get the error. I tried reinstalling simba and updating everything, still no luck.

just listen to me...

if you still have errors, then something is seriously wrong

Abu
04-27-2012, 05:07 AM
LOL x[Warrior]x3500 is right.. but as well as adding a DeclarePlayers procedure you should also log in your player before trying to run the script.

To Declare Players: http://villavu.com/forum/showthread.php?t=60501

To Log In put this after 'start':
if not Logged In then
LogInPlayer;