I know you guys get a lot of these "out of range errors" here but I'd be positively elated if someone could tell me what I'm doing wrong please. Thanks!
When I press the "run script" button
I receive this

To which I press ok (Living on the edge ;p). Then receive
Compiled successfully in 858 ms.
Error: Out Of Range at line 199
Simba Code:
program Uz3sStunAlch;
{$define SMART}
{$I SRL/SRL/misc/smart.simba}
{$I SRL/SRL.simba}
{$I SRL/SRL/misc/paintsmart.simba}
//*********************Credits to CRU1Z1N for his gui form thingy*********************
var
x, y, Stun, Alch, Xp, iMonsterChoice, MonsterColor, MonsterTolerance, MonsterCounter: Integer;// We Declare our DTM, x and y as Integers.
frmDesign: TForm;
Button1: TButton;
Label1: TLabel;
WhatMonster: TComboBox;
MonsterChoice,Pinn,Pass,UsrName: TEdit;
Debug:string;
procedure SetupPlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
Players[0].Name := UsrName.Text;
Players[0].Pass := Pass.Text;
Players[0].Pin := Pinn.Text;
Players[0].Active := True;
end;
procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 123;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
SetupPlayers;
LoginPlayer;
end;
procedure AntiRandoms;
begin
FindNormalRandoms;
LampSkill := 'magic';
LevelUp;
end;
Procedure Antiban;
Begin
Case Random(500) Of
0: Begin GameTab(tab_Stats) HoverSkill('Magic', False) GameTab(28); GameTab(tab_magic); End;
1: Begin SleepAndMoveMouse(7000 + Random(500)); End;
2: Begin GameTab(tab_Inv) ExamineInv; GameTab(28); GameTab(tab_magic); End;
3: Begin RandomAngle(1); End;
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); GameTab(tab_magic); End;
5: Begin GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); GameTab(tab_magic); End;
End;
End;
procedure MonsterColorFunc;
begin
MonsterCounter:= 0;
MonsterChoice:= 2; // 1 = Lesser Demon, 2 = Black Knight
if(MonsterChoice.text = 'LesserDemon') then
begin
MonsterColor:= 3626480;
MonsterTolerance:=39;
end else
if(MonsterChoice.text = 'BlackKnight') then
begin
MonsterColor:= 1119824;
MonsterTolerance:= 13;
end;
end;
Procedure LogOutFunc;
begin
WriteLn('Couldnt find monster');
WriteLn('Logging out');
Logout;
TerminateScript;
end;
Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
Procedure ButtonClick(Sender: TObject);
Begin
frmDesign.ModalResult:= mrOk;
iMonsterChoice:= StrToInt(MonsterChoice.Text);
end;
procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 100;
frmDesign.Top := 100;
frmDesign.Width := 400;
frmDesign.Height := 140;
frmDesign.Caption := 'Uz3s Stunner Alcher!';
frmDesign.Color := 900849;
frmDesign.Font.Color := ClBlack;
frmDesign.Font.Name := 'Comic Sans MS';
Button1 := TButton.Create(FrmDesign);
Button1.Parent := FrmDesign;
Button1.Left := 260;
Button1.Top := 10;
Button1.Height := 30;
Button1.Width := 120;
Button1.Caption := 'Run Script';
Button1.OnClick := @ButtonClick;
Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 60;
Label1.Left := 10;
Label1.Caption := 'UserName?';
Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 60;
Label1.Left := 150;
Label1.Caption := 'Password?';
Label1 := TLabel.Create(FrmDesign);
Label1.Parent := FrmDesign;
Label1.Top := 60;
Label1.Left := 300;
Label1.Caption := 'Bank Pin?';
UsrName := TEdit.Create(FrmDesign);
UsrName.Parent := FrmDesign;
UsrName.Top := 80;
UsrName.Left := 10;
UsrName.Width := 100;
UsrName.Height := 20;
Pass := TEdit.Create(FrmDesign);
Pass.Parent := FrmDesign;
Pass.Top := 80;
Pass.Left := 150;
Pass.Width := 100;
Pass.Height := 20;
Pinn := TEdit.Create(FrmDesign);
Pinn.Parent := FrmDesign;
Pinn.Top := 80;
Pinn.Left := 280;
Pinn.Width := 100;
Pinn.Height := 20;
WhatMonster := TComboBox.Create(FrmDesign);
WhatMonster.Parent := FrmDesign;
WhatMonster.Top := 10;
WhatMonster.Left := 10;
WhatMonster.Width := 200;
WhatMonster.Height := 15;
WhatMonster.Caption := 'Which Monster?';
WhatMonster.Items.Add('LesserDemon');
WhatMonster.Items.Add('BlackKnight');
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end; [B]// This where the error occurs[/B]
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
vv end; is where the error occurs vv
Simba Code:
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end; [B]// This where the error occurs[/B]
And here is the main procedure
Simba Code:
begin
SafeInitForm;
SafeShowFormModal;
SetupLogin;
ActivateClient;
MonsterColorFunc;
Debug:='none';
repeat
if not LoggedIn then LogInPlayer;
if(MonsterCounter > 4) then
LogoutFunc;
Antiban;
StunMonster;
AlchItem;
ProgressReport;
until(false)
Freeform(frmDesign);
end.
I left the rest of the script out because it shouldn't have anything to do with this error.