SRL Archive - Help and Support

Form Trouble


WhoCares357

2009-04-07 14:54:15

The script is a bit lengthy, but I'll post it anyway.

program New;

var
frm_SETTINGS : TForm;
MyLabel: Array[0..23] of TLabel;
txt_SRL_ID, txt_SRL_PASS, txt_MOUSESPEED, txt_FAILEDCHECKS: TEdit;
txt_ANTIBANCHANCE, txt_RANDOMSEVERY, txt_RUNTIME, txt_LOGOUTTIME: TEdit;
txt_WAITTIME, txt_ALCHSPEED, txt_OPENBANK: TEdit;
dropbox_RUNDIRECTION: TComboBox;
chk_ANTIBAN, chk_ANTIRANDOMS, chk_HOUSE: TCheckBox;
Panel1 : TPanel;
radio_USESPELL, radio_MANUAL: TRadioButton;
btn_START, btn_LOAD, btn_SAVE: TButton;


procedure StartScript(sender: TObject);
begin

Writeln('Button pressed!');
frm_SETTINGS.Caption := frm_SETTINGS.Caption + '.';
frm_SETTINGS.ModalResult := mrOk;
end;

procedure InitForm;

var
i: Integer;

begin
frm_SETTINGS := CreateForm;
frm_SETTINGS.Left := 391;
frm_SETTINGS.Top := 45;
frm_SETTINGS.Width := 452;
frm_SETTINGS.Height := 704;
frm_SETTINGS.Caption := 'Ample Alcher Settings';
frm_SETTINGS.Color := clBtnFace;
frm_SETTINGS.Font.Color := clWindowText;
frm_SETTINGS.Font.Height := -11;
frm_SETTINGS.Font.Name := 'MS Sans Serif';
frm_SETTINGS.Font.Style := [];
frm_SETTINGS.Visible := True;
frm_SETTINGS.PixelsPerInch := 96;

MyLabel[0] := TLabel.Create(frm_SETTINGS);
MyLabel[0].Parent := frm_SETTINGS;
MyLabel[0].Left := 48;
MyLabel[0].Top := 8;
MyLabel[0].Width := 272;
MyLabel[0].Height := 37;
MyLabel[0].Caption := 'Ample Alcher by WhoCares357';

MyLabel[1] := TLabel.Create(frm_SETTINGS);
MyLabel[1].Parent := frm_SETTINGS;
MyLabel[1].Left := 312;
MyLabel[1].Top := 48;
MyLabel[1].Width := 67;
MyLabel[1].Height := 24;
MyLabel[1].Caption := 'Settings';

MyLabel[2] := TLabel.Create(frm_SETTINGS);
MyLabel[2].Parent := frm_SETTINGS;
MyLabel[2].Left := 48;
MyLabel[2].Top := 80;
MyLabel[2].Width := 87;
MyLabel[2].Height := 20;
MyLabel[2].Caption := 'SRL-Stats ID:';

MyLabel[3] := TLabel.Create(frm_SETTINGS);
MyLabel[3].Parent := frm_SETTINGS;
MyLabel[3].Left := 48;
MyLabel[3].Top := 112;
MyLabel[3].Width := 139;
MyLabel[3].Height := 20;
MyLabel[3].Caption := 'SRL-Stats Password:';

MyLabel[4] := TLabel.Create(frm_SETTINGS);
MyLabel[4].Parent := frm_SETTINGS;
MyLabel[4].Left := 48;
MyLabel[4].Top := 144;
MyLabel[4].Width := 152;
MyLabel[4].Height := 20;
MyLabel[4].Hint := 'default is 15';
MyLabel[4].Caption := 'Custom Mouse Speed:';
MyLabel[4].ShowHint := True;

MyLabel[5] := TLabel.Create(frm_SETTINGS);
MyLabel[5].Parent := frm_SETTINGS;
MyLabel[5].Left := 48;
MyLabel[5].Top := 176;
MyLabel[5].Width := 98;
MyLabel[5].Height := 20;
MyLabel[5].Hint := 'In case attacked by a random.';
MyLabel[5].Caption := 'Run Direction:';
MyLabel[5].ShowHint := True;

MyLabel[6] := TLabel.Create(frm_SETTINGS);
MyLabel[6].Parent := frm_SETTINGS;
MyLabel[6].Left := 48;
MyLabel[6].Top := 208;
MyLabel[6].Width := 172;
MyLabel[6].Height := 20;
MyLabel[6].Hint := 'If script fails to alch, how many tries to alch again?';
MyLabel[6].Caption := 'Number of Failed Checks:';
MyLabel[6].ShowHint := True;

MyLabel[7] := TLabel.Create(frm_SETTINGS);
MyLabel[7].Parent := frm_SETTINGS;
MyLabel[7].Left := 48;
MyLabel[7].Top := 240;
MyLabel[7].Width := 64;
MyLabel[7].Height := 20;
MyLabel[7].Caption := 'Anti-Ban:';

MyLabel[8] := TLabel.Create(frm_SETTINGS);
MyLabel[8].Parent := frm_SETTINGS;
MyLabel[8].Left := 48;
MyLabel[8].Top := 272;
MyLabel[8].Width := 134;
MyLabel[8].Height := 20;
MyLabel[8].Hint := '0-100';
MyLabel[8].Caption := 'Chance of Anti-Ban:';
MyLabel[8].ShowHint := True;

MyLabel[9] := TLabel.Create(frm_SETTINGS);
MyLabel[9].Parent := frm_SETTINGS;
MyLabel[9].Left := 48;
MyLabel[9].Top := 304;
MyLabel[9].Width := 103;
MyLabel[9].Height := 20;
MyLabel[9].Caption := 'Anti-Randoms:';

MyLabel[10] := TLabel.Create(frm_SETTINGS);
MyLabel[10].Parent := frm_SETTINGS;
MyLabel[10].Left := 48;
MyLabel[10].Top := 336;
MyLabel[10].Width := 237;
MyLabel[10].Height := 20;
MyLabel[10].Caption := 'Perform Anti-Random Check Every';

MyLabel[11] := TLabel.Create(frm_SETTINGS);
MyLabel[11].Parent := frm_SETTINGS;
MyLabel[11].Left := 360;
MyLabel[11].Top := 336;
MyLabel[11].Width := 37;
MyLabel[11].Height := 20;
MyLabel[11].Caption := 'Alchs';

MyLabel[12] := TLabel.Create(frm_SETTINGS);
MyLabel[12].Parent := frm_SETTINGS;
MyLabel[12].Left := 48;
MyLabel[12].Top := 368;
MyLabel[12].Width := 27;
MyLabel[12].Height := 20;
MyLabel[12].Caption := 'Run';

MyLabel[13] := TLabel.Create(frm_SETTINGS);
MyLabel[13].Parent := frm_SETTINGS;
MyLabel[13].Left := 152;
MyLabel[13].Top := 368;
MyLabel[13].Width := 249;
MyLabel[13].Height := 20;
MyLabel[13].Hint := 'Setting this to 0 (zero) turns it off.';
MyLabel[13].Caption := 'Minutes Before Logging Out for a Bit';
MyLabel[13].ShowHint := True;

MyLabel[14] := TLabel.Create(frm_SETTINGS);
MyLabel[14].Parent := frm_SETTINGS;
MyLabel[14].Left := 48;
MyLabel[14].Top := 400;
MyLabel[14].Width := 73;
MyLabel[14].Height := 20;
MyLabel[14].Caption := 'Logout for';

MyLabel[15] := TLabel.Create(frm_SETTINGS);
MyLabel[15].Parent := frm_SETTINGS;
MyLabel[15].Left := 184;
MyLabel[15].Top := 400;
MyLabel[15].Width := 215;
MyLabel[15].Height := 20;
MyLabel[15].Caption := 'Minutes Before Logging Back In';

MyLabel[16] := TLabel.Create(frm_SETTINGS);
MyLabel[16].Parent := frm_SETTINGS;
MyLabel[16].Left := 48;
MyLabel[16].Top := 432;
MyLabel[16].Width := 130;
MyLabel[16].Height := 20;
MyLabel[16].Caption := 'Alch in Your House:';

MyLabel[17] := TLabel.Create(frm_SETTINGS);
MyLabel[17].Parent := frm_SETTINGS;
MyLabel[17].Left := 48;
MyLabel[17].Top := 464;
MyLabel[17].Width := 147;
MyLabel[17].Height := 20;
MyLabel[17].Hint := 'Start script in the house.';
MyLabel[17].Caption := 'How toAccess House:';
MyLabel[17].ShowHint := True;

MyLabel[18] := TLabel.Create(frm_SETTINGS);
MyLabel[18].Parent := frm_SETTINGS;
MyLabel[18].Left := 48;
MyLabel[18].Top := 536;
MyLabel[18].Width := 158;
MyLabel[18].Height := 20;
MyLabel[18].Hint := '1 is fastest, infinite is slowest. 2 is default.';
MyLabel[18].Caption := 'General Alching Speed:';
MyLabel[18].ShowHint := True;

MyLabel[19] := TLabel.Create(frm_SETTINGS);
MyLabel[19].Parent := frm_SETTINGS;
MyLabel[19].Left := 48;
MyLabel[19].Top := 568;
MyLabel[19].Width := 202;
MyLabel[19].Height := 20;
MyLabel[19].Hint := '1 is fastest, infinite is slowest. 2 is default.';
MyLabel[19].Caption := 'Wait Time Between Each Alch:';
MyLabel[19].ShowHint := True;

MyLabel[20] := TLabel.Create(frm_SETTINGS);
MyLabel[20].Parent := frm_SETTINGS;
MyLabel[20].Left := 328;
MyLabel[20].Top := 568;
MyLabel[20].Width := 85;
MyLabel[20].Height := 20;
MyLabel[20].Hint := '1 is fastest, infinite is slowest. 2 is default.';
MyLabel[20].Caption := 'Milliseconds';
MyLabel[20].ShowHint := True;

MyLabel[21] := TLabel.Create(frm_SETTINGS);
MyLabel[21].Parent := frm_SETTINGS;
MyLabel[21].Left := 392;
MyLabel[21].Top := 272;
MyLabel[21].Width := 13;
MyLabel[21].Height := 20;
MyLabel[21].Caption := '%';

MyLabel[22] := TLabel.Create(frm_SETTINGS);
MyLabel[22].Parent := frm_SETTINGS;
MyLabel[22].Left := 48;
MyLabel[22].Top := 600;
MyLabel[22].Width := 142;
MyLabel[22].Height := 20;
MyLabel[22].Hint := '1 is fastest, infinite is slowest. 2 is default.';
MyLabel[22].Caption := 'Try to Open the Bank';
MyLabel[22].ShowHint := True;

MyLabel[23] := TLabel.Create(frm_SETTINGS);
MyLabel[23].Parent := frm_SETTINGS;
MyLabel[23].Left := 256;
MyLabel[23].Top := 600;
MyLabel[23].Width := 41;
MyLabel[23].Height := 20;
MyLabel[23].Hint := '1 is fastest, infinite is slowest. 2 is default.';
MyLabel[23].Caption := 'Times';
MyLabel[23].ShowHint := True;

for i := 0 to 23 do
begin
MyLabel[i].Font.Color := clWindowText;
MyLabel[i].Font.Height := -16;
MyLabel[i].Font.Name := 'Myriad Pro Light';
MyLabel[i].Font.Style := [fsBold];
MyLabel[i].ParentFont := False;
MyLabel[i].ParentShowHint := False;
end;

txt_SRL_ID := TEdit.Create(frm_SETTINGS);
txt_SRL_ID.Parent := frm_SETTINGS;
txt_SRL_ID.Left := 280;
txt_SRL_ID.Top := 80;
txt_SRL_ID.Width := 121;
txt_SRL_ID.Height := 22;
txt_SRL_ID.Font.Color := clWindowText;
txt_SRL_ID.Font.Height := -11;
txt_SRL_ID.Font.Name := 'Raavi';
txt_SRL_ID.Font.Style := [fsBold];
txt_SRL_ID.ParentFont := False;
txt_SRL_ID.TabOrder := 0;

txt_SRL_PASS := TEdit.Create(frm_SETTINGS);
txt_SRL_PASS.Parent := frm_SETTINGS;
txt_SRL_PASS.Left := 280;
txt_SRL_PASS.Top := 112;
txt_SRL_PASS.Width := 121;
txt_SRL_PASS.Height := 22;
txt_SRL_PASS.Font.Color := clWindowText;
txt_SRL_PASS.Font.Height := -11;
txt_SRL_PASS.Font.Name := 'Raavi';
txt_SRL_PASS.Font.Style := [fsBold];
txt_SRL_PASS.ParentFont := False;
txt_SRL_PASS.PasswordChar := '*';
txt_SRL_PASS.TabOrder := 1;

txt_MOUSESPEED := TEdit.Create(frm_SETTINGS);
txt_MOUSESPEED.Parent := frm_SETTINGS;
txt_MOUSESPEED.Left := 368;
txt_MOUSESPEED.Top := 144;
txt_MOUSESPEED.Width := 33;
txt_MOUSESPEED.Height := 22;
txt_MOUSESPEED.Font.Color := clWindowText;
txt_MOUSESPEED.Font.Height := -11;
txt_MOUSESPEED.Font.Name := 'Raavi';
txt_MOUSESPEED.Font.Style := [fsBold];
txt_MOUSESPEED.MaxLength := 3;
txt_MOUSESPEED.ParentFont := False;
txt_MOUSESPEED.TabOrder := 2;
txt_MOUSESPEED.Text := '15';

dropbox_RUNDIRECTION := TComboBox.Create(frm_SETTINGS);
dropbox_RUNDIRECTION.Parent := frm_SETTINGS;
dropbox_RUNDIRECTION.Left := 328;
dropbox_RUNDIRECTION.Top := 176;
dropbox_RUNDIRECTION.Width := 73;
dropbox_RUNDIRECTION.Height := 22;
dropbox_RUNDIRECTION.DropDownCount := 4;
dropbox_RUNDIRECTION.Font.Color := clWindowText;
dropbox_RUNDIRECTION.Font.Height := -11;
dropbox_RUNDIRECTION.Font.Name := 'Myriad Pro';
dropbox_RUNDIRECTION.Font.Style := [fsBold];
dropbox_RUNDIRECTION.ItemHeight := 14;
dropbox_RUNDIRECTION.ParentFont := False;
dropbox_RUNDIRECTION.TabOrder := 3;
dropbox_RUNDIRECTION.Text := 'North';
dropbox_RUNDIRECTION.Items.Add('North');
dropbox_RUNDIRECTION.Items.Add('South');
dropbox_RUNDIRECTION.Items.Add('East');
dropbox_RUNDIRECTION.Items.Add('West');

txt_FAILEDCHECKS := TEdit.Create(frm_SETTINGS);
txt_FAILEDCHECKS.Parent := frm_SETTINGS;
txt_FAILEDCHECKS.Left := 368;
txt_FAILEDCHECKS.Top := 208;
txt_FAILEDCHECKS.Width := 33;
txt_FAILEDCHECKS.Height := 22;
txt_FAILEDCHECKS.Font.Color := clWindowText;
txt_FAILEDCHECKS.Font.Height := -11;
txt_FAILEDCHECKS.Font.Name := 'Raavi';
txt_FAILEDCHECKS.Font.Style := [fsBold];
txt_FAILEDCHECKS.ParentFont := False;
txt_FAILEDCHECKS.TabOrder := 4;
txt_FAILEDCHECKS.Text := '5';

chk_ANTIBAN := TCheckBox.Create(frm_SETTINGS);
chk_ANTIBAN.Parent := frm_SETTINGS;
chk_ANTIBAN.Left := 384;
chk_ANTIBAN.Top := 248;
chk_ANTIBAN.Width := 17;
chk_ANTIBAN.Height := 17;
chk_ANTIBAN.TabOrder := 5;
txt_ANTIBANCHANCE := TEdit.Create(frm_SETTINGS);
txt_ANTIBANCHANCE.Parent := frm_SETTINGS;
txt_ANTIBANCHANCE.Left := 352;
txt_ANTIBANCHANCE.Top := 272;
txt_ANTIBANCHANCE.Width := 33;
txt_ANTIBANCHANCE.Height := 22;
txt_ANTIBANCHANCE.Font.Color := clWindowText;
txt_ANTIBANCHANCE.Font.Height := -11;
txt_ANTIBANCHANCE.Font.Name := 'Raavi';
txt_ANTIBANCHANCE.Font.Style := [fsBold];
txt_ANTIBANCHANCE.MaxLength := 3;
txt_ANTIBANCHANCE.ParentFont := False;
txt_ANTIBANCHANCE.TabOrder := 6;
txt_ANTIBANCHANCE.Text := '30';

chk_ANTIRANDOMS := TCheckBox.Create(frm_SETTINGS);
chk_ANTIRANDOMS.Parent := frm_SETTINGS;
chk_ANTIRANDOMS.Left := 384;
chk_ANTIRANDOMS.Top := 312;
chk_ANTIRANDOMS.Width := 17;
chk_ANTIRANDOMS.Height := 17;
chk_ANTIRANDOMS.Checked := True;
chk_ANTIRANDOMS.State := cbChecked;
chk_ANTIRANDOMS.TabOrder := 7;

txt_RANDOMSEVERY := TEdit.Create(frm_SETTINGS);
txt_RANDOMSEVERY.Parent := frm_SETTINGS;
txt_RANDOMSEVERY.Left := 312;
txt_RANDOMSEVERY.Top := 336;
txt_RANDOMSEVERY.Width := 33;
txt_RANDOMSEVERY.Height := 22;
txt_RANDOMSEVERY.Font.Color := clWindowText;
txt_RANDOMSEVERY.Font.Height := -11;
txt_RANDOMSEVERY.Font.Name := 'Raavi';
txt_RANDOMSEVERY.Font.Style := [fsBold];
txt_RANDOMSEVERY.MaxLength := 3;
txt_RANDOMSEVERY.ParentFont := False;
txt_RANDOMSEVERY.TabOrder := 8;
txt_RANDOMSEVERY.Text := '4';

txt_RUNTIME := TEdit.Create(frm_SETTINGS);
txt_RUNTIME.Parent := frm_SETTINGS;
txt_RUNTIME.Left := 88;
txt_RUNTIME.Top := 368;
txt_RUNTIME.Width := 33;
txt_RUNTIME.Height := 22;
txt_RUNTIME.Font.Color := clWindowText;
txt_RUNTIME.Font.Height := -11;
txt_RUNTIME.Font.Name := 'Raavi';
txt_RUNTIME.Font.Style := [fsBold];
txt_RUNTIME.MaxLength := 3;
txt_RUNTIME.ParentFont := False;
txt_RUNTIME.TabOrder := 9;
txt_RUNTIME.Text := '0';

txt_LOGOUTTIME := TEdit.Create(frm_SETTINGS);
txt_LOGOUTTIME.Parent := frm_SETTINGS;
txt_LOGOUTTIME.Left := 136;
txt_LOGOUTTIME.Top := 400;
txt_LOGOUTTIME.Width := 33;
txt_LOGOUTTIME.Height := 22;
txt_LOGOUTTIME.Font.Color := clWindowText;
txt_LOGOUTTIME.Font.Height := -11;
txt_LOGOUTTIME.Font.Name := 'Raavi';
txt_LOGOUTTIME.Font.Style := [fsBold];
txt_LOGOUTTIME.MaxLength := 3;
txt_LOGOUTTIME.ParentFont := False;
txt_LOGOUTTIME.TabOrder := 10;
txt_LOGOUTTIME.Text := '10';

chk_HOUSE := TCheckBox.Create(frm_SETTINGS);
chk_HOUSE.Parent := frm_SETTINGS;
chk_HOUSE.Left := 384;
chk_HOUSE.Top := 432;
chk_HOUSE.Width := 17;
chk_HOUSE.Height := 17;
chk_HOUSE.TabOrder := 11;

Panel1 := TPanel.Create(frm_SETTINGS);
Panel1.Parent := frm_SETTINGS;
Panel1.Left := 224;
Panel1.Top := 464;
Panel1.Width := 177;
Panel1.Height := 57;
Panel1.TabOrder := 12;

radio_USESPELL := TRadioButton.Create(Panel1);
radio_USESPELL.Parent := Panel1;
radio_USESPELL.Left := 48;
radio_USESPELL.Top := 8;
radio_USESPELL.Width := 113;
radio_USESPELL.Height := 17;
radio_USESPELL.Hint := 'Must have runes in inventory.';
radio_USESPELL.Caption := 'Use Spell';
radio_USESPELL.Checked := True;
radio_USESPELL.Font.Color := clWindowText;
radio_USESPELL.Font.Height := -11;
radio_USESPELL.Font.Name := 'Myriad Pro';
radio_USESPELL.Font.Style := [fsBold];
radio_USESPELL.ParentFont := False;
radio_USESPELL.ParentShowHint := False;
radio_USESPELL.ShowHint := True;
radio_USESPELL.TabOrder := 0;
radio_USESPELL.TabStop := True;

radio_MANUAL := TRadioButton.Create(Panel1);
radio_MANUAL.Parent := Panel1;
radio_MANUAL.Left := 48;
radio_MANUAL.Top := 32;
radio_MANUAL.Width := 113;
radio_MANUAL.Height := 17;
radio_MANUAL.Caption := 'Manual (Portal)';
radio_MANUAL.Font.Color := clWindowText;
radio_MANUAL.Font.Height := -11;
radio_MANUAL.Font.Name := 'Myriad Pro';
radio_MANUAL.Font.Style := [fsBold];
radio_MANUAL.ParentFont := False;
radio_MANUAL.ParentShowHint := False;
radio_MANUAL.ShowHint := False;
radio_MANUAL.TabOrder := 1;

txt_ALCHSPEED := TEdit.Create(frm_SETTINGS);
txt_ALCHSPEED.Parent := frm_SETTINGS;
txt_ALCHSPEED.Left := 368;
txt_ALCHSPEED.Top := 536;
txt_ALCHSPEED.Width := 33;
txt_ALCHSPEED.Height := 22;
txt_ALCHSPEED.Font.Color := clWindowText;
txt_ALCHSPEED.Font.Height := -11;
txt_ALCHSPEED.Font.Name := 'Raavi';
txt_ALCHSPEED.Font.Style := [fsBold];
txt_ALCHSPEED.ParentFont := False;
txt_ALCHSPEED.TabOrder := 13;
txt_ALCHSPEED.Text := '2';

txt_WAITTIME := TEdit.Create(frm_SETTINGS);
txt_WAITTIME.Parent := frm_SETTINGS;
txt_WAITTIME.Left := 264;
txt_WAITTIME.Top := 568;
txt_WAITTIME.Width := 49;
txt_WAITTIME.Height := 22;
txt_WAITTIME.Font.Color := clWindowText;
txt_WAITTIME.Font.Height := -11;
txt_WAITTIME.Font.Name := 'Raavi';
txt_WAITTIME.Font.Style := [fsBold];
txt_WAITTIME.ParentFont := False;
txt_WAITTIME.TabOrder := 14;
txt_WAITTIME.Text := '1600';

txt_OPENBANK := TEdit.Create(frm_SETTINGS);
txt_OPENBANK.Parent := frm_SETTINGS;
txt_OPENBANK.Left := 208;
txt_OPENBANK.Top := 600;
txt_OPENBANK.Width := 33;
txt_OPENBANK.Height := 22;
txt_OPENBANK.Font.Color := clWindowText;
txt_OPENBANK.Font.Height := -11;
txt_OPENBANK.Font.Name := 'Raavi';
txt_OPENBANK.Font.Style := [fsBold];
txt_OPENBANK.ParentFont := False;
txt_OPENBANK.TabOrder := 15;
txt_OPENBANK.Text := '5';

btn_LOAD := TButton.Create(frm_SETTINGS);
btn_LOAD.Parent := frm_SETTINGS;
btn_LOAD.Left := 48;
btn_LOAD.Top := 48;
btn_LOAD.Width := 81;
btn_LOAD.Height := 25;
btn_LOAD.Caption := 'Load';
btn_LOAD.TabOrder := 25;

btn_SAVE := TButton.Create(frm_SETTINGS);
btn_SAVE.Parent := frm_SETTINGS;
btn_SAVE.Left := 48;
btn_SAVE.Top := 632;
btn_SAVE.Width := 73;
btn_SAVE.Height := 25;
btn_SAVE.Caption := 'Save';
btn_SAVE.TabOrder := 26;

btn_START := TButton.Create(frm_SETTINGS);
btn_START.OnClick := @StartScript;
btn_START.Parent := frm_SETTINGS;
btn_START.Left := 312;
btn_START.Top := 632;
btn_START.Width := 81;
btn_START.Height := 25;
btn_START.Caption := 'OK';
btn_START.TabOrder := 24;
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frm_SETTINGS.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

begin
SafeInitForm;
SafeShowFormModal;
end.

I get a runtime error:
[Runtime Error] : Exception: Cannot make a visible window modal in line 561 in script

I tried commenting out the different parts of the form (the labels, text boxes, etc.) but to no avail. Any ideas?

Quickmarch

2009-04-07 15:55:45

Lol set: frm_SETTINGS.Visible := True; to False. :P

WhoCares357

2009-04-07 19:21:47

From: Quickmarch
Lol set: frm_SETTINGS.Visible := True; to False. :P


Why? What does the property control?

PS I've never done anything with forms in SCAR so don't mind the noob questions.

Edit: Is there a way to restrict an editable text area to only certain characters (like all numberical)?

ZaSz

2009-04-07 19:29:27

Cause in

procedure ShowFormModal;
begin
frm_SETTINGS.ShowModal;
end;

Your trying to make frm_SETTINGS.Visible := True; turn true.

its kinda complicated. But trust us make it false and it will work

WhoCares357

2009-04-07 19:31:53

From: zasz
Cause in

procedure ShowFormModal;
begin
frm_SETTINGS.ShowModal;
end;

Your trying to make frm_SETTINGS.Visible := True; turn true.

its kinda complicated. But trust us make it false and it will work


Alright, thanks. And about the text restriction?

ZaSz

2009-04-07 19:50:39

Ok thats a little complicated i think.

but i think this will work.


procedure StartScript(sender: TObject);
begin

Writeln('Button pressed!');
if (pos('a', txt_ALCHSPEED.Text) > 0 ) then
begin
writeln('Cant continue script with letters in the alchspeed!');
end else
if (pos('b', txt_ALCHSPEED.Text) > 0 ) then
begin
writeln('Cant continue script with letters in the alchspeed!');
end else // ect ect...
begin
frm_SETTINGS.Caption := frm_SETTINGS.Caption + '.';
frm_SETTINGS.ModalResult := mrOk;
end;
end;

WhoCares357

2009-04-07 21:24:34

From: zasz
Ok thats a little complicated i think.

but i think this will work.


procedure StartScript(sender: TObject);
begin

Writeln('Button pressed!');
if (pos('a', txt_ALCHSPEED.Text) > 0 ) then
begin
writeln('Cant continue script with letters in the alchspeed!');
end else
if (pos('b', txt_ALCHSPEED.Text) > 0 ) then
begin
writeln('Cant continue script with letters in the alchspeed!');
end else // ect ect...
begin
frm_SETTINGS.Caption := frm_SETTINGS.Caption + '.';
frm_SETTINGS.ModalResult := mrOk;
end;
end;


Well I think I can think of a way to extract the numbers from the actual input. I just know that in other languages (for example actionscript) you can limit the input to certain character types. That way the program only listens for the specific characters input and therefore only processes those. I was just wondering if SCAR had anything like that.

ZaSz

2009-04-08 01:49:04

I know, but the way I have it it will not continue the script unless you take out the letters.

nielsie95

2009-04-08 03:19:17

From: WhoCares357
Well I think I can think of a way to extract the numbers from the actual input. I just know that in other languages (for example actionscript) you can limit the input to certain character types. That way the program only listens for the specific characters input and therefore only processes those. I was just wondering if SCAR had anything like that.


This will limit a TEdit (I guess it would work on a TMemo too) to numerical input only.


procedure KeyPress(Sender: TObject; var Key: Char);
begin
case Key of
'0'..'9': ;
else Key := #0;
end;
end;
and in your setup:

{component}.OnKeyPress := @KeyPress;

If you want to validate a string:

if (GetNumbers(s) <> s) then
WriteLn('s should only contain numbers!');
if (GetLetters(s) <> s) then
WriteLn('s should only contain letters!');
//or with regex:
if (FindRegex(UpperCase(s), '[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}') <> UpperCase(s)) then
WriteLn('no valid email')
else
WriteLn('valid email');

WhoCares357

2009-04-08 07:31:47

Thank you. Just what I needed.