Trying to get back into Srl through re-writing scripts I used and loved back then...
I am though having trouble with forms receiving error's such as Error in InitForm! and Error: Out Of Range at line 1548 and was wondering if someone could help me get back into the groove.
I plan on Applying for srl very soon
.
Here is how I do the form...Error lines will be commented...
Simba Code:
Procedure SafeInitForm; //How I start the form
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end; //Out of range here
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
The actual form itself; it says there's a error in it, I can't figure out what it is...:
Simba Code:
Procedure InitForm;
Begin
LoadUs2;
frmDesign := CreateForm;
frmDesign.Position := poDesktopCenter;
frmDesign.Width := 313;
frmDesign.Height := 285;
frmDesign.Caption := 'Caption';
frmDesign.Color := clInactiveCaption;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.PixelsPerInch := 96;
frmDesign.OnCloseQuery := @FormClose2;
TitleLabel := TLabel.Create(frmDesign);
TitleLabel.Parent := frmDesign;
TitleLabel.Left := 28;
TitleLabel.Top := 10;
TitleLabel.Width := 277;
TitleLabel.Height := 20;
TitleLabel.Caption := 'Caption';
TitleLabel.Font.Color := clWindowText;
TitleLabel.Font.Height := -17;
TitleLabel.Font.Name := 'MS Sans Serif';
TitleLabel.Font.Style := [fsBold, fsUnderline];
TitleLabel.ParentFont := False;
CreatePlayerButton := TButton.Create(frmDesign);
CreatePlayerButton.Parent := frmDesign;
CreatePlayerButton.Left := 60;
CreatePlayerButton.Top := 35;
CreatePlayerButton.Width := 83;
CreatePlayerButton.Height := 29;
CreatePlayerButton.Hint := 'Click to Create a New Player';
CreatePlayerButton.Caption := 'Create Player';
CreatePlayerButton.ParentShowHint := False;
CreatePlayerButton.ShowHint := True;
CreatePlayerButton.TabOrder := 13;
CreatePlayerButton.OnClick := @CreateNewUser;
DeletePlayerButton := TButton.Create(frmDesign);
DeletePlayerButton.Parent := frmDesign;
DeletePlayerButton.Left := 150;
DeletePlayerButton.Top := 35;
DeletePlayerButton.Width := 83;
DeletePlayerButton.Height := 29;
DeletePlayerButton.Hint := 'Click to Delete the Current Player';
DeletePlayerButton.Caption := 'Delete Player';
DeletePlayerButton.ParentShowHint := False;
DeletePlayerButton.ShowHint := True;
DeletePlayerButton.TabOrder := 13;
DeletePlayerButton.OnClick := @DeleteAPlayer;
LeftButton := TButton.Create(frmDesign);
LeftButton.Parent := frmDesign;
LeftButton.Left := 15;
LeftButton.Top := 35;
LeftButton.Width := 38;
LeftButton.Height := 29;
LeftButton.Hint := 'Click to go to the Previous Player';
LeftButton.Caption := '<---';
LeftButton.ParentShowHint := False;
LeftButton.ShowHint := True;
LeftButton.TabOrder := 13;
LeftButton.OnClick := @PressBackButton;
RightButton := TButton.Create(frmDesign);
RightButton.Parent := frmDesign;
RightButton.Left := 239;
RightButton.Top := 35;
RightButton.Width := 38;
RightButton.Height := 29;
RightButton.Hint := 'Click to go to the Next Player';
RightButton.Caption := '--->';
RightButton.ParentShowHint := False;
RightButton.ShowHint := True;
RightButton.TabOrder := 14;
RightButton.OnClick := @PressNextButton;
UsernameLabel := TLabel.Create(frmDesign);
UsernameLabel.Parent := frmDesign;
UsernameLabel.Left := 16;
UsernameLabel.Top := 73;
UsernameLabel.Width := 63;
UsernameLabel.Height := 16;
UsernameLabel.Font.Color := clWindowText;
UsernameLabel.Font.Height := -15;
UsernameLabel.Font.Name := 'MS Sans Serif';
UsernameLabel.Font.Style := [];
UsernameLabel.ParentFont := False;
UsernameLabel.Caption := '0. Username';
PasswordLabel := TLabel.Create(frmDesign);
PasswordLabel.Parent := frmDesign;
PasswordLabel.Left := 16;
PasswordLabel.Top := 96;
PasswordLabel.Width := 60;
PasswordLabel.Height := 16;
PasswordLabel.Font.Color := clWindowText;
PasswordLabel.Font.Height := -15;
PasswordLabel.Font.Name := 'MS Sans Serif';
PasswordLabel.Font.Style := [];
PasswordLabel.ParentFont := False;
PasswordLabel.Caption := '0. Password';
LampSkillLabel := TLabel.Create(frmDesign);
LampSkillLabel.Parent := frmDesign;
LampSkillLabel.Left := 16;
LampSkillLabel.Top := 120;
LampSkillLabel.Width := 62;
LampSkillLabel.Height := 16;
LampSkillLabel.Font.Color := clWindowText;
LampSkillLabel.Font.Height := -15;
LampSkillLabel.Font.Name := 'MS Sans Serif';
LampSkillLabel.Font.Style := [];
LampSkillLabel.ParentFont := False;
LampSkillLabel.Caption := '0. Lamp Skill';
TripsLabel := TLabel.Create(frmDesign);
TripsLabel.Parent := frmDesign;
TripsLabel.Left := 16;
TripsLabel.Top := 144;
TripsLabel.Width := 62;
TripsLabel.Height := 16;
TripsLabel.Font.Color := clWindowText;
TripsLabel.Font.Height := -15;
TripsLabel.Font.Name := 'MS Sans Serif';
TripsLabel.Font.Style := [];
TripsLabel.ParentFont := False;
TripsLabel.Caption := '0. Loads';
UsernameEdit := TEdit.Create(frmDesign);
UsernameEdit.Parent := frmDesign;
UsernameEdit.Left := 100;
UsernameEdit.Top := 71;
UsernameEdit.Width := 121;
UsernameEdit.Height := 21;
UsernameEdit.Hint := 'Type in your Username here';
UsernameEdit.ParentShowHint := False;
UsernameEdit.ShowHint := True;
UsernameEdit.TabOrder := 8;
UsernameEdit.Text := Players[0].Name;
PasswordEdit := TEdit.Create(frmDesign);
PasswordEdit.Parent := frmDesign;
PasswordEdit.Left := 100;
PasswordEdit.Top := 94;
PasswordEdit.Width := 121;
PasswordEdit.Height := 21;
PasswordEdit.Hint := 'Type in your Password here';
PasswordEdit.ParentShowHint := False;
PasswordEdit.PasswordChar := '*';
PasswordEdit.ShowHint := True;
PasswordEdit.TabOrder := 9;
PasswordEdit.Text := Players[0].Pass;
LampSkillComboBox := TComboBox.Create(frmDesign);
LampSkillComboBox.Parent := frmDesign;
LampSkillComboBox.Left := 100;
LampSkillComboBox.Top := 117;
LampSkillComboBox.Width := 121;
LampSkillComboBox.Height := 21;
LampSkillComboBox.Hint := 'Type in the Skill you want to use a Lamp on if Found';
LampSkillComboBox.ItemHeight := 13;
LampSkillComboBox.ParentShowHint := False;
LampSkillComboBox.ShowHint := True;
LampSkillComboBox.TabOrder := 10;
LampSkillComboBox.Text := Players[0].Skill;
LampSkillComboBox.Items.Add('Strength');
LampSkillComboBox.Items.Add('Attack');
LampSkillComboBox.Items.Add('Ranged');
LampSkillComboBox.Items.Add('Magic');
LampSkillComboBox.Items.Add('Defence');
LampSkillComboBox.Items.Add('Hitpoints');
LampSkillComboBox.Items.Add('Prayer');
LampSkillComboBox.Items.Add('Agility');
LampSkillComboBox.Items.Add('Herblore');
LampSkillComboBox.Items.Add('Thieving');
LampSkillComboBox.Items.Add('Crafting');
LampSkillComboBox.Items.Add('Runecrafting');
LampSkillComboBox.Items.Add('Slayer');
LampSkillComboBox.Items.Add('Farming');
LampSkillComboBox.Items.Add('Mining');
LampSkillComboBox.Items.Add('Smithing');
LampSkillComboBox.Items.Add('Fishing');
LampSkillComboBox.Items.Add('Cooking');
LampSkillComboBox.Items.Add('Firemaking');
LampSkillComboBox.Items.Add('Woodcutting');
LampSkillComboBox.Items.Add('Fletching');
LampSkillComboBox.Items.Add('Construction');
LampSkillComboBox.Items.Add('Hunting');
LoadsEdit := TEdit.Create(frmDesign);
LoadsEdit.Parent := frmDesign;
LoadsEdit.Left := 100;
LoadsEdit.Top := 140;
LoadsEdit.Width := 121;
LoadsEdit.Height := 21;
LoadsEdit.Hint := 'Loads/player.';
LoadsEdit.ParentShowHint := False;
LoadsEdit.ShowHint := True;
LoadsEdit.TabOrder := 10;
LoadsEdit.Text := IntToStr(Players[0].{Integer2}Integers[1]);
IsActive := TCheckBox.Create(frmDesign);
IsActive.Parent := frmDesign;
IsActive.Left := 225;
IsActive.Top := 71;
IsActive.Width := 53;
IsActive.Height := 20;
IsActive.Caption := 'Active?';
IsActive.ParentShowHint := False;
IsActive.ShowHint := True;
IsActive.Hint := 'Should this Player be Active?';
IsActive.Checked := Players[0].Active;
ColorCheckBox := TCheckBox.Create(frmDesign);
ColorCheckBox.Parent := frmDesign;
ColorCheckBox.Left := 225;
ColorCheckBox.Top := 94;
ColorCheckBox.Width := 53;
ColorCheckBox.Height := 20;
ColorCheckBox.Caption := 'Colors?';
ColorCheckBox.ParentShowHint := False;
ColorCheckBox.ShowHint := True;
ColorCheckBox.Hint := 'Do you want to pick Your Own Colors?';
ColorCheckBox.Checked := Players[0].{Boolean1}Booleans[0];
ColorCheckBox.OnClick := @ChangeLabels;
String1ComboBox := TComboBox.Create(frmDesign);
String1ComboBox.Parent := frmDesign;
String1ComboBox.Left := 10;
String1ComboBox.Top := 165;
String1ComboBox.Width := 80;
String1ComboBox.Height := 21;
String1ComboBox.Hint := 'Select the Skill to Power Auto';
String1ComboBox.ItemHeight := 13;
String1ComboBox.ParentShowHint := False;
String1ComboBox.ShowHint := True;
String1ComboBox.TabOrder := 11;
String1ComboBox.Text := Players[0].{String1}Strings[0];
String1ComboBox.Items.Add('Woodcutting');
String1ComboBox.Items.Add('Mining');
String1ComboBox.Items.Add('Fishing');
String1ComboBox.Items.Add('Bone Burying');
String1ComboBox.Items.Add('Fletching');
String1ComboBox.OnChange := @String1Change;
String2ComboBox := TComboBox.Create(frmDesign);
String2ComboBox.Parent := frmDesign;
String2ComboBox.Left := 95;
String2ComboBox.Top := 165;
String2ComboBox.Width := 120;
String2ComboBox.Height := 21;
String2ComboBox.Hint := 'Select the Specific thing to Power Auto';
String2ComboBox.ItemHeight := 13;
String2ComboBox.ParentShowHint := False;
String2ComboBox.ShowHint := True;
String2ComboBox.TabOrder := 12;
String2ComboBox.Text := Players[0].{String2}Strings[1];
String2ComboBox.OnDropDown := @String1Change;
String3ComboBox := TComboBox.Create(frmDesign);
String3ComboBox.Parent := frmDesign;
String3ComboBox.Left := 220;
String3ComboBox.Top := 165;
String3ComboBox.Width := 70;
String3ComboBox.Height := 21;
String3ComboBox.Hint := 'Select the Direction to Run in if we are Attacked';
String3ComboBox.ItemHeight := 13;
String3ComboBox.ParentShowHint := False;
String3ComboBox.ShowHint := True;
String3ComboBox.TabOrder := 12;
String3ComboBox.Items.Add('N');
String3ComboBox.Items.Add('E');
String3ComboBox.Items.Add('S');
String3ComboBox.Items.Add('W');
String3ComboBox.Text := Players[0].{String3}Strings[2];
GemsCheckBox := TCheckBox.Create(frmDesign);
GemsCheckBox.Parent := frmDesign;
GemsCheckBox.Left := 225;
GemsCheckBox.Top := 117;
GemsCheckBox.Width := 78;
GemsCheckBox.Height := 20;
GemsCheckBox.Caption := 'Save Gems?';
GemsCheckBox.ParentShowHint := False;
GemsCheckBox.ShowHint := True;
GemsCheckBox.Hint := 'Do you want to save the Gems you Mine?';
GemsCheckBox.Checked := Players[0].{Boolean3}Booleans[2];
If (String1ComboBox.Text = 'Mining') then
GemsCheckBox.Visible := True
else
GemsCheckBox.Visible := False;
FletchComboBox := TComboBox.Create(frmDesign);
FletchComboBox.Parent := frmDesign;
FletchComboBox.Left := 182;
FletchComboBox.Top := 193;
FletchComboBox.Width := 100;
FletchComboBox.Height := 21;
FletchComboBox.Hint := 'Select What Type of Log the Item is';
FletchComboBox.ItemHeight := 13;
FletchComboBox.ParentShowHint := False;
FletchComboBox.ShowHint := True;
FletchComboBox.TabOrder := 12;
FletchComboBox.Items.Add('Normal');
FletchComboBox.Items.Add('Oak');
FletchComboBox.Items.Add('Willow');
FletchComboBox.Items.Add('Maple');
FletchComboBox.Items.Add('Yew');
FletchComboBox.Items.Add('Magic');
FletchComboBox.Text := FletchString[0];
If (String1ComboBox.Text = 'Fletching') then
FletchComboBox.Visible := True
else
FletchComboBox.Visible := False;
ColorsLabel := TLabel.Create(frmDesign);
ColorsLabel.Parent := frmDesign;
ColorsLabel.Left := 10;
ColorsLabel.Top := 194;
ColorsLabel.Width := 80;
ColorsLabel.Height := 12;
ColorsLabel.Font.Color := clWindowText;
ColorsLabel.Font.Height := -12;
ColorsLabel.Font.Name := 'MS Sans Serif';
ColorsLabel.Font.Style := [];
ColorsLabel.ParentFont := False;
ColorsLabel.Caption := 'Picked Color:';
If (ColorCheckBox.Checked) then
ColorsLabel.Visible := True
else
ColorsLabel.Visible := False;
ColorsEdit := TEdit.Create(frmDesign);
ColorsEdit.Parent := frmDesign;
ColorsEdit.Left := 77;
ColorsEdit.Top := 191;
ColorsEdit.Width := 80;
ColorsEdit.Height := 21;
ColorsEdit.Hint := 'Put in the Color of the Item you are Autoing. Leave as 0 for AutoPick';
ColorsEdit.ParentShowHint := False;
ColorsEdit.ShowHint := True;
ColorsEdit.TabOrder := 8;
ColorsEdit.Text := IntToStr(Players[0].{Integer1}Integers[0]);
If (ColorCheckBox.Checked) then
ColorsEdit.Visible := True
else
ColorsEdit.Visible := False;
MiningSecsLabel := TLabel.Create(frmDesign);
MiningSecsLabel.Parent := frmDesign;
MiningSecsLabel.Left := 162;
MiningSecsLabel.Top := 194;
MiningSecsLabel.Width := 80;
MiningSecsLabel.Height := 12;
MiningSecsLabel.Font.Color := clWindowText;
MiningSecsLabel.Font.Height := -12;
MiningSecsLabel.Font.Name := 'MS Sans Serif';
MiningSecsLabel.Font.Style := [];
MiningSecsLabel.ParentFont := False;
MiningSecsLabel.Caption := 'Seconds:';
If (String1ComboBox.Text = 'Mining') then
MiningSecsLabel.Visible := True
else
MiningSecsLabel.Visible := False;
MiningSecsEdit := TEdit.Create(frmDesign);
MiningSecsEdit.Parent := frmDesign;
MiningSecsEdit.Left := 210;
MiningSecsEdit.Top := 191;
MiningSecsEdit.Width := 80;
MiningSecsEdit.Height := 21;
MiningSecsEdit.Hint := 'Number of Seconds you are willing to Wait for a rock to Mine before Clicking Again';
MiningSecsEdit.ParentShowHint := False;
MiningSecsEdit.ShowHint := True;
MiningSecsEdit.TabOrder := 8;
MiningSecsEdit.Text := IntToStr(Players[0].{Integer3}Integers[2]);
If (String1ComboBox.Text = 'Mining') then
MiningSecsEdit.Visible := True
else
MiningSecsEdit.Visible := False;
BankCheckBox := TCheckBox.Create(frmDesign);
BankCheckBox.Parent := frmDesign;
BankCheckBox.Left := 164;
BankCheckBox.Top := 192;
BankCheckBox.Width := 125;
BankCheckBox.Height := 20;
BankCheckBox.Caption := 'Withdraw From Bank?';
BankCheckBox.ParentShowHint := False;
BankCheckBox.ShowHint := True;
BankCheckBox.Hint := 'Click to Withdraw Bones from Bank and Bury. Otherwise it will pick up from Floor';
BankCheckBox.Checked := Players[0].{Boolean2}Booleans[1];
If (String1ComboBox.Text = 'Bone Burying') then
BankCheckBox.Visible := True
else
BankCheckBox.Visible := False;
StartButton := TButton.Create(frmDesign);
StartButton.Parent := frmDesign;
StartButton.Left := 60;
StartButton.Top := 220;
StartButton.Width := 75;
StartButton.Height := 25;
StartButton.Hint := 'Click to Start the Script';
StartButton.Caption := 'Start Script';
StartButton.ParentShowHint := False;
StartButton.ShowHint := True;
StartButton.TabOrder := 15;
StartButton.OnClick := @StartClicked;
DonateButton := TButton.Create(frmDesign);
DonateButton.Parent := frmDesign;
DonateButton.Left := 150;
DonateButton.Top := 220;
DonateButton.Width := 75;
DonateButton.Height := 25;
DonateButton.Hint := 'Donations are always Appreciated!';
DonateButton.Caption := 'Donate!';
DonateButton.ParentShowHint := False;
DonateButton.ShowHint := True;
DonateButton.TabOrder := 15;
DonateButton.OnClick := @DonateClicked;
end;
In my Main loop:
Simba Code:
try
SafeInitForm;
SafeShowFormModal;
except
Writeln('Error in InitForm!');
finally
FreeForm(frmDesign);
end;