Awkwardsaw
2009-07-10 04:07:46
these are a few little things that i came up with, they may not be useful for others, but i think i can use them.
the first script opens up a form, where you decide which command you want to do. you can only use one at a time for now, if i feel like it i'll change it so you can do how many ever i want(all i have to do is change ids)
you put the "receiver" procedure into the script that you want to you, and when the script calls it, it will do what ever it is told.
the remote control part:
and the receiver procedure:
hopefully i get some ideas going to make better and more usefull commands, and the same goes with you guys
enjoy and post feed back :)
the first script opens up a form, where you decide which command you want to do. you can only use one at a time for now, if i feel like it i'll change it so you can do how many ever i want(all i have to do is change ids)
you put the "receiver" procedure into the script that you want to you, and when the script calls it, it will do what ever it is told.
the remote control part:
program New;
var
// InitForm variables.
EndInitForm : Boolean;
frmDesign : TForm;
Label1 : TLabel;
CheckBox1, CheckBox2, CheckBox3, CheckBox4,
CheckBox5 : TCheckBox;
Button1 : TButton;
procedure InitFormOnClose(Sender : TObject; var Action : TCloseAction);
begin
if (not(frmDesign.ModalResult = 1)) then
EndInitForm := True;
end;
procedure StartClick(sender: TObject);
begin
frmDesign.ModalResult:= mrOk; // Closes the form
if CheckBox1.Checked then
begin
SendInterSCARInteger('id', 1);
end;
if CheckBox2.Checked then
begin
SendInterSCARInteger('id', 2);
end;
if CheckBox3.Checked then
begin
SendInterSCARInteger('id', 3);
end;
if CheckBox4.Checked then
begin
SendInterSCARInteger('id', 4);
end;
if CheckBox5.Checked then
begin
SendInterSCARInteger('id', 5);
end;
end;
procedure InitForm;
var
TimeInitForm : Integer;
begin
TimeInitForm := GetSystemTime;
frmDesign := CreateForm;
with frmDesign do
begin
OnClose := @InitFormOnClose;
Position := poScreenCenter;
BorderStyle := bsSingle;
BorderIcons := [biMinimize,biSystemMenu];
ClientWidth := 183;
ClientHeight := 213;
Caption := 'Remote Control';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -16;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
Label1 := TLabel.Create(frmDesign);
with Label1 do
begin
Parent := frmDesign;
Left := 24;
Top := 8;
Width := 127;
Height := 20;
Caption := 'Remote Control';
Font.Color := clGreen;
Font.Height := -16;
Font.Name := 'MS Sans Serif';
Font.Style := [fsBold, fsUnderline];
end;
CheckBox1 := TCheckBox.Create(frmDesign);
with CheckBox1 do
begin
Parent := frmDesign;
Left := 24;
Top := 40;
Width := 137;
Height := 17;
Caption := 'Terminate Script';
TabOrder := 8;
end;
CheckBox2 := TCheckBox.Create(frmDesign);
with CheckBox2 do
begin
Parent := frmDesign;
Left := 24;
Top := 64;
Width := 145;
Height := 25;
Caption := 'Progress Report';
TabOrder := 9;
end;
CheckBox3 := TCheckBox.Create(frmDesign);
with CheckBox3 do
begin
Parent := frmDesign;
Left := 24;
Top := 96;
Width := 105;
Height := 17;
Caption := 'Next Player';
TabOrder := 10;
end;
CheckBox4 := TCheckBox.Create(frmDesign);
with CheckBox4 do
begin
Parent := frmDesign;
Left := 24;
Top := 120;
Width := 97;
Height := 25;
Caption := 'Log Out';
TabOrder := 11;
end;
CheckBox5 := TCheckBox.Create(frmDesign);
with CheckBox5 do
begin
Parent := frmDesign;
Left := 24;
Top := 144;
Width := 97;
Height := 25;
Caption := 'Log In';
TabOrder := 12;
end;
Button1 := TButton.Create(frmDesign);
with Button1 do
begin
Parent := frmDesign;
Left := 40;
Top := 176;
Width := 75;
Height := 25;
Caption := 'Go';
TabOrder := 13;
Button1.OnClick := @StartClick;
end;
WriteLn('InitForm compiled in ' + IntToStr(GetSystemTime - TimeInitForm) + ' milliseconds!');
end;
procedure SafeInitForm;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowInitFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowInitFormModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowInitFormModal', v);
end;
procedure MainInitForm;
begin
try
SafeInitForm;
SafeShowInitFormModal;
finally
FreeForm(frmDesign);
except
WriteLn('An error seems to have occurred in: InitForm');
end;
end;
begin
ClearDebug;
GetSelf.WindowState := wsMinimized;
MainInitForm;
GetSelf.WindowState := wsNormal;
if (EndInitForm) then
TerminateScript;
end.and the receiver procedure:
procedure InterScarControl;
begin
case readinterscarinteger('id') of
1: begin
writeln('Inter Scar Control: Terminating');
terminatescript;
end;
2: begin
writeln('Inter Scar Control: Progress Report');
//your own progress report procedure
end;
3: begin
writeln('Inter Scar Control: Next Player');
//your own Next player procedure
end;
4: begin
writeln('Inter Scar Control: Log Out');
Logout;
while not readinterscarinteger('id') = 5 do wait(100 + random(1000));
end;
5: begin
writeln('Inter Scar Control: Log In');
Loginplayer;
end;
end;
sendinterscarinteger('id', 0);
end;hopefully i get some ideas going to make better and more usefull commands, and the same goes with you guys
enjoy and post feed back :)