SRL Archive - Help and Support

Global Variables Range!


Santa_Clause

2007-09-30 03:03:44

[Runtime Error] : Out of Global Vars range in line 239 in script C:\Documents and Settings\Eminem\Desktop\Nothing.scar


program New;

var
SantyForm : TForm;
TitleLabelWelcome : TLabel;
BeginButtonWelcome, CancelButtonWelcome : TButton;
LoadsNumberEdit, SRLIDEdit, SRLPassEdit : TEdit;
RespondCombo, CheckVersionCombo, TakeScreeniesCombo : TComboBox;
OpenPlayerForm : Boolean;
HowManyLoads : Integer;
UseResponder : Boolean;

function GetNumbersBool(s : string; leng : integer) : Boolean;
var
tmpint : integer;
begin
tmpint := Length(GetNumbers(s));
result := leng <= tmpint;
end;

procedure BeginScript(Senders : TObject);
begin
if not(GetNumbersBool(LoadsNumberEdit.Text, 0)) then
begin
ShowMessage('Invalid Number Of Loads...');
Exit;
end;
HowManyLoads := StrToInt(LoadsNumberEdit.Text);
WriteLn(IntToStr(HowManyLoads));

if (RespondCombo.Text = '') then
begin
ShowMessage('Please Fill In Respond Box!');
Exit;
end;
UseResponder := (StrToBool(RespondCombo.Text));
OpenPlayerForm := True;
SantyForm.ModalResult := mrOk;
end;

procedure EndScript(Senders : TObject);
begin
SantyForm.ModalResult := mrCancel;
OpenPlayerForm := False;
end;

procedure GuildminerWelcome;
begin
SantyForm := CreateForm;
with SantyForm do
begin
Position := poScreenCenter;
BorderStyle := bsSingle;
BorderIcons := [biMinimize,biSystemMenu];
FormStyle := fsStayOnTop;
ClientWidth := 510;
ClientHeight := 340;
Caption := 'frmDesign';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
TitleLabelWelcome := TLabel.Create(SantyForm);
with TitleLabelWelcome do
begin
Parent := SantyForm;
Left := 152;
Top := 24;
Width := 218;
Height := 33;
Caption := 'JuKKa'#39's Guild-Miner!';
Font.Color := clYellow;
Font.Height := -27;
Font.Name := 'Monotype Corsiva';
Font.Style := [];
ParentFont := False;
end;
BeginButtonWelcome := TButton.Create(SantyForm);
with BeginButtonWelcome do
begin
Parent := SantyForm;
Left := 263;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Begin';
TabOrder := 8;
OnClick := @BeginScript;
end;
CancelButtonWelcome := TButton.Create(SantyForm);
with CancelButtonWelcome do
begin
Parent := SantyForm;
Left := 167;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Cancel';
TabOrder := 9;
OnClick := @EndScript;
end;
LoadsNumberEdit := TEdit.Create(SantyForm);
with LoadsNumberEdit do
begin
Parent := SantyForm;
Left := 279;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 10;
Text := 'Number Of Loads?';
end;
RespondCombo := TComboBox.Create(SantyForm);
with RespondCombo do
begin
Parent := SantyForm;
Left := 95;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 11;
Text := 'Respond?';
with RespondCombo.Items do
begin
Add('True');
Add('False');
end;
end;
CheckVersionCombo := TComboBox.Create(SantyForm);
with CheckVersionCombo do
begin
Parent := SantyForm;
Left := 271;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 12;
Text := 'Check Version?';
with CheckVersionCombo.Items do
begin
Add('True');
Add('False');
end;
end;
TakeScreeniesCombo := TComboBox.Create(SantyForm);
with TakeScreeniesCombo do
begin
Parent := SantyForm;
Left := 87;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 13;
Text := 'Take Screenshots?';
with TakeScreeniesCombo.Items do
begin
Add('True');
Add('False');
end;
end;
SRLIDEdit := TEdit.Create(SantyForm);
with SRLIDEdit do
begin
Parent := SantyForm;
Left := 263;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 14;
Text := 'SRL ID?';
end;
SRLPassEdit := TEdit.Create(SantyForm);
with SRLPassEdit do
begin
Parent := SantyForm;
Left := 127;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 16;
Text := 'SRL Password?';
end;
end;

procedure SafeGuildminerWelcome;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('GuildminerWelcome', V);
end;

procedure ShowGuildminerWelcomeModal;
begin
SantyForm.ShowModal;
end;

procedure SafeShowGuildminerWelcomeModal;
var
R : TVariantArray;
begin
SetArrayLength(R, 0);
ThreadSafeCall('ShowGuildminerWelcomeModal', R);
end;

procedure MainGuildminerWelcome;
begin
try
SafeGuildminerWelcome;
SafeShowGuildminerWelcomeModal;
except
WriteLn('An error seems to have occurred in: GuildminerWelcome');
end;
end;

begin
ClearDebug;
MainGuildminerWelcome;
if OpenPlayerForm then
WriteLn('Started');
end.

If you open the form, press begin without filling in anything, then fill in all the boxes and press begin, you'll get that error.

R0b0t1

2007-09-30 21:04:29

From: Santa_Clause

If you open the form, press begin without filling in anything, then fill in all the boxes and press begin, you'll get that error.


Then don't do that?

bullzeye95

2007-09-30 23:08:35

Try..except around all StrToInt and stuff like that should fix it.

Santa_Clause

2007-09-30 23:12:32

I'll love you forever if this works.

bullzeye95

2007-09-30 23:15:15

program New;

var
SantyForm : TForm;
TitleLabelWelcome : TLabel;
BeginButtonWelcome, CancelButtonWelcome : TButton;
LoadsNumberEdit, SRLIDEdit, SRLPassEdit : TEdit;
RespondCombo, CheckVersionCombo, TakeScreeniesCombo : TComboBox;
OpenPlayerForm : Boolean;
HowManyLoads : Integer;
UseResponder : Boolean;

function GetNumbersBool(s : string; leng : integer) : Boolean;
var
tmpint : integer;
begin
tmpint := Length(GetNumbers(s));
result := leng <= tmpint;
end;

procedure BeginScript(Senders : TObject);
begin
if not(GetNumbersBool(LoadsNumberEdit.Text, 0)) then
begin
ShowMessage('Invalid Number Of Loads...');
Exit;
end;
try
HowManyLoads := StrToInt(LoadsNumberEdit.Text);
except
exit;
end;
WriteLn(IntToStr(HowManyLoads));

if (RespondCombo.Text = '') then
begin
ShowMessage('Please Fill In Respond Box!');
Exit;
end;
try
UseResponder := (StrToBool(RespondCombo.Text));
except
exit;
end;
OpenPlayerForm := True;
SantyForm.ModalResult := mrOk;
end;

procedure EndScript(Senders : TObject);
begin
SantyForm.ModalResult := mrCancel;
OpenPlayerForm := False;
end;

procedure GuildminerWelcome;
begin
SantyForm := CreateForm;
with SantyForm do
begin
Position := poScreenCenter;
BorderStyle := bsSingle;
BorderIcons := [biMinimize,biSystemMenu];
FormStyle := fsStayOnTop;
ClientWidth := 510;
ClientHeight := 340;
Caption := 'frmDesign';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
TitleLabelWelcome := TLabel.Create(SantyForm);
with TitleLabelWelcome do
begin
Parent := SantyForm;
Left := 152;
Top := 24;
Width := 218;
Height := 33;
Caption := 'JuKKa'#39's Guild-Miner!';
Font.Color := clYellow;
Font.Height := -27;
Font.Name := 'Monotype Corsiva';
Font.Style := [];
ParentFont := False;
end;
BeginButtonWelcome := TButton.Create(SantyForm);
with BeginButtonWelcome do
begin
Parent := SantyForm;
Left := 263;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Begin';
TabOrder := 8;
OnClick := @BeginScript;
end;
CancelButtonWelcome := TButton.Create(SantyForm);
with CancelButtonWelcome do
begin
Parent := SantyForm;
Left := 167;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Cancel';
TabOrder := 9;
OnClick := @EndScript;
end;
LoadsNumberEdit := TEdit.Create(SantyForm);
with LoadsNumberEdit do
begin
Parent := SantyForm;
Left := 279;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 10;
Text := 'Number Of Loads?';
end;
RespondCombo := TComboBox.Create(SantyForm);
with RespondCombo do
begin
Parent := SantyForm;
Left := 95;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 11;
Text := 'Respond?';
with RespondCombo.Items do
begin
Add('True');
Add('False');
end;
end;
CheckVersionCombo := TComboBox.Create(SantyForm);
with CheckVersionCombo do
begin
Parent := SantyForm;
Left := 271;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 12;
Text := 'Check Version?';
with CheckVersionCombo.Items do
begin
Add('True');
Add('False');
end;
end;
TakeScreeniesCombo := TComboBox.Create(SantyForm);
with TakeScreeniesCombo do
begin
Parent := SantyForm;
Left := 87;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 13;
Text := 'Take Screenshots?';
with TakeScreeniesCombo.Items do
begin
Add('True');
Add('False');
end;
end;
SRLIDEdit := TEdit.Create(SantyForm);
with SRLIDEdit do
begin
Parent := SantyForm;
Left := 263;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 14;
Text := 'SRL ID?';
end;
SRLPassEdit := TEdit.Create(SantyForm);
with SRLPassEdit do
begin
Parent := SantyForm;
Left := 127;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 16;
Text := 'SRL Password?';
end;
end;

procedure SafeGuildminerWelcome;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('GuildminerWelcome', V);
end;

procedure ShowGuildminerWelcomeModal;
begin
SantyForm.ShowModal;
end;

procedure SafeShowGuildminerWelcomeModal;
var
R : TVariantArray;
begin
SetArrayLength(R, 0);
ThreadSafeCall('ShowGuildminerWelcomeModal', R);
end;

procedure MainGuildminerWelcome;
begin
try
SafeGuildminerWelcome;
SafeShowGuildminerWelcomeModal;
except
WriteLn('An error seems to have occurred in: GuildminerWelcome');
end;
end;

begin
ClearDebug;
MainGuildminerWelcome;
if OpenPlayerForm then
WriteLn('Started');
end.
:D

Santa_Clause

2007-09-30 23:59:49

I did that a long time ago :)

program New;
{.include SRL/SRL.scar}

var
SantyForm : TForm;
TitleLabelWelcome : TLabel;
BeginButtonWelcome, CancelButtonWelcome : TButton;
LoadsNumberEdit, SRLIDEdit, SRLPassEdit : TEdit;
RespondCombo, CheckVersionCombo, TakeScreeniesCombo : TComboBox;
OpenPlayerForm : Boolean;
HowManyLoads : Integer;
UseResponder, CheckVersion, TakeScreens : Boolean;
Background : TImage;

function GetNumbersBool(S : string) : Boolean;
begin
Result := (Length(GetNumbers(S)) = Length(S));
end;

procedure BeginScript(Senders : TObject);
begin
if not(GetNumbersBool(LoadsNumberEdit.Text)) then
begin
ShowMessage('Invalid Number Of Loads...Reverting To Default');
LoadsNumberEdit.Text := '4';
Exit;
end;

if (RespondCombo.Text = '') or (RespondCombo.Text = 'Respond?') then
begin
ShowMessage('Invalid Value In Use Responder Box...Reverting To Default');
RespondCombo.Text := 'False';
Exit;
end;

if (CheckVersionCombo.Text = '') or (CheckVersionCombo.Text = 'Check Version?') then
begin
ShowMessage('Invalid Value In Check Version Box...Reverting To Default');
CheckVersionCombo.Text := 'True';
Exit;
end;

if (TakeScreeniesCombo.Text = '') or (TakeScreeniesCombo.Text = 'Take Screenshots?') then
begin
ShowMessage('Invalid Value In Take Screenshots Box...Reverting To Default');
TakeScreeniesCombo.Text := 'True';
Exit;
end;

if (SRLIDEdit.Text = '') or (SRLIDEdit.Text = 'SRL ID?')
or (SRLPassEdit.Text = '') or (SRLPassEdit.Text = 'SRL Pass?') then
begin
ShowMessage('Invalid SRL ID/Password...Reverting To Global Account');
SRLIDEdit.Text := '2388';
SRLPassEdit.Text := 'Leechers';
Exit;
end;

try
HowManyLoads := StrToInt(LoadsNumberEdit.Text);
WriteLn(IntToStr(HowManyLoads));
except
WriteLn('Some Weird Error');
end;

try
UseResponder := (StrToBool(RespondCombo.Text));
CheckVersion := StrToBool(CheckVersionCombo.Text);
TakeScreens := StrToBool(TakeScreeniesCombo.Text);
except
WriteLn('Bool Errors');
end;

SRLID := SRLIDEdit.Text;
SRLPassword := SRLPassEdit.Text;

OpenPlayerForm := True;
SantyForm.ModalResult := mrOk;
end;

procedure EndScript(Senders : TObject);
begin
SantyForm.ModalResult := mrCancel;
OpenPlayerForm := False;
end;

procedure GuildminerWelcome;
var
K, K2 : Integer;
begin
SantyForm := CreateForm;
with SantyForm do
begin
Position := poScreenCenter;
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
ClientWidth := 510;
ClientHeight := 340;
Caption := 'frmDesign';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
Background := TImage.Create(SantyForm);
with Background do
begin
Parent := SantyForm;
SetBounds(0, 0, 510, 340);
end;
TitleLabelWelcome := TLabel.Create(SantyForm);
with TitleLabelWelcome do
begin
Parent := SantyForm;
Left := 152;
Top := 24;
Width := 218;
Height := 33;
Caption := 'JuKKa'#39's Guild-Miner!';
Font.Color := clRed;
Font.Height := -27;
Font.Name := 'Monotype Corsiva';
Font.Style := [];
ParentFont := False;
end;
BeginButtonWelcome := TButton.Create(SantyForm);
with BeginButtonWelcome do
begin
Parent := SantyForm;
Left := 263;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Begin';
TabOrder := 8;
OnClick := @BeginScript;
end;
CancelButtonWelcome := TButton.Create(SantyForm);
with CancelButtonWelcome do
begin
Parent := SantyForm;
Left := 167;
Top := 240;
Width := 75;
Height := 25;
Caption := 'Cancel';
TabOrder := 9;
OnClick := @EndScript;
end;
LoadsNumberEdit := TEdit.Create(SantyForm);
with LoadsNumberEdit do
begin
Parent := SantyForm;
Left := 279;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 10;
Text := 'Number Of Loads?';
end;
RespondCombo := TComboBox.Create(SantyForm);
with RespondCombo do
begin
Parent := SantyForm;
Left := 95;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 11;
Text := 'Respond?';
with RespondCombo.Items do
begin
Add('True');
Add('False');
end;
end;
CheckVersionCombo := TComboBox.Create(SantyForm);
with CheckVersionCombo do
begin
Parent := SantyForm;
Left := 271;
Top := 160;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 12;
Text := 'Check Version?';
with CheckVersionCombo.Items do
begin
Add('True');
Add('False');
end;
end;
TakeScreeniesCombo := TComboBox.Create(SantyForm);
with TakeScreeniesCombo do
begin
Parent := SantyForm;
Left := 87;
Top := 128;
Width := 145;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ItemHeight := 13;
ParentFont := False;
TabOrder := 13;
Text := 'Take Screenshots?';
with TakeScreeniesCombo.Items do
begin
Add('True');
Add('False');
end;
end;
SRLIDEdit := TEdit.Create(SantyForm);
with SRLIDEdit do
begin
Parent := SantyForm;
Left := 263;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 14;
Text := 'SRL ID?';
end;
SRLPassEdit := TEdit.Create(SantyForm);
with SRLPassEdit do
begin
Parent := SantyForm;
Left := 127;
Top := 192;
Width := 121;
Height := 21;
Font.Color := clRed;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
ParentFont := False;
TabOrder := 16;
Text := 'SRL Password?';
end;

K := BitmapFromString(1, 1, 'FFFFFF');
K2 := BitmapFromString(59, 47, '000000');
SafeCopyCanvas(GetBitmapCanvas(K2), Background.Canvas, 0, 0, 59, 47, 0, 0, 510, 340);
SafeCopyCanvas(GetBitmapCanvas(K), Background.Canvas, 0, 0, 1, 1, 0, 0, 2, 510);
SafeCopyCanvas(GetBitmapCanvas(K), Background.Canvas, 0, 0, 1, 1, 508, 0, 510, 340);
SafeCopyCanvas(GetBitmapCanvas(K), Background.Canvas, 0, 0, 1, 1, 0, 0, 510, 2);
SafeCopyCanvas(GetBitmapCanvas(K), Background.Canvas, 0, 0, 1, 1, 0, 338, 510, 340);
end;

procedure SafeGuildminerWelcome;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('GuildminerWelcome', V);
end;

procedure ShowGuildminerWelcomeModal;
begin
SantyForm.ShowModal;
end;

procedure SafeShowGuildminerWelcomeModal;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowGuildminerWelcomeModal', V);
end;

procedure MainGuildminerWelcome;
begin
try
SafeGuildminerWelcome;
SafeShowGuildminerWelcomeModal;
except
WriteLn('An error seems to have occurred in: GuildminerWelcome');
end;
end;

begin
ClearDebug;
GetSelf.WindowState := wsMinimized;
MainGuildminerWelcome;
if OpenPlayerForm then
WriteLn('Started');
end.

How about this? If you don't fill in the 'Number Of Loads' box then it freezes the form.

bullzeye95

2007-10-01 07:46:50

It's fine for me :confused: