Meh…I don't think it's shorter but at least it's tidier:
//-------------------------------------------------------------------\\
//--> SRL Installation Instructions
//-->
//--> 1) Close All Open Scar Windows
//--> 2) Extract SRL into your Scar Root Directory
//--> 3) Reopen Scar and Run This Script File
//--> 4) If you see Successfully executed. Then your done.
//-------------------------------------------------------------------\\
program SRLVariableSetupScript;
{.include SRL\SRL.Scar}
{ var frmMain: TForm;
Description: SRL SetupForm. }
var
frmMain : TForm;
{ var dFile, Ver: String;
Description: Variables used to store data in the SRL-Setup script. }
var
dFile, Ver : string;
{ var LUsrName, LMouseSpeed, LLampSkill: TLabel;
Description: Labels used on the SRL SetupForm. }
var
LUsrName, LMouseSpeed, LLampSkill : TLabel;
{ var LBenMouse, LUSS, LUSB, LUSC: TLabel;
Description: Labels used on the SRL SetupForm. }
var
LBenMouse, LUSS, LUSB, LUSC, LSRLID, LSRLPassword : TLabel;
{ var LLTO, LCHP, LBSS, LDRR: TLabel;
Description: Labels used on the SRL SetupForm. }
var
LLTO, LCHP, LBSS, LDRR : TLabel;
{ var EUsrName, EMouseSpeed: TEdit;
Description: Edit Boxes used on the SRL SetupForm. }
var
EUsrName, EMouseSpeed, ESRLID, ESRLPassword : TEdit;
{ var CLampSkill, CUSS, CUSB, CUSC: TComboBox;
Description: Combo boxes used on the SRL SetupForm. }
var
CLampSkill, CUSS, CUSB, CUSC : TComboBox;
{ var CBenMouse, CLTO, CCHP, CBSS, CDRR: TComboBox;
Description: Combo boxes used on the SRL SetupForm. }
var
CBenMouse, CLTO, CCHP, CBSS, CDRR : TComboBox;
{ var Button1, Button2, Button3, Button4, Button5: TButton;
Description: Buttons used on the SRL SetupForm. }
var
Button1, Button2, Button3, Button4, Button5 : TButton;
{*******************************************************************************
procedure CheckVersion;
By: Dankness
Description: Checks for Current SRL Version from Villu-Reborn.
*******************************************************************************}
procedure CheckVersion;
begin
Ver := GetPage('http://www.villu-reborn.com/srl/version.txt');
if (Ver <> SRLVersionNumber) then
begin
WriteLn('SRL Version ' + Ver + ' is now out.')
WriteLn('Please Visit [url]www.srl-forums.com[/url] to get latest version.');
end;
end;
{*******************************************************************************
procedure VisitSRL;
By: Dankness
Description: Opens SRL Homepage
*******************************************************************************}
procedure VisitSRL;
begin
OpenWebPage('http://www.srl-forums.com/');
end;
{*******************************************************************************
procedure AboutSRL;
By: Dankness
Description: Opens Developer Information from Villu-Reborn
*******************************************************************************}
procedure AboutSRL;
begin
OpenWebPage('http://www.srl-forums.com/forum/vbugs.php');
end;
{*******************************************************************************
procedure ViewManual;
By: Dankness
Description: Opens Online SRL Manual.
*******************************************************************************}
procedure ViewManual;
begin
OpenWebPage('http://www.srl-forums.com/forum/Manual.php');
end;
{*******************************************************************************
function getCFGData(dName: String): String;
By: Dankness
Description: Reads Data from CFG File based on procedure by RSN.
*******************************************************************************}
function getCFGData(dName : string) : string;
var
tString : string;
begin
Result := '';
tString := dName + '=';
if (Pos(tString, dFile) = 0) then
Exit;
Result := dFile;
Delete(Result, 1, Pos(tString, dFile));
Result := Copy(Result, Length(tString), Pos(Chr(13), Result) - Length(tString));
end;
{*******************************************************************************
procedure SaveConfig;
By: Dankness
Description: Saves Data from Form to Config Data File.
*******************************************************************************}
procedure SaveConfig;
var
aFile : Integer;
begin
Status('Saving Settings to Config Data File');
aFile := ReWriteFile(AppPath + 'SRL.CFG', False);
if (aFile < 0) then
Exit;
WriteFileString(aFile, 'Filename=' + EUsrName.Text + Chr(13));
WriteFileString(aFile, 'Benmouse=' + CBenMouse.Text + Chr(13));
WriteFileString(aFile, 'Mousespeed=' + EMouseSpeed.Text + Chr(13));
WriteFileString(aFile, 'Lampskill=' + CLampSkill.Text + Chr(13));
WriteFileString(aFile, 'UseSandwichSolver=' + CUSS.Text + Chr(13));
WriteFileString(aFile, 'UseBoxSolver=' + CUSB.Text + Chr(13));
WriteFileString(aFile, 'UseCerterSolver=' + CUSC.Text + Chr(13));
WriteFileString(aFile, 'LogOutTime=' + CLTO.Text + Chr(13));
WriteFileString(aFile, 'Check HP=' + CCHP.Text + Chr(13));
WriteFileString(aFile, 'Screenshots=' + CBSS.Text + Chr(13));
WriteFileString(aFile, 'DebugRadialRoad=' + CDRR.Text + Chr(13));
WriteFileString(aFile, 'SRLID=' + ESRLID.Text + Chr(13));
WriteFileString(aFile, 'SRLPassword=' + ESRLPassword.Text + Chr(13));
CloseFile(aFile);
end;
{*******************************************************************************
procedure LoadConfig;
By: Dankness
Description: Loads Settings from Config Data file for Form.
*******************************************************************************}
procedure LoadConfig;
begin
LoadSRLConfig;
EUsrName.Text := Filename;
CBenMouse.Text := BoolToStr(BenMouse);
EMouseSpeed.Text := IntToStr(MouseSpeed);
CLampSkill.Text := LampSkill;
CUSS.Text := BoolToStr(UseSandwichSolver);
CUSB.Text := BoolToStr(UseBoxSolver);
CUSC.Text := BoolToStr(UseCerterSolver);
CLTO.Text := BoolToStr(LogTimeOut);
CCHP.Text := BoolToStr(CheckHPFirst);
CBSS.Text := BoolToStr(Screenshots);
CDRR.Text := BoolToStr(DebugRadialRoad);
ESRLID.Text := SRLID;
ESRLPassword.Text := SRLPassword;
end;
{*******************************************************************************
procedure ButtonClick2(sender: TObject);
By: Dankness
Description: ButtonClick Actions.
*******************************************************************************}
procedure ButtonClick2(Sender : TObject);
begin
case Sender of
Button1 : CheckVersion;
Button2 : VisitSRL;
Button3 : ViewManual;
Button4 : AboutSRL;
Button5 : begin
SaveConfig;
frmMain.ModalResult := mrOk;
end;
end;
end;
{*******************************************************************************
procedure MainInitForm;
By: Dankness
Description: Main Form Procedures.
*******************************************************************************}
procedure MainInitForm;
var
TT, TL, EL : Integer;
begin
frmMain := CreateForm;
with frmMain do
begin
SetBounds(0, 0, 457, 400);
Caption := 'SRL Settings Form';
Color := clInactiveCaption;
Position := poScreenCenter;
BorderIcons := [biMinimize, biSystemMenu];
BorderStyle := bsSingle;
end;
TT := 26;
TL := 71;
EL := 161;
LUsrName := TLabel.Create(frmMain);
with LUsrName do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Hint := 'Filename to use For UserManagers';
Caption := 'Filename';
Font.Name := 'MS Sans Serif';
end;
EUsrName := TEdit.Create(frmMain);
with EUsrName do
begin
Parent := frmMain;
SetBounds(EL, TT, 121, 21);
AutoSelect := False;
ShowHint := True;
TabOrder := 2;
Text := 'Chars';
end;
TT := TT + 21;
LBenMouse := TLabel.Create(frmMain);
with LBenMouse do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'BenMouse';
Font.Name := 'MS Sans Serif';
end;
CBenMouse := TComboBox.Create(frmMain);
with CBenMouse do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Use Spline Mouse';
ShowHint := True;
TabOrder := 13;
Text := 'True';
with Items do
begin
Add('True');
Add('False');
end;
end;
Button1 := TButton.Create(frmMain);
with Button1 do
begin
Parent := frmMain;
SetBounds(EL + 160, TT, 90, 25);
Caption := 'Check Version';
TabOrder := 17;
OnClick := @buttonclick2;
end;
TT := TT + 21;
LMouseSpeed := TLabel.Create(frmMain);
with LMouseSpeed do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'MouseSpeed';
Font.Name := 'MS Sans Serif';
end;
EMouseSpeed := TEdit.Create(frmMain);
with EMouseSpeed do
begin
Parent := frmMain;
SetBounds(EL, TT, 121, 21);
AutoSelect := False;
ShowHint := True;
Hint := 'Lowest is Faster, Highest is Slower';
TabOrder := 2;
Text := '15';
end;
TT := TT + 21;
LLampSkill := TLabel.Create(frmMain);
with LLampSkill do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'LampSkill';
Font.Name := 'MS Sans Serif';
end;
CLampSkill := TComboBox.Create(frmMain);
with CLampSkill do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Skill to Use the Lamp on If one is Found';
ShowHint := True;
TabOrder := 13;
Text := 'Mining';
with Items do
begin
Add('Strength');
Add('Attack');
Add('Ranged');
Add('Magic');
Add('Defence');
Add('Hitpoints');
Add('Prayer');
Add('Agility');
Add('Herblore');
Add('Thieving');
Add('Crafting');
Add('RuneCraft');
Add('Slayer');
Add('Farming');
Add('Mining');
Add('Smithing');
Add('Fishing');
Add('Cooking');
Add('Firemaking');
Add('Woodcutting');
Add('Fletching');
Add('Hunter');
end;
end;
Button2 := TButton.Create(frmMain);
with Button2 do
begin
Parent := frmMain;
SetBounds(EL + 160, TT, 90, 25);
Caption := 'SRL Forums';
TabOrder := 17;
OnClick := @buttonclick2;
end;
TT := TT + 21;
LUSS := TLabel.Create(frmMain);
with LUSS do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Sandwich Solver';
Font.Name := 'MS Sans Serif';
end;
CUSS := TComboBox.Create(frmMain);
with CUSS do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Use Sandwich Solver or Logout';
ShowHint := True;
TabOrder := 13;
Text := 'True';
with Items do
begin
Add('True');
Add('False');
end;
end;
TT := TT + 21;
LUSB := TLabel.Create(frmMain);
with LUSB do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'BoxSolver Solver';
Font.Name := 'MS Sans Serif';
end;
CUSB := TComboBox.Create(frmMain);
with CUSB do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Use BoxSolver Solver or GambleBox';
ShowHint := True;
TabOrder := 13;
Text := 'True';
with Items do
begin
Add('True');
Add('False');
end;
end;
Button3 := TButton.Create(frmMain);
with Button3 do
begin
Parent := frmMain;
SetBounds(EL + 160, TT, 90, 25);
Caption := 'View Manual';
TabOrder := 17;
OnClick := @buttonclick2;
end;
TT := TT + 21;
LUSC := TLabel.Create(frmMain);
with LUSC do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Certer Solver';
Font.Name := 'MS Sans Serif';
end;
CUSC := TComboBox.Create(frmMain);
with CUSC do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Use Certer Solver or Logout';
ShowHint := True;
TabOrder := 13;
Text := 'True';
with Items do
begin
Add('True');
Add('False');
end;
end;
TT := TT + 21;
LLTO := TLabel.Create(frmMain);
with LLTO do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Timeout LogOuts';
Font.Name := 'MS Sans Serif';
end;
CLTO := TComboBox.Create(frmMain);
with CLTO do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'LogOut or Let Runescape Timeout';
ShowHint := True;
TabOrder := 13;
Text := 'False';
with Items do
begin
Add('True');
Add('False');
end;
end;
Button4 := TButton.Create(frmMain);
with Button4 do
begin
Parent := frmMain;
SetBounds(EL + 160, TT, 90, 25);
Caption := 'Report Bugs';
TabOrder := 17;
OnClick := @buttonclick2;
end;
TT := TT + 21;
LCHP := TLabel.Create(frmMain);
with LCHP do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Check HitPoints';
Font.Name := 'MS Sans Serif';
end;
CCHP := TComboBox.Create(frmMain);
with CCHP do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Check HP before Running';
ShowHint := True;
TabOrder := 13;
Text := 'False';
with Items do
begin
Add('True');
Add('False');
end;
end;
TT := TT + 21;
LBSS := TLabel.Create(frmMain);
with LBSS do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Screenshots';
Font.Name := 'MS Sans Serif';
end;
CBSS := TComboBox.Create(frmMain);
with CBSS do
begin
Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Save Screenshots for Randoms';
ShowHint := True;
TabOrder := 13;
Text := 'False';
with Items do
begin
Add('True');
Add('False');
end;
end;
TT := TT + 21;
LDRR := TLabel.Create(frmMain);
with LDRR do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Caption := 'Debug R-R-W';
Font.Name := 'MS Sans Serif';
end;
CDRR := TComboBox.Create(frmMain);
with CDRR do
begin
CDRR.Parent := FrmMain;
SetBounds(EL, TT, 121, 21);
Hint := 'Display Debug Image for RadialRoadWalk';
ShowHint := True;
Text := 'False';
with Items do
begin
Add('True');
Add('False');
end;
end;
TT := TT + 21;
LSRLID := TLabel.Create(frmMain);
with LSRLID do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Hint := 'ID Number from Villu-Reborn Stat Project';
Caption := 'SRL ID#';
Font.Name := 'MS Sans Serif';
end;
ESRLID := TEdit.Create(frmMain);
with ESRLID do
begin
Parent := frmMain;
SetBounds(EL, TT, 121, 21);
AutoSelect := False;
TabOrder := 15;
end;
TT := TT + 21;
LSRLPassword := TLabel.Create(frmMain);
with LSRLPassword do
begin
Parent := frmMain;
SetBounds(TL, TT, 76, 21);
Hint := 'Password from Villu-Reborn Stat Project';
Caption := 'SRL Password';
Font.Name := 'MS Sans Serif';
end;
ESRLPassword := TEdit.Create(frmMain);
with ESRLPassword do
begin
Parent := frmMain;
SetBounds(EL, TT, 121, 21);
AutoSelect := False;
TabOrder := 16;
PasswordChar := '*';
end;
Button5 := TButton.Create(frmMain);
with Button5 do
begin
Parent := frmMain;
SetBounds(EL + 13, TT + 50, 90, 25);
Button5.Caption := 'Save Settings';
Button5.TabOrder := 17;
Button5.OnClick := @buttonclick2;
end;
end;
procedure SafeMainInitForm;
var
v : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('MainInitForm', V);
end;
function ShowMainFormModal : Boolean;
begin
Result := False;
if (frmMain.ShowModal = mrOk) then
Result := True;
end;
function SafeShowMainFormModal : Boolean;
var
v : TVariantArray;
begin
SetArrayLength(V, 0);
Result := ThreadSafeCall('ShowMainFormModal', v);
end;
begin
ClearDebug;
SetUpSRL;
SafeMainInitForm;
LoadConfig;
SafeShowMainFormModal;
FreeForm(frmMain);
end.